diff options
author | Achim Gratz <stromeko@nexgo.de> | 2011-06-27 12:12:23 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-06-27 12:12:23 +0200 |
commit | d37223562d5e3ed6872c2f22af79147c3b98cfd4 (patch) | |
tree | 089085e758951be1040f03d0dd3b8db73aa8f873 | |
parent | 4c219561512f09cc95fb8e2a0c073dbbd6d66d25 (diff) | |
download | org-mode-d37223562d5e3ed6872c2f22af79147c3b98cfd4.tar.gz |
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
-rw-r--r-- | doc/org.texi | 8 | ||||
-rw-r--r-- | lisp/org-clock.el | 40 | ||||
-rw-r--r-- | lisp/org.el | 2 |
3 files changed, 36 insertions, 14 deletions
diff --git a/doc/org.texi b/doc/org.texi index f723831..8b5303e 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 b1edfa3..3264337 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\". |