mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 06:02:53 +00:00
Add tools for tracking meeting notes
* lisp/org.el (org-numbered-action-format): New option. (org-new-numbered-action): New command. (org-collect-todos-in-subtree): New command.
This commit is contained in:
parent
b71413947c
commit
b8fdddcd9c
56
lisp/org.el
56
lisp/org.el
|
@ -1104,6 +1104,12 @@ breaking the list structure."
|
|||
(const :tag "Always" t)
|
||||
(const :tag "Auto" auto)))))
|
||||
|
||||
(defcustom org-numbered-action-format "TODO Action #%d "
|
||||
"Default structure of the headling of a new action.
|
||||
%d will become the number of the action."
|
||||
:group 'org-edit-structure
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-insert-heading-hook nil
|
||||
"Hook being run after inserting a new heading."
|
||||
:group 'org-edit-structure
|
||||
|
@ -6924,6 +6930,29 @@ This is important for non-interactive uses of the command."
|
|||
(hide-subtree)))
|
||||
(run-hooks 'org-insert-heading-hook)))))
|
||||
|
||||
(defun org-new-numbered-action (&optional inline)
|
||||
"Insert a new numbered action, using `org-numbered-action-format'.
|
||||
With prefix argument, insert an inline task."
|
||||
(interactive "P")
|
||||
(let* ((num (let ((re "\\`#\\([0-9]+\\)\\'"))
|
||||
(1+ (apply 'max 0
|
||||
(mapcar
|
||||
(lambda (e)
|
||||
(if (string-match re (car e))
|
||||
(string-to-number (match-string 1 (car e)))
|
||||
0))
|
||||
(org-get-buffer-tags))))))
|
||||
(tag (concat "#" (number-to-string num))))
|
||||
(if inline
|
||||
(org-inlinetask-insert-task)
|
||||
(org-insert-heading nil 'force))
|
||||
(unless (eql (char-before) ?\ ) (insert " "))
|
||||
(insert (format org-numbered-action-format num))
|
||||
(org-toggle-tag tag 'on)
|
||||
(if (= (point-max) (point-at-bol))
|
||||
(save-excursion (goto-char (point-at-eol)) (insert "\n")))
|
||||
(unless (eql (char-before) ?\ ) (insert " "))))
|
||||
|
||||
(defun org-get-heading (&optional no-tags)
|
||||
"Return the heading of the current entry, without the stars."
|
||||
(save-excursion
|
||||
|
@ -7571,6 +7600,33 @@ If optional TXT is given, check this string instead of the current kill."
|
|||
(throw 'exit nil)))
|
||||
t))))
|
||||
|
||||
(defun org-collect-todos-in-subtree ()
|
||||
"Collect all TODO items in the current subtree into a flat list."
|
||||
(interactive)
|
||||
(let ((buf (get-buffer-create "Org TODO Collect"))
|
||||
(cnt 0))
|
||||
(with-current-buffer buf (erase-buffer) (org-mode))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(org-narrow-to-subtree)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward org-complex-heading-regexp nil t)
|
||||
(when (and (match-end 2)
|
||||
(member (match-string 2) org-not-done-keywords))
|
||||
(setq beg (match-beginning 0)
|
||||
cnt (1+ cnt))
|
||||
(org-end-of-subtree t t)
|
||||
(setq end (point))
|
||||
(copy-region-as-kill beg end)
|
||||
(with-current-buffer buf
|
||||
(org-paste-subtree 1)
|
||||
(or (bolp) (insert "\n"))
|
||||
(set-buffer-modified-p nil))))))
|
||||
(with-current-buffer buf
|
||||
(kill-region (point-min) (point-max)))
|
||||
(kill-buffer buf)
|
||||
(message "Collected %d TODO items as flat list into the kill buffer" cnt)))
|
||||
|
||||
(defvar org-markers-to-move nil
|
||||
"Markers that should be moved with a cut-and-paste operation.
|
||||
Those markers are stored together with their positions relative to
|
||||
|
|
Loading…
Reference in a new issue