瀏覽代碼

org: Fix resource prompt in non-file buffers

* lisp/org.el (org--confirm-resource-safe): When `buffer-file-name' is
nil, skip over file-specific behaviour.
TEC 3 年之前
父節點
當前提交
4702a73031
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      lisp/org.el

+ 9 - 5
lisp/org.el

@@ -4563,9 +4563,12 @@ returns non-nil if any of them match."
                 (propertize "!" 'face 'success)
                 " to download this resource, and permanantly mark it as safe.\n "
                 (propertize "f" 'face 'success)
-                " to download this resource, and permanantly mark all resources in "
-                (propertize current-file 'face 'fixed-pitch-serif)
-                " as safe.\n "
+                (if current-file
+                    (concat
+                     " to download this resource, and permanantly mark all resources in "
+                     (propertize current-file 'face 'fixed-pitch-serif)
+                     " as safe.\n ")
+                  "")
                 (propertize "y" 'face 'warning)
                 " to download this resource, just this once.\n "
                 (propertize "n" 'face 'error)
@@ -4576,8 +4579,9 @@ returns non-nil if any of them match."
       ;; Display the buffer and read a choice.
       (save-window-excursion
         (pop-to-buffer buf)
-        (let* ((exit-chars '(?y ?n ?! ?f ?\s))
-               (prompt (format "Please type y, n, f, or !%s: "
+        (let* ((exit-chars (append '(?y ?n ?! ?\s) (and current-file '(?f))))
+               (prompt (format "Please type y, n%s, or !%s: "
+                               (if current-file ", f" "")
                                (if (< (line-number-at-pos (point-max))
                                       (window-body-height))
                                    ""