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>
This commit is contained in:
parent
70dde3f617
commit
03d7441813
18
lisp/org.el
18
lisp/org.el
|
@ -20149,17 +20149,15 @@ Otherwise, return a user error."
|
||||||
(unless (member (org-element-property :key element)
|
(unless (member (org-element-property :key element)
|
||||||
'("INCLUDE" "SETUPFILE"))
|
'("INCLUDE" "SETUPFILE"))
|
||||||
(user-error "No special environment to edit here"))
|
(user-error "No special environment to edit here"))
|
||||||
(org-open-link-from-string
|
(let ((value (org-element-property :value element)))
|
||||||
(format "[[%s]]"
|
(unless (org-string-nw-p value) (user-error "No file to edit"))
|
||||||
(expand-file-name
|
(let ((file (and (string-match "\\`\"\\(.*?\\)\"\\|\\S-+" value)
|
||||||
(let ((value (org-strip-quotes
|
(or (match-string 1 value)
|
||||||
(org-element-property :value element))))
|
(match-string 0 value)))))
|
||||||
(cond
|
(when (org-file-url-p file)
|
||||||
((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"))
|
(user-error "Files located with a URL cannot be edited"))
|
||||||
(t value)))))))
|
(org-open-link-from-string
|
||||||
|
(format "[[%s]]" (expand-file-name file))))))
|
||||||
(`table
|
(`table
|
||||||
(if (eq (org-element-property :type element) 'table.el)
|
(if (eq (org-element-property :type element) 'table.el)
|
||||||
(org-edit-table.el)
|
(org-edit-table.el)
|
||||||
|
|
Loading…
Reference in New Issue