Browse Source

org-capture: fix error with %F and dired not loaded

* lisp/org-capture.el (org-capture): if dired isn't loaded,
  `dired-buffers' isn't defined, and %F will fail.

Thanks to Puneeth Chaganti for reporting this.
Nicolas Goaziou 6 years ago
parent
commit
d883d0b01d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lisp/org-capture.el

+ 4 - 1
lisp/org-capture.el

@@ -63,6 +63,7 @@
 (defvar org-remember-default-headline)
 (defvar org-remember-templates)
 (defvar org-table-hlines)
+(defvar dired-buffers)
 
 (defvar org-capture-clock-was-started nil
   "Internal flag, noting if the clock was started.")
@@ -451,7 +452,9 @@ bypassed."
 	(org-capture-get-template)
 	(org-capture-put :original-buffer orig-buf
 			 :original-file (or (buffer-file-name orig-buf)
-					    (car (rassq orig-buf dired-buffers)))
+					    (and (featurep 'dired)
+						 (car (rassq orig-buf
+							     dired-buffers))))
 			 :original-file-nondirectory
 			 (and (buffer-file-name orig-buf)
 			      (file-name-nondirectory