org-compat: Implement `org-define-error'

* lisp/org-compat.el (org-define-error): New function.
* lisp/ox.el (org-link-broken): Use new function.
This commit is contained in:
Nicolas Goaziou 2015-10-31 16:10:11 +01:00
parent 59468ab2d8
commit 6e6b19bc96
2 changed files with 11 additions and 5 deletions

View File

@ -556,6 +556,16 @@ Implements `file-equal-p' for older emacsen and XEmacs."
`(org-unmodified ,@body)))
(def-edebug-spec org-with-silent-modifications (body))
;; Remove this when support for Emacs < 24.4 is dropped.
(defun org-define-error (name message)
"Define NAME as a new error signal.
MESSAGE is a string that will be output to the echo area if such
an error is signaled without being caught by a `condition-case'.
Implements `define-error' for older emacsen."
(if (fboundp 'define-error) (define-error name message)
(put name 'error-conditions
(copy-sequence (cons name (get 'error 'error-conditions))))))
(provide 'org-compat)
;;; org-compat.el ends here

View File

@ -4044,11 +4044,7 @@ meant to be translated with `org-export-data' or alike."
;; `org-export-data' for further processing, depending on
;; `org-export-with-broken-links' value.
;; FIXME: Remove this when support for Emacsen < 24.4 is dropped.
(if (fboundp 'define-error)
(define-error 'org-link-broken "Unable to resolve link; aborting")
(put 'org-link-broken 'error-conditions
(copy-sequence (cons 'org-link-broken (get 'error 'error-conditions)))))
(org-define-error 'org-link-broken "Unable to resolve link; aborting")
(defun org-export-custom-protocol-maybe (link desc backend)
"Try exporting LINK with a dedicated function.