forked from mirrors/org-mode
org-open-file: match against dlink only if the command to be executed actually seems to use the subexpression matches as parameters.
This does not try to determine if a subexpression match is actually used in the case of a custom lisp form.
This commit is contained in:
parent
6deb088a5c
commit
dfda58d720
|
@ -1,6 +1,6 @@
|
||||||
2010-04-10 Jan Böcker <jan.boecker@jboecker.de>
|
2010-04-10 Jan Böcker <jan.boecker@jboecker.de>
|
||||||
|
|
||||||
* org.el (org-file-apps-entry-uses-grouping-p): new function.
|
* org.el (org-file-apps-entry-match-against-dlink-p): new function.
|
||||||
(org-file-apps-ex): remove variable.
|
(org-file-apps-ex): remove variable.
|
||||||
(org-open-file): Integrate org-file-apps-ex functionality back
|
(org-open-file): Integrate org-file-apps-ex functionality back
|
||||||
into org-file-apps, and decide whether to match a regexp against
|
into org-file-apps, and decide whether to match a regexp against
|
||||||
|
|
25
lisp/org.el
25
lisp/org.el
|
@ -9134,8 +9134,8 @@ If the file does not exist, an error is thrown."
|
||||||
buffer-file-name
|
buffer-file-name
|
||||||
(substitute-in-file-name (expand-file-name path))))
|
(substitute-in-file-name (expand-file-name path))))
|
||||||
(file-apps (append org-file-apps (org-default-apps)))
|
(file-apps (append org-file-apps (org-default-apps)))
|
||||||
(apps (remove-if 'org-file-apps-entry-uses-grouping-p file-apps))
|
(apps (remove-if 'org-file-apps-entry-match-against-dlink-p file-apps))
|
||||||
(apps-dlink (remove-if-not 'org-file-apps-entry-uses-grouping-p file-apps))
|
(apps-dlink (remove-if-not 'org-file-apps-entry-match-against-dlink-p file-apps))
|
||||||
(remp (and (assq 'remote apps) (org-file-remote-p file)))
|
(remp (and (assq 'remote apps) (org-file-remote-p file)))
|
||||||
(dirp (if remp nil (file-directory-p file)))
|
(dirp (if remp nil (file-directory-p file)))
|
||||||
(file (if (and dirp org-open-directory-means-index-dot-org)
|
(file (if (and dirp org-open-directory-means-index-dot-org)
|
||||||
|
@ -9243,14 +9243,23 @@ If the file does not exist, an error is thrown."
|
||||||
(not (equal old-pos (point))))
|
(not (equal old-pos (point))))
|
||||||
(org-mark-ring-push old-pos old-buffer))))
|
(org-mark-ring-push old-pos old-buffer))))
|
||||||
|
|
||||||
(defun org-file-apps-entry-uses-grouping-p (entry)
|
(defun org-file-apps-entry-match-against-dlink-p (entry)
|
||||||
"This function returns non-nil if `entry' uses a regular
|
"This function returns non-nil if `entry' uses a regular
|
||||||
expression that has subexpressions, and which org-open-file
|
expression which should be matched against the whole link by
|
||||||
should therefore match against the whole link instead of the
|
org-open-file.
|
||||||
filename."
|
|
||||||
(let ((selector (car entry)))
|
It assumes that is the case when the entry uses a regular
|
||||||
|
expression which has at least one grouping construct and the
|
||||||
|
action is either a lisp form or a command string containing
|
||||||
|
'%1', i.e. using at least one subexpression match as a
|
||||||
|
parameter."
|
||||||
|
(let ((selector (car entry))
|
||||||
|
(action (cdr entry)))
|
||||||
(if (stringp selector)
|
(if (stringp selector)
|
||||||
(> (regexp-opt-depth selector) 0)
|
(and (> (regexp-opt-depth selector) 0)
|
||||||
|
(or (and (stringp action)
|
||||||
|
(string-match "%1" action))
|
||||||
|
(consp action)))
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
(defun org-default-apps ()
|
(defun org-default-apps ()
|
||||||
|
|
Loading…
Reference in New Issue