emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Make use of the constant `org-clock-string' whenever possibl


From: Samuel Loury
Subject: [O] [PATCH] Make use of the constant `org-clock-string' whenever possible
Date: Tue, 26 Aug 2014 09:29:55 +0200
User-agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu)

Hi,

I would like to submit a tiny patch to make use of `org-clock-string'
instead of the hard coded value CLOCK: whenever possible.

I also found out that :CLOCK: was hard coded in
`org-insert-property-drawer' (git sha
67ae102b4be87976240555d1c0d80ee55906f53c, file lisp/org.el:15897)
instead of using `org-clock-drawer-start-re' but I did not have time to
fix this one.

Please find the patch attached to this mail.
From 8eedb019d277f7f1e8baa6641244ddf7e298d397 Mon Sep 17 00:00:00 2001
From: Konubinix <address@hidden>
Date: Tue, 26 Aug 2014 09:11:23 +0200
Subject: [PATCH] Make use of the constant `org-clock-string' whenever possible

Instead of the hardcoded value "CLOCK:".

* lisp/org-clock.el (org-find-open-clocks)
* lisp/org.el (org-clone-subtree-with-time-shift)
* lisp/org.el (org-insert-property-drawer)
* lisp/org.el (org-at-clock-log-p)

TINYCHANGE
---
 lisp/org-clock.el |  2 +-
 lisp/org.el       | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 179d395..14b613e 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -799,7 +799,7 @@ If CLOCK-SOUND is non-nil, it overrides `org-clock-sound'."
     (with-current-buffer buf
       (save-excursion
        (goto-char (point-min))
-       (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t)
+       (while (re-search-forward (concat org-clock-string " \\(\\[.*?\\]\\)$") 
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 750b9d1..4559280 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8698,7 +8698,8 @@ 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
+                     (format "^[ \t]*%s.*$" org-clock-string) nil t)
                (kill-whole-line))
              (goto-char (point-min))
              (while (re-search-forward drawer-re nil t)
@@ -15891,8 +15892,12 @@ 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
+           (format
+            "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|%s\\|:END:\\)"
+            org-clock-string))
+      (if (member (match-string 1)
+                 (list org-clock-string ":END:"))
          ;; just skip this line
          (beginning-of-line 2)
        ;; Drawer start, find the end
@@ -17589,7 +17594,8 @@ 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
+     (concat "^[ \t]*" org-clock-string))))
 
 (defvar org-clock-history)                     ; defined in org-clock.el
 (defvar org-clock-adjust-closest nil)          ; defined in org-clock.el
-- 
2.1.0.rc1

--
Samuel

Attachment: pgpJo1pOWYeTQ.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]