Ver código fonte

Harden `org-at-clock-log-p'

* lisp/org.el (org-at-clock-log-p): Do strict checking.
Nicolas Goaziou 8 anos atrás
pai
commit
ec285b1057
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4 5
      lisp/org.el

+ 4 - 5
lisp/org.el

@@ -18046,11 +18046,10 @@ stamps in properties drawers, planning lines and clocks."
       (message "Timestamp is now %sactive"
 	       (if (equal (char-after beg) ?<) "" "in")))))
 
-(defun org-at-clock-log-p nil
-  "Is the cursor on the clock log line?"
-  (save-excursion
-    (beginning-of-line)
-    (looking-at org-clock-line-re)))
+(defun org-at-clock-log-p ()
+  "Non-nil if point is on a clock log line."
+  (and (org-match-line org-clock-line-re)
+       (eq (org-element-type (save-match-data (org-element-at-point))) 'clock)))
 
 (defvar org-clock-history)                     ; defined in org-clock.el
 (defvar org-clock-adjust-closest nil)          ; defined in org-clock.el