From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: [PATCH] Introduce CLOCK_INTO_DRAWER property like the existing LOG_INTO_DRAWER (was: [Bug] Doc string for org-clock-into-drawer truncated?) Date: Sun, 26 Jun 2011 18:10:36 +0200 Message-ID: <87r56gwp37.fsf_-_@Rainer.invalid> References: <87sjr470yn.fsf@Rainer.invalid> <875E1ACA-B404-4783-95B3-3EAE52759E0C@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QarvD-0004Dm-Eg for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 12:10:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QarvB-0001lY-8Y for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 12:10:55 -0400 Received: from lo.gmane.org ([80.91.229.12]:55935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QarvA-0001lK-Qq for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 12:10:53 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qarv9-00067u-Co for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 18:10:51 +0200 Received: from p57aac202.dip.t-dialin.net ([87.170.194.2]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Jun 2011 18:10:51 +0200 Received: from Stromeko by p57aac202.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Jun 2011 18:10:51 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Carsten Dominik writes: >> For symmetry it seems that one should be able to specify a property >> CLOCK_INTO_DRAWER specifically for clocking or fall back onto LOG_INTO >> DRAWER, just like the customization variables allow one to do. > > > This does make sense, can you make a patch? Here it is: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Introduce-CLOCK_INTO_DRAWER-property-like-the-existi.patch Content-Description: CLOCK_INTO_DRAWER property >From 8a07f2fae381196242b3c3af50e0b1d7364ba504 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sat, 25 Jun 2011 17:25:41 +0200 Subject: [PATCH] Introduce CLOCK_INTO_DRAWER property like the existing LOG_INTO_DRAWER * lisp/org.el (defcustom org-log-into-drawer): correct typo * lisp/org-clock.el: new function org-clock-into-drawer to change the location of clock events based on properties CLOCK_INTO_DRAWER or, as fallback, LOG_INTO_DRAWER, like it is already possible for state change logs. * lisp/org-clock.el (org-clock-jump-to-current-clock): add statement to let clause to bind org-clock-into-drawer to result of function eval * lisp/org-clock.el (org-clock-find-position): add statement to let clause to bind org-clock-into-drawer to result of function eval, change let to let* since the binding is used later in the same clause * doc/org.texi: document that both CLOCK_INTO_DRAWER and LOG_INTO_DRAWER can be used to override the contents of variable org-clock-into-drawer (or if unset, org-log-into-drawer) * doc/org.texi: @xref->@pxref --- doc/org.texi | 8 ++++++-- lisp/org-clock.el | 40 +++++++++++++++++++++++++++++----------- lisp/org.el | 2 +- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index a397a7e..274a133 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -5759,11 +5759,15 @@ what to do with it. @table @kbd @orgcmd{C-c C-x C-i,org-clock-in} @vindex org-clock-into-drawer +@cindex property, LOG_INTO_DRAWER Start the clock on the current item (clock-in). This inserts the CLOCK keyword together with a timestamp. If this is not the first clocking of this item, the multiple CLOCK lines will be wrapped into a @code{:LOGBOOK:} drawer (see also the variable -@code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument, +@code{org-clock-into-drawer}). You can also overrule +the setting of this variable for a subtree by setting a +@code{CLOCK_INTO_DRAWER} or @code{LOG_INTO_DRAWER} property. +When called with a @kbd{C-u} prefix argument, select the task from a list of recently clocked tasks. With two @kbd{C-u C-u} prefixes, clock into the task at point and mark it as the default task. The default task will always be available when selecting a clocking task, @@ -8950,7 +8954,7 @@ If the syntax for the label format conflicts with the language syntax, use a @code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal -n -r -l "((%s))"}. See also the variable @code{org-coderef-label-format}. -HTML export also allows examples to be published as text areas (@xref{Text +HTML export also allows examples to be published as text areas (@pxref{Text areas in HTML export}). Because the @code{#+BEGIN_...} and @code{#+END_...} patterns need to be added diff --git a/lisp/org-clock.el b/lisp/org-clock.el index abab70c..6e8295f 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -64,6 +64,22 @@ which see." (const :tag "Into LOGBOOK drawer" "LOGBOOK") (string :tag "Into Drawer named..."))) +(defun org-clock-into-drawer () + "Return the value of `org-clock-into-drawer', but let properties overrule. +If the current entry has or inherits a CLOCK_INTO_DRAWER +property, it will be used instead of the default value; otherwise +if the current entry has or inherits a LOG_INTO_DRAWER property, +it will be used instead of the default value. +The default is the value of the customizable variable `org-clock-into-drawer', +which see." + (let ((p (org-entry-get nil "CLOCK_INTO_DRAWER" 'inherit)) + (q (org-entry-get nil "LOG_INTO_DRAWER" 'inherit))) + (cond + ((or (not (or p q)) (equal p "nil") (equal q "nil")) org-clock-into-drawer) + ((or (equal p "t") (equal q "t")) "LOGBOOK") + ((not p) q) + (t p)))) + (defcustom org-clock-out-when-done t "When non-nil, clock will be stopped when the clocked entry is marked DONE. DONE here means any DONE-like state. @@ -761,7 +777,8 @@ If necessary, clock-out of the currently active clock." (defun org-clock-jump-to-current-clock (&optional effective-clock) (interactive) - (let ((clock (or effective-clock (cons org-clock-marker + (let ((org-clock-into-drawer (org-clock-into-drawer)) + (clock (or effective-clock (cons org-clock-marker org-clock-start-time)))) (unless (marker-buffer (car clock)) (error "No clock is currently running")) @@ -1216,16 +1233,17 @@ When FIND-UNCLOSED is non-nil, first check if there is an unclosed clock line and position cursor in that line." (org-back-to-heading t) (catch 'exit - (let ((beg (save-excursion - (beginning-of-line 2) - (or (bolp) (newline)) - (point))) - (end (progn (outline-next-heading) (point))) - (re (concat "^[ \t]*" org-clock-string)) - (cnt 0) - (drawer (if (stringp org-clock-into-drawer) - org-clock-into-drawer "LOGBOOK")) - first last ind-last) + (let* ((org-clock-into-drawer (org-clock-into-drawer)) + (beg (save-excursion + (beginning-of-line 2) + (or (bolp) (newline)) + (point))) + (end (progn (outline-next-heading) (point))) + (re (concat "^[ \t]*" org-clock-string)) + (cnt 0) + (drawer (if (stringp org-clock-into-drawer) + org-clock-into-drawer "LOGBOOK")) + first last ind-last) (goto-char beg) (when (and find-unclosed (re-search-forward diff --git a/lisp/org.el b/lisp/org.el index 257bf4e..9cc3c94 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2375,7 +2375,7 @@ When nil, state changes notes will be inserted after the headline and any scheduling and clock lines, but not inside a drawer. The value of this variable should be the name of the drawer to use. -LOGBOOK is proposed at the default drawer for this purpose, you can +LOGBOOK is proposed as the default drawer for this purpose, you can also set this to a string to define the drawer of your choice. A value of t is also allowed, representing \"LOGBOOK\". -- 1.7.5.4 --=-=-= It has survived my limited testing and I've provided minimal info documentation. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Q+, Q and microQ: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds --=-=-=--