From 6cb088972f3318ec93c37b216d19d25064e13ef0 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 13 Apr 2024 15:47:18 +0300 Subject: [PATCH] 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 Link: https://orgmode.org/list/1294251072.453751.1712943418634@ichabod.co-bxl --- lisp/ol.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index c3b030878..914732ed2 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