mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-26 17:02:53 +00:00
Refile: Allow to refile to top-level entries.
By completing only the file name, you can now refile as a top-level entry.
This commit is contained in:
parent
8cc49120fa
commit
979e7c8573
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
* org.el (org-scan-tags): Make tag scan find headline in first
|
* org.el (org-scan-tags): Make tag scan find headline in first
|
||||||
line, 2nd attempt.
|
line, 2nd attempt.
|
||||||
|
(org-get-refile-targets): Add the naked file name.
|
||||||
|
(org-refile): Store as top-level entry when only file name was
|
||||||
|
given.
|
||||||
|
|
||||||
* org-agenda.el (org-agenda-get-progress): Fix regexp bug.
|
* org-agenda.el (org-agenda-get-progress): Fix regexp bug.
|
||||||
|
|
||||||
|
|
34
lisp/org.el
34
lisp/org.el
|
@ -1508,8 +1508,12 @@ are used, equivalent to the value `((nil . (:level . 1))'."
|
||||||
(defcustom org-refile-use-outline-path nil
|
(defcustom org-refile-use-outline-path nil
|
||||||
"Non-nil means, provide refile targets as paths.
|
"Non-nil means, provide refile targets as paths.
|
||||||
So a level 3 headline will be available as level1/level2/level3.
|
So a level 3 headline will be available as level1/level2/level3.
|
||||||
|
|
||||||
When the value is `file', also include the file name (without directory)
|
When the value is `file', also include the file name (without directory)
|
||||||
into the path. When `full-file-path', include the full file path."
|
into the path. In this case, you can also stop the completion after
|
||||||
|
the file name, to get entries inserted as top level in the file.
|
||||||
|
|
||||||
|
When `full-file-path', include the full file path."
|
||||||
:group 'org-refile
|
:group 'org-refile
|
||||||
:type '(choice
|
:type '(choice
|
||||||
(const :tag "Not" nil)
|
(const :tag "Not" nil)
|
||||||
|
@ -8115,6 +8119,8 @@ on the system \"/user@host:\"."
|
||||||
(set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f)))
|
(set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f)))
|
||||||
(if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
|
(if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
|
||||||
(setq f (expand-file-name f))
|
(setq f (expand-file-name f))
|
||||||
|
(if (eq org-refile-use-outline-path 'file)
|
||||||
|
(push (list (file-name-nondirectory f) f nil nil) targets))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(widen)
|
(widen)
|
||||||
|
@ -8214,6 +8220,7 @@ operation has put the subtree."
|
||||||
re (nth 2 it)
|
re (nth 2 it)
|
||||||
pos (nth 3 it))
|
pos (nth 3 it))
|
||||||
(if (and (not goto)
|
(if (and (not goto)
|
||||||
|
pos
|
||||||
(equal (buffer-file-name) file)
|
(equal (buffer-file-name) file)
|
||||||
(if regionp
|
(if regionp
|
||||||
(and (>= pos region-start)
|
(and (>= pos region-start)
|
||||||
|
@ -8242,15 +8249,22 @@ operation has put the subtree."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(widen)
|
(widen)
|
||||||
(goto-char pos)
|
(if pos
|
||||||
(looking-at outline-regexp)
|
(progn
|
||||||
(setq level (org-get-valid-level (funcall outline-level) 1))
|
(goto-char pos)
|
||||||
(goto-char
|
(looking-at outline-regexp)
|
||||||
(if reversed
|
(setq level (org-get-valid-level (funcall outline-level) 1))
|
||||||
(or (outline-next-heading) (point-max))
|
(goto-char
|
||||||
(or (save-excursion (outline-get-next-sibling))
|
(if reversed
|
||||||
(org-end-of-subtree t t)
|
(or (outline-next-heading) (point-max))
|
||||||
(point-max))))
|
(or (save-excursion (outline-get-next-sibling))
|
||||||
|
(org-end-of-subtree t t)
|
||||||
|
(point-max)))))
|
||||||
|
(setq level 1)
|
||||||
|
(if (not reversed)
|
||||||
|
(goto-char (point-max))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(or (outline-next-heading) (goto-char (point-max)))))
|
||||||
(if (not (bolp)) (newline))
|
(if (not (bolp)) (newline))
|
||||||
(bookmark-set "org-refile-last-stored")
|
(bookmark-set "org-refile-last-stored")
|
||||||
(org-paste-subtree level))))
|
(org-paste-subtree level))))
|
||||||
|
|
Loading…
Reference in a new issue