From 7b8a24194b17314544ecd0ba5d2b047ddeb2bb94 Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Tue, 26 Aug 2014 21:30:06 -0400 Subject: [PATCH 1/2] org-faces.el: fix docstring typo --- lisp/org-faces.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-faces.el b/lisp/org-faces.el index 83453e858..6e62ad03f 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -491,7 +491,7 @@ changes." (defface org-meta-line (org-compatible-face 'font-lock-comment-face nil) - "Face for meta lines startin with \"#+\"." + "Face for meta lines starting with \"#+\"." :group 'org-faces :version "22.1") From ef5ec3d536710bd6c99ec03f643d0934c133ba74 Mon Sep 17 00:00:00 2001 From: Konubinix Date: Tue, 26 Aug 2014 09:11:23 +0200 Subject: [PATCH 2/2] Use `org-clock-string' whenever possible * lisp/org-clock.el (org-find-open-clocks): * lisp/org.el (org-clone-subtree-with-time-shift, org-insert-property-drawer, org-at-clock-log-p): Use `org-clock-string' whenever possible instead of hardcoded "CLOCK". (org-clock-line-re): New variable. --- lisp/org-clock.el | 3 ++- lisp/org.el | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 179d395f9..2ffcbfaf1 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -795,11 +795,12 @@ If CLOCK-SOUND is non-nil, it overrides `org-clock-sound'." "Search through the given file and find all open clocks." (let ((buf (or (get-file-buffer file) (find-file-noselect file))) + (org-clock-re (concat org-clock-string " \\(\\[.*?\\]\\)$")) clocks) (with-current-buffer buf (save-excursion (goto-char (point-min)) - (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t) + (while (re-search-forward org-clock-re nil t) (push (cons (copy-marker (match-end 1) t) (org-time-string-to-time (match-string 1))) clocks)))) clocks)) diff --git a/lisp/org.el b/lisp/org.el index d529a3134..9fada3268 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -396,6 +396,10 @@ a timestamp with \\[org-schedule].") "Matches a line with planning or clock info. Matched keyword is in group 1.") +(defconst org-clock-line-re + (concat "^[ \t]*" org-clock-string) + "Matches a line with clock info.") + ;;;; Drawer (defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$" @@ -8659,6 +8663,7 @@ and still retain the repeater to cover future instances of the task." ""))) ;; No time shift (n-no-remove -1) (drawer-re org-drawer-regexp) + (org-clock-re (format "^[ \t]*%s.*$" org-clock-string)) beg end template task idprop shift-n shift-what doshift nmin nmax) (if (not (and (integerp n) (> n 0))) @@ -8698,7 +8703,7 @@ and still retain the repeater to cover future instances of the task." (org-entry-delete nil "ID") (org-id-get-create t))) (unless (= n 0) - (while (re-search-forward "^[ \t]*CLOCK:.*$" nil t) + (while (re-search-forward org-clock-re nil t) (kill-whole-line)) (goto-char (point-min)) (while (re-search-forward drawer-re nil t) @@ -15883,6 +15888,9 @@ formats in the current buffer." 0)) (beg (point)) (re (concat "^[ \t]*" org-keyword-time-regexp)) + (org-clock-re (format "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|%s\\|:END:\\)" + org-clock-string)) + (org-skip-line-list (list org-clock-string ":END:")) end hiddenp) (outline-next-heading) (setq end (point)) @@ -15891,8 +15899,8 @@ formats in the current buffer." (setq hiddenp (outline-invisible-p)) (end-of-line 1) (and (equal (char-after) ?\n) (forward-char 1)) - (while (looking-at "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|CLOCK:\\|:END:\\)") - (if (member (match-string 1) '("CLOCK:" ":END:")) + (while (looking-at org-clock-re) + (if (member (match-string 1) org-skip-line-list) ;; just skip this line (beginning-of-line 2) ;; Drawer start, find the end @@ -17589,7 +17597,7 @@ With prefix ARG, change that many days." "Is the cursor on the clock log line?" (save-excursion (move-beginning-of-line 1) - (looking-at "^[ \t]*CLOCK:"))) + (looking-at org-clock-line-re))) (defvar org-clock-history) ; defined in org-clock.el (defvar org-clock-adjust-closest nil) ; defined in org-clock.el