mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-27 03:32:53 +00:00
Skip all drawers when adding a note.
Patch by James TD Smith.
This commit is contained in:
parent
bd8cbef200
commit
8892d9a4bc
|
@ -1,5 +1,8 @@
|
||||||
2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
|
2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
|
||||||
|
|
||||||
|
* org.el (org-add-log-setup): Skip over drawers (properties,
|
||||||
|
clocks etc) when adding notes.
|
||||||
|
|
||||||
* org-agenda.el (org-agenda-get-closed): show durations of clocked
|
* org-agenda.el (org-agenda-get-closed): show durations of clocked
|
||||||
items as well as the start and end times.
|
items as well as the start and end times.
|
||||||
|
|
||||||
|
|
41
lisp/org.el
41
lisp/org.el
|
@ -9035,7 +9035,7 @@ The auto-repeater uses this.")
|
||||||
"Add a note to the current entry.
|
"Add a note to the current entry.
|
||||||
This is done in the same way as adding a state change note."
|
This is done in the same way as adding a state change note."
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-add-log-setup 'note nil t nil))
|
(org-add-log-setup 'note nil 'findpos nil))
|
||||||
|
|
||||||
(defun org-add-log-setup (&optional purpose state findpos how &optional extra)
|
(defun org-add-log-setup (&optional purpose state findpos how &optional extra)
|
||||||
"Set up the post command hook to take a note.
|
"Set up the post command hook to take a note.
|
||||||
|
@ -9044,23 +9044,28 @@ When FINDPOS is non-nil, find the correct position for the note in
|
||||||
the current entry. If not, assume that it can be inserted at point.
|
the current entry. If not, assume that it can be inserted at point.
|
||||||
HOW is an indicator what kind of note should be created.
|
HOW is an indicator what kind of note should be created.
|
||||||
EXTRA is additional text that will be inserted into the notes buffer."
|
EXTRA is additional text that will be inserted into the notes buffer."
|
||||||
(save-excursion
|
(save-restriction
|
||||||
(when findpos
|
(save-excursion
|
||||||
(org-back-to-heading t)
|
(when findpos
|
||||||
(looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
|
(org-back-to-heading t)
|
||||||
"\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
|
(org-narrow-to-subtree)
|
||||||
"[^\r\n]*\\)?"))
|
(while (re-search-forward
|
||||||
(goto-char (match-end 0))
|
(concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)")
|
||||||
(unless org-log-states-order-reversed
|
(point-max) t) (forward-line))
|
||||||
(and (= (char-after) ?\n) (forward-char 1))
|
(looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
|
||||||
(org-skip-over-state-notes)
|
"\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
|
||||||
(skip-chars-backward " \t\n\r")))
|
"[^\r\n]*\\)?"))
|
||||||
(move-marker org-log-note-marker (point))
|
(goto-char (match-end 0))
|
||||||
(setq org-log-note-purpose purpose
|
(unless org-log-states-order-reversed
|
||||||
org-log-note-state state
|
(and (= (char-after) ?\n) (forward-char 1))
|
||||||
org-log-note-how how
|
(org-skip-over-state-notes)
|
||||||
org-log-note-extra extra)
|
(skip-chars-backward " \t\n\r")))
|
||||||
(add-hook 'post-command-hook 'org-add-log-note 'append)))
|
(move-marker org-log-note-marker (point))
|
||||||
|
(setq org-log-note-purpose purpose
|
||||||
|
org-log-note-state state
|
||||||
|
org-log-note-how how
|
||||||
|
org-log-note-extra extra)
|
||||||
|
(add-hook 'post-command-hook 'org-add-log-note 'append))))
|
||||||
|
|
||||||
(defun org-skip-over-state-notes ()
|
(defun org-skip-over-state-notes ()
|
||||||
"Skip past the list of State notes in an entry."
|
"Skip past the list of State notes in an entry."
|
||||||
|
|
Loading…
Reference in a new issue