From 7707f898a1c6ca755de79e13c8e47e33f6d6dd75 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 26 Feb 2020 16:27:51 +0100 Subject: [PATCH] ol: Fix opening file link with a starred search option * lisp/ol.el (org-link-open-as-file): Fix logic so initial regexp is matched against the file-name only, not the search option. --- lisp/ol.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index d8e2f5bc1..2910c75d3 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1269,14 +1269,14 @@ search options, separated from the file name with \"::\". This function is meant to be used as a possible tool for `:follow' property in `org-link-parameters'." - (if (string-match "[*?{]" (file-name-nondirectory path)) - (dired path) - (let* ((option (and (string-match "::\\(.*\\)\\'" path) - (match-string 1 path))) - (path (if (not option) path - (substring path 0 (match-beginning 0))))) + (let* ((option (and (string-match "::\\(.*\\)\\'" path) + (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) (apply #'org-open-file - path + file-name arg (cond ((not option) nil) ((string-match-p "\\`[0-9]+\\'" option)