emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals-release/org d285831 3/4: org-refile.el: Fix the case of


From: ELPA Syncer
Subject: [elpa] externals-release/org d285831 3/4: org-refile.el: Fix the case of emtpy buffer name
Date: Sat, 15 May 2021 04:57:13 -0400 (EDT)

branch: externals-release/org
commit d285831af391be0045cd70650f1ec87d9a3e3000
Author: satotake <doublequotation@gmail.com>
Commit: Bastien <bzg@gnu.org>

    org-refile.el: Fix the case of emtpy buffer name
    
    * lisp/org-refile.el (org-refile-get-targets): Ensure that the
    arguments of `file-name-nondirectory' and `file-truename' are not nil.
    
    This prevents errors from being raised when calling `org-refile' in a
    buffer that is not visiting a file.
    
    TINYCHANGE
---
 lisp/org-refile.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 1e6872b..e4f000d 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -310,11 +310,13 @@ converted to a headline before refiling."
                 (setq f (buffer-file-name (buffer-base-buffer f))))
               (setq f (and f (expand-file-name f)))
               (when (eq org-refile-use-outline-path 'file)
-                (push (list (file-name-nondirectory f) f nil nil) tgs))
+                (push (list (and f (file-name-nondirectory f)) f nil nil) tgs))
               (when (eq org-refile-use-outline-path 'buffer-name)
                 (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
               (when (eq org-refile-use-outline-path 'full-file-path)
-                (push (list (file-truename (buffer-file-name 
(buffer-base-buffer))) f nil nil) tgs))
+                (push (list (and (buffer-file-name (buffer-base-buffer))
+                                  (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)
@@ -337,9 +339,10 @@ converted to a headline before refiling."
                                #'identity
                                (append
                                 (pcase org-refile-use-outline-path
-                                  (`file (list (file-name-nondirectory
-                                                (buffer-file-name
-                                                 (buffer-base-buffer)))))
+                                  (`file (list
+                                           (and (buffer-file-name 
(buffer-base-buffer))
+                                                (file-name-nondirectory
+                                                 (buffer-file-name 
(buffer-base-buffer))))))
                                   (`full-file-path
                                    (list (buffer-file-name
                                           (buffer-base-buffer))))



reply via email to

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