Ver Fonte

Check whether org-clock-into-string is a string

John Wiegley há 15 anos atrás
pai
commit
1affd3bbb6
2 ficheiros alterados com 22 adições e 13 exclusões
  1. 5 0
      lisp/ChangeLog
  2. 17 13
      lisp/org-clock.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-11-12  John Wiegley  <jwiegley@gmail.com>
+
+	* org-clock.el (org-clock-resolve): If `org-clock-into-string' is
+	a string, use that to find the LOGBOOK drawer.
+
 2009-11-12  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-clone-subtree-with-time-shift): Make it work at the

+ 17 - 13
lisp/org-clock.el

@@ -678,22 +678,26 @@ was started."
 	  (save-window-excursion
 	    (save-excursion
 	      (unless org-clock-resolving-clocks-due-to-idleness
-		(org-with-clock clock
-		  (org-clock-goto))
+		(org-with-clock clock (org-clock-goto))
 		(with-current-buffer (marker-buffer (car clock))
 		  (goto-char (car clock))
 		  (if org-clock-into-drawer
-		      (ignore-errors
-			(outline-flag-region (save-excursion
-					       (outline-back-to-heading t)
-					       (search-forward ":LOGBOOK:")
-					       (goto-char (match-beginning 0)))
-					     (save-excursion
-					       (outline-back-to-heading t)
-					       (search-forward ":LOGBOOK:")
-					       (search-forward ":END:")
-					       (goto-char (match-end 0)))
-					     nil)))))
+		      (let ((logbook
+			     (if (stringp org-clock-into-drawer)
+				 (concat ":" org-clock-into-drawer ":")
+			       ":LOGBOOK:")))
+			(ignore-errors
+			  (outline-flag-region
+			   (save-excursion
+			     (outline-back-to-heading t)
+			     (search-forward logbook)
+			     (goto-char (match-beginning 0)))
+			   (save-excursion
+			     (outline-back-to-heading t)
+			     (search-forward logbook)
+			     (search-forward ":END:")
+			     (goto-char (match-end 0)))
+			   nil))))))
 	      (let (char-pressed)
 		(while (null char-pressed)
 		  (setq char-pressed