diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-04-17 11:03:47 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-04-17 11:03:47 +0200 |
commit | 137c6ad658d5b54290acbb6900a96e641cacafab (patch) | |
tree | a379597a893d70853dd04ab5cbae6a95a143cbea | |
parent | 165f7c395073b649d7da9a12c52a34b724ed4cf0 (diff) | |
download | org-mode-137c6ad658d5b54290acbb6900a96e641cacafab.tar.gz |
org-protocol: Do not catch all errors when providing backward compatibility
* lisp/org-protocol.el (org-protocol-check-filename-for-protocol): Do
not catch every error so as to ease old style support. Re-format
code to fit within 80 columns.
Reported-by: Adam Porter <adam@alphapapa.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/113102>
-rw-r--r-- | lisp/org-protocol.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index a031d51..a59540a 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -596,11 +596,14 @@ CLIENT is ignored." (let ((sub-protocols (append org-protocol-protocol-alist org-protocol-protocol-alist-default))) (catch 'fname - (let ((the-protocol (concat (regexp-quote org-protocol-the-protocol) ":/+"))) + (let ((the-protocol (concat (regexp-quote org-protocol-the-protocol) + ":/+"))) (when (string-match the-protocol fname) (dolist (prolist sub-protocols) - (let ((proto (concat the-protocol - (regexp-quote (plist-get (cdr prolist) :protocol)) "\\(:/+\\|\\?\\)"))) + (let ((proto + (concat the-protocol + (regexp-quote (plist-get (cdr prolist) :protocol)) + "\\(:/+\\|\\?\\)"))) (when (string-match proto fname) (let* ((func (plist-get (cdr prolist) :function)) (greedy (plist-get (cdr prolist) :greedy)) @@ -613,12 +616,14 @@ CLIENT is ignored." (when (fboundp func) (unless greedy (throw 'fname - (condition-case nil - (funcall func (org-protocol-parse-parameters result new-style)) - (error - (warn "Please update your org protocol handler to deal with new-style links.") - (funcall func result))))) - ;; Greedy protocol handlers are responsible for parsing their own filenames + (if new-style + (funcall func (org-protocol-parse-parameters + result new-style)) + (warn "Please update your Org Protocol handler \ +to deal with new-style links.") + (funcall func result)))) + ;; Greedy protocol handlers are responsible for + ;; parsing their own filenames. (funcall func result) (throw 'fname t)))))))) fname))) |