emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] org-refile.el: show refile targets with doc. title
Date: Sat, 25 Dec 2021 16:23:42 +0100	[thread overview]
Message-ID: <80f7d99b0cf16fefbcdd2db62c35f53946895162.camel@eml.cc> (raw)


* 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	other threads:[~2021-12-25 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25 15:23 Mikhail Skorzhinskii [this message]
2021-12-26 13:59 ` Ihor Radchenko
2021-12-28 11:59   ` Mikhail Skorzhinskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80f7d99b0cf16fefbcdd2db62c35f53946895162.camel@eml.cc \
    --to=mskorzhinskiy@eml.cc \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] org-refile.el: show refile targets with doc. title' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).