Add logging support for refiling

Proposal by Charles Cave.
This commit is contained in:
Carsten Dominik 2010-03-25 07:22:11 +01:00
parent 93af0ec925
commit f237acfd85
5 changed files with 70 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-03-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Refiling notes): Document refile logging.
(In-buffer settings): Document refile logging keywords.
2010-03-17 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Drawers): Document `C-c C-z' command.

View File

@ -6241,6 +6241,7 @@ process, you can use the following special command:
@vindex org-refile-use-outline-path
@vindex org-outline-path-complete-in-steps
@vindex org-refile-allow-creating-parent-nodes
@vindex org-log-refile
Refile the entry or region at point. This command offers possible locations
for refiling the entry and lets you select one with completion. The item (or
all items in the region) is filed below the target heading as a subitem.
@ -6254,6 +6255,10 @@ the variables @code{org-refile-use-outline-path} and
@code{org-outline-path-complete-in-steps}. If you would like to be able to
create new nodes as new parents for refiling on the fly, check the
variable @code{org-refile-allow-creating-parent-nodes}.
When the variable @code{org-log-refile}@footnote{with corresponding
@code{#+STARTUP} keywords @code{logrefile}, @code{lognoterefile},
and @code{nologrefile}} is set, a time stamp or a note will be
recorded when an entry has been refiled.
@kindex C-u C-c C-w
@item C-u C-c C-w
Use the refile interface to jump to a heading.
@ -10770,6 +10775,9 @@ configured using these options (see variables @code{org-log-done},
@cindex @code{logredeadline}, STARTUP keyword
@cindex @code{lognoteredeadline}, STARTUP keyword
@cindex @code{nologredeadline}, STARTUP keyword
@cindex @code{logrefile}, STARTUP keyword
@cindex @code{lognoterefile}, STARTUP keyword
@cindex @code{nologrefile}, STARTUP keyword
@example
logdone @r{record a timestamp when an item is marked DONE}
lognotedone @r{record timestamp and a note when DONE}
@ -10785,6 +10793,9 @@ nologreschedule @r{do not record when a scheduling date changes}
logredeadline @r{record a timestamp when deadline changes}
lognoteredeadline @r{record a note when deadline changes}
nologredeadline @r{do not record when a deadline date changes}
logrefile @r{record a timestamp when refiling}
lognoterefile @r{record a note when refiling}
nologrefile @r{do not record when refiling}
@end example
@vindex org-hide-leading-stars
@vindex org-odd-levels-only

View File

@ -1,3 +1,15 @@
2010-03-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-log-refile): New option.
(org-log-note-headings): Add a heading for refiling.
(org-startup-options): Add keywords for logging of the refile
action.
(org-refile): Add logging action.
(org-add-log-note): Allow for refiling action.
* org-agenda.el (org-agenda-bulk-action): Make sure
`org-log-refile' is not `note' during a bulk action.
2010-03-24 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-map-dblocks): Use save-excursion to remember the

View File

@ -7427,6 +7427,7 @@ The prefix arg is passed through to the command if possible."
(error "No entries are marked"))
(message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline")
(let* ((action (read-char-exclusive))
(org-log-refile (if org-log-refile 'time nil))
(entries (reverse org-agenda-bulk-marked-entries))
cmd rfloc state e tag pos (cnt 0) (cntskip 0))
(cond

View File

@ -1588,6 +1588,33 @@ are matched against file names, and values."
(repeat :tag "By file name regexp"
(cons regexp boolean))))
(defcustom org-log-refile nil
"Information to record when a task is refiled.
Possible values are:
nil Don't add anything
time Add a time stamp to the task
note Prompt for a note and add it with template `org-log-note-headings'
This option can also be set with on a per-file-basis with
#+STARTUP: nologrefile
#+STARTUP: logrefile
#+STARTUP: lognoterefile
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords.
When bulk-refiling from the agenda, the value `note' is forbidden and
will temporarily be changed to `time'."
:group 'org-refile
:group 'org-progress
:type '(choice
(const :tag "No logging" nil)
(const :tag "Record timestamp" time)
(const :tag "Record timestamp with note." note)))
(defcustom org-refile-targets nil
"Targets for refiling entries with \\[org-refile].
This is list of cons cells. Each cell contains:
@ -2069,6 +2096,7 @@ When nil, only the date will be recorded."
(delschedule . "Not scheduled, was %S on %t")
(redeadline . "New deadline from %S on %t")
(deldeadline . "Removed deadline, was %S on %t")
(refile . "Refiled on %t")
(clock-out . ""))
"Headings for notes added to entries.
The value is an alist, with the car being a symbol indicating the note
@ -2093,8 +2121,9 @@ agenda log mode depends on the format of these entries."
(cons (const :tag "Heading when clocking out" clock-out) string)
(cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
(cons (const :tag "Heading when rescheduling" reschedule) string)
(cons (const :tag "Heading when changing deadline" redeadline) string
(cons (const :tag "Heading when deleting a deadline" deldeadline) string))))
(cons (const :tag "Heading when changing deadline" redeadline) string)
(cons (const :tag "Heading when deleting a deadline" deldeadline) string)
(cons (const :tag "Heading when refiling" refile) string)))
(unless (assq 'note org-log-note-headings)
(push '(note . "%t") org-log-note-headings))
@ -3795,6 +3824,9 @@ After a match, the following groups carry important information:
("logredeadline" org-log-redeadline time)
("lognoteredeadline" org-log-redeadline note)
("nologredeadline" org-log-redeadline nil)
("logrefile" org-log-refile time)
("lognoterefile" org-log-refile note)
("nologrefile" org-log-refile nil)
("fninline" org-footnote-define-inline t)
("nofninline" org-footnote-define-inline nil)
("fnlocal" org-footnote-section nil)
@ -9489,6 +9521,11 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
(or (outline-next-heading) (goto-char (point-max)))))
(if (not (bolp)) (newline))
(org-paste-subtree level)
(when org-log-refile
(org-add-log-setup 'refile nil nil 'findpos
org-log-refile)
(unless (eq org-log-refile 'note)
(save-excursion (org-add-log-note))))
(and org-auto-align-tags (org-set-tags nil t))
(bookmark-set "org-refile-last-stored")
(if (fboundp 'deactivate-mark) (deactivate-mark))
@ -11119,6 +11156,8 @@ EXTRA is additional text that will be inserted into the notes buffer."
"changing deadline")
((eq org-log-note-purpose 'deldeadline)
"removing deadline")
((eq org-log-note-purpose 'refile)
"refiling")
((eq org-log-note-purpose 'note)
"this entry")
(t (error "This should not happen")))))