Browse Source

Simplified Richard's clock out note hack function.

Matt Lundin 10 years ago
parent
commit
688f7d0234
1 changed files with 10 additions and 10 deletions
  1. 10 10
      org-hacks.org

+ 10 - 10
org-hacks.org

@@ -986,16 +986,16 @@ when the tag "=clockout_note=" is found in a headline. It uses the tag
 ("=clockout_note=") so inheritance can also be used...
 
 #+begin_src emacs-lisp
-     (defun rgr/check-for-clock-out-note()
-           (interactive)
-           (save-excursion
-             (set-mark (goto-char (org-entry-beginning-position)))
-             (let ((tags (org-get-tags)))
-               (message "tags: %s " tags)
-               (if (member "clockout_note" tags)
-                   (org-add-note)))))
- 
-     (add-hook 'org-clock-out-hook 'rgr/check-for-clock-out-note)
+  (defun rgr/check-for-clock-out-note()
+        (interactive)
+        (save-excursion 
+          (org-back-to-heading)
+          (let ((tags (org-get-tags)))
+            (and tags (message "tags: %s " tags)
+                 (when (member "clocknote" tags)
+                   (org-add-note))))))
+   
+  (add-hook 'org-clock-out-hook 'rgr/check-for-clock-out-note)
 #+end_src
 *** Dynamically adjust tag position
 Here is a bit of code that allows you to have the tags always