From 283b2721857350e9eba4b8056b433764bf121222 Mon Sep 17 00:00:00 2001 From: Max Nikulin Date: Thu, 8 Sep 2022 19:02:37 +0700 Subject: [PATCH v2 1/3] org.el: Pass link match data to `org-file-apps' functions * lisp/org.el (org--file-apps-entry-dlink-p): Fix it to pass match data to handler functions from `org-open-file' alist when pattern field of `org-file-apps' contains regexp subgroups. Update `org--file-apps-entry-dlink-p' to use current convention for action field of `org-file-apps' structure. Currently it may be a function while earlier s-expression was allowed. Obsolete test wrongly separated actions able to handle regexp subgroups matched in the link. An example when match data were not passed to the handler function: (add-to-list 'org-file-apps '("\\.pdf\\(?:\\.gz\\|\\.bz2\\|\\.xz\\)?\\(?:::.*\\)?\\'" . my-open-pdf-locator)) Notice that lambda functions passed `consp' test, so namely `defun' is required to reproduce the issue. This change was missed in the commit: c8a3ab1e4 2016-02-03 18:30:17 +0100 Nicolas Goaziou: `org-file-apps' accept functions instead of sexp For discussion of the issue with evaluation of arbitrary expression see https://list.orgmode.org/CALn3zoh+ACSU09eRurfwKjmCnw7i-_0KX7tA2jWqtu=vvQepLQ@mail.gmail.com/T/#u Michael Brand. org-player and switch to lexical binding in org.el. Sun, 17 Jan 2016 19:58:38 +0100 --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 34560c83f..3d2fbd2cb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8002,7 +8002,7 @@ a parameter." (> (regexp-opt-depth selector) 0) (or (and (stringp action) (string-match "%[0-9]" action)) - (consp action)))) + (functionp action)))) (_ nil))) (defun org--file-apps-regexp-alist (list &optional add-auto-mode) -- 2.25.1