emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] org-refile.el: show refile targets with doc. title


From: Mikhail Skorzhinskii
Subject: [PATCH] org-refile.el: show refile targets with doc. title
Date: Sat, 25 Dec 2021 16:23:42 +0100
User-agent: Evolution 3.40.0-1

* lisp/org-refile.el (org-refile-use-outline-path): add an option
'title
* lisp/org-refile.el (org-refile-get-targets): start refile target
outline with document title (#+title) instead of file name
---
 lisp/org-refile.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 678759e10..8ff1b2f5b 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -158,7 +158,8 @@ When `buffer-name', use the buffer name."
          (const :tag "Yes" t)
          (const :tag "Start with file name" file)
          (const :tag "Start with full file path" full-file-path)
-         (const :tag "Start with buffer name" buffer-name)))
+         (const :tag "Start with buffer name" buffer-name)
+         (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +318,8 @@ converted to a headline before refiling."
                 (push (list (and (buffer-file-name (buffer-base-
buffer))
                                   (file-truename (buffer-file-name
(buffer-base-buffer))))
                              f nil nil) tgs))
+              (when (eq org-refile-use-outline-path 'title)
+                (push (list (org-get-title-from-file (file-truename
(buffer-file-name (buffer-base-buffer)))) f nil nil) tgs))
               (org-with-wide-buffer
                (goto-char (point-min))
                (setq org-outline-path-cache nil)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]