瀏覽代碼

Fix `org-edit-special' on file names with spaces

* lisp/org.el (org-edit-special): Fix function when INCLUDE or
  SETUPFILE keyword points to a file name with spaces.
Nicolas Goaziou 10 年之前
父節點
當前提交
cf77a8e878
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      lisp/org.el

+ 8 - 3
lisp/org.el

@@ -20528,9 +20528,14 @@ Otherwise, return a user error."
            (org-open-link-from-string
 	    (format "[[%s]]"
 		    (expand-file-name
-		     (org-remove-double-quotes
-		      (car (org-split-string
-			    (org-element-property :value element)))))))
+		     (let ((value (org-element-property :value element)))
+		       (cond ((not (org-string-nw-p value))
+			      (user-error "No file to edit"))
+			     ((string-match "\\`\"\\(.*?\\)\"" value)
+			      (match-string 1 value))
+			     ((string-match "\\`[^ \t\"]\\S-*" value)
+			      (match-string 0 value))
+			     (t (user-error "No valid file specified")))))))
          (user-error "No special environment to edit here")))
       (table
        (if (eq (org-element-property :type element) 'table.el)