From f1c382cabe5b34f52db22df70d5c25e02de2a18a Mon Sep 17 00:00:00 2001 From: Michael Brand Date: Fri, 5 Feb 2016 19:42:55 +0100 Subject: [PATCH] `org-file-apps' add migration hint for function signature * lisp/org.el (org-open-file): Add an error when the function signature does not match. --- lisp/org.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d4fb8a6..f6c5f89 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11323,9 +11323,18 @@ If the file does not exist, an error is thrown." (when (derived-mode-p 'org-mode) (org-reveal))) (search (org-link-search search)))) ((functionp cmd) - (save-match-data - (set-match-data link-match-data) - (funcall cmd file link))) + (condition-case err + (save-match-data + (set-match-data link-match-data) + (funcall cmd file link)) + ;; FIXME: Remove this check when most default installations of + ;; Emacs have at least Org 9.0. + ((wrong-number-of-arguments invalid-function) + (user-error + (concat + "Please see Org News for version 9.0 about `org-file-apps', " + "error: " + (prin1-to-string err)))))) ((consp cmd) ;; FIXME: Remove this check when most default installations of ;; Emacs have at least Org 9.0. @@ -11333,7 +11342,9 @@ If the file does not exist, an error is thrown." ;; `org-link-frame-setup' for an old usage of `org-file-apps' ;; with sexp instead of a function for `cmd'. (user-error - "Please see Org News for version 9.0 about `org-file-apps'")) + (concat "Please see Org News for version 9.0 about `org-file-apps', " + "error: deprecated usage of " + (prin1-to-string cmd)))) (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) (and (derived-mode-p 'org-mode) (eq old-mode 'org-mode) -- 2.1.3.dirty