mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-12 16:10:28 +00:00
org-refile: exclude current (sub)heading(s) even if they start with a TODO keyword.
(org-get-heading): New optional argument to return heading with no TODO keyword. (org-refile-get-location): Use this new argument.
This commit is contained in:
parent
07d42cbee6
commit
7c8db0fa34
26
lisp/org.el
26
lisp/org.el
|
@ -6971,15 +6971,25 @@ This is important for non-interactive uses of the command."
|
||||||
(hide-subtree)))
|
(hide-subtree)))
|
||||||
(run-hooks 'org-insert-heading-hook)))))
|
(run-hooks 'org-insert-heading-hook)))))
|
||||||
|
|
||||||
(defun org-get-heading (&optional no-tags)
|
(defun org-get-heading (&optional no-tags no-todo)
|
||||||
"Return the heading of the current entry, without the stars."
|
"Return the heading of the current entry, without the stars.
|
||||||
|
When NO-TAGS is non-nil, don't include tags.
|
||||||
|
When NO-TODO is non-nil, don't include TODO keywords."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
(if (looking-at
|
(cond
|
||||||
(if no-tags
|
((and no-tags no-todo)
|
||||||
(org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$")
|
(looking-at org-complex-heading-regexp)
|
||||||
"\\*+[ \t]+\\([^\r\n]*\\)"))
|
(match-string 4))
|
||||||
(match-string 1) "")))
|
(no-tags
|
||||||
|
(looking-at "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$")
|
||||||
|
(match-string 1))
|
||||||
|
(no-todo
|
||||||
|
(looking-at (concat "\\*+[ \t]+" org-todo-regexp " +"
|
||||||
|
"\\([^\n\r]*?[ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$"))
|
||||||
|
(match-string 2))
|
||||||
|
(t (looking-at "\\*+[ \t]+\\([^\r\n]*\\)")
|
||||||
|
(match-string 1)))))
|
||||||
|
|
||||||
(defun org-heading-components ()
|
(defun org-heading-components ()
|
||||||
"Return the components of the current heading.
|
"Return the components of the current heading.
|
||||||
|
@ -10505,7 +10515,7 @@ this function appends the default value from
|
||||||
(org-map-tree
|
(org-map-tree
|
||||||
(lambda()
|
(lambda()
|
||||||
(setq excluded-entries
|
(setq excluded-entries
|
||||||
(append excluded-entries (list (org-get-heading t)))))))
|
(append excluded-entries (list (org-get-heading t t)))))))
|
||||||
(setq org-refile-target-table
|
(setq org-refile-target-table
|
||||||
(org-refile-get-targets default-buffer excluded-entries)))
|
(org-refile-get-targets default-buffer excluded-entries)))
|
||||||
(unless org-refile-target-table
|
(unless org-refile-target-table
|
||||||
|
|
Loading…
Reference in a new issue