Forráskód Böngészése

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

* lisp/org-compat.el (org-define-error): New function.
* lisp/ox.el (org-link-broken): Use new function.
Nicolas Goaziou 9 éve
szülő
commit
6e6b19bc96
2 módosított fájl, 11 hozzáadás és 5 törlés
  1. 10 0
      lisp/org-compat.el
  2. 1 5
      lisp/ox.el

+ 10 - 0
lisp/org-compat.el

@@ -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

+ 1 - 5
lisp/ox.el

@@ -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.