branch: externals-release/org
commit 6cb088972f3318ec93c37b216d19d25064e13ef0
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-link-open-as-file: Do not try dired wildcard expansion when file exists
    
    * lisp/ol.el (org-link-open-as-file): When PATH points to an existing
    file and contains wildcard chars, do not try to list all the files in
    `dired'.
    
    Reported-by: Edgar Lux <[email protected]>
    Link: 
https://orgmode.org/list/[email protected]
---
 lisp/ol.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index c3b0308784..914732ed2d 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1326,8 +1326,9 @@ This function is meant to be used as a possible tool for
                      (match-string 1 path)))
         (file-name (if (not option) path
                      (substring path 0 (match-beginning 0)))))
-    (if (string-match "[*?{]" (file-name-nondirectory file-name))
-       (dired file-name)
+    (if (and (string-match "[*?{]" (file-name-nondirectory file-name))
+             (not (file-exists-p file-name)))
+        (dired file-name)
       (apply #'org-open-file
             file-name
             arg

Reply via email to