summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-06 19:32:30 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-06 19:32:30 +0100
commit03d7441813592eeda71eab5af25f2a9ce84c1e5c (patch)
treeb4588cc1928eeacd0c53887b4ab1a4b309f18043
parent70dde3f6174c701f7712cd77eb522a65dbcd2b52 (diff)
downloadorg-mode-03d7441813592eeda71eab5af25f2a9ce84c1e5c.tar.gz
Fix `org-edit-special' on INCLUDE with additional parameters
* lisp/org.el (org-edit-special): Correctly parse filenames with quotes and additional parameters. Reported-by: Joon Ro <joon.ro@outlook.com> <http://lists.gnu.org/r/emacs-orgmode/2019-02/msg00066.html>
-rw-r--r--lisp/org.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 7510086..f9b65ee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20149,17 +20149,15 @@ Otherwise, return a user error."
(unless (member (org-element-property :key element)
'("INCLUDE" "SETUPFILE"))
(user-error "No special environment to edit here"))
- (org-open-link-from-string
- (format "[[%s]]"
- (expand-file-name
- (let ((value (org-strip-quotes
- (org-element-property :value element))))
- (cond
- ((not (org-string-nw-p value))
- (user-error "No file to edit"))
- ((org-file-url-p value)
- (user-error "Files located with a URL cannot be edited"))
- (t value)))))))
+ (let ((value (org-element-property :value element)))
+ (unless (org-string-nw-p value) (user-error "No file to edit"))
+ (let ((file (and (string-match "\\`\"\\(.*?\\)\"\\|\\S-+" value)
+ (or (match-string 1 value)
+ (match-string 0 value)))))
+ (when (org-file-url-p file)
+ (user-error "Files located with a URL cannot be edited"))
+ (org-open-link-from-string
+ (format "[[%s]]" (expand-file-name file))))))
(`table
(if (eq (org-element-property :type element) 'table.el)
(org-edit-table.el)