[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 8ea6272 86/99: Add define-error compatibility fu
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 8ea6272 86/99: Add define-error compatibility function |
Date: |
Sun, 17 Oct 2021 05:58:02 -0400 (EDT) |
branch: externals/compat
commit 8ea6272c3b09be5a3e0f860e7026bfe6c312e5ff
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add define-error compatibility function
---
compat-24.4.el | 20 ++++++++++++++++++++
compat-tests.el | 1 +
2 files changed, 21 insertions(+)
diff --git a/compat-24.4.el b/compat-24.4.el
index dcc61d2..9ee75d8 100644
--- a/compat-24.4.el
+++ b/compat-24.4.el
@@ -149,5 +149,25 @@ non-nil."
(setcdr last nil)))
list)
+(compat-defun define-error (name message &optional parent)
+ "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'.
+PARENT is either a signal or a list of signals from which it inherits.
+Defaults to `error'."
+ (unless parent (setq parent 'error))
+ (let ((conditions
+ (if (consp parent)
+ (apply #'append
+ (mapcar (lambda (parent)
+ (cons parent
+ (or (get parent 'error-conditions)
+ (error "Unknown signal `%s'" parent))))
+ parent))
+ (cons parent (get parent 'error-conditions)))))
+ (put name 'error-conditions
+ (delete-dups (copy-sequence (cons name conditions))))
+ (when message (put name 'error-message message))))
+
(provide 'compat-24.4)
;;; compat-24.4.el ends here
diff --git a/compat-tests.el b/compat-tests.el
index 6adeac6..bfa8005 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -29,6 +29,7 @@
;;
;; - buffer-local-boundp (`buffer-local-boundp')
;; - count-windows (`compat--count-windows')
+;; - define-error (`compat--define-error')
;; - directory-empty-p (`compat--directory-empty-p')
;; - directory-files (`compat--directory-files')
;; - dlet (`compat--dlet')
- [elpa] externals/compat 50767a8 90/99: Load deferred code even if file doesn't exist, (continued)
- [elpa] externals/compat 50767a8 90/99: Load deferred code even if file doesn't exist, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2bb6c10 91/99: Check if function is bound before extracting documentation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f4c0979 92/99: Prevent shadowing declarations in functional compatibility code, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 3257cf6 93/99: Implement TCO for named-let, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 347f5a8 94/99: Change version suffix to -rc, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 25879c7 95/99: Require instead of loading compat-*.el files, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 5506770 99/99: Update .elpaignore, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 084f18c 73/99: Declare compat functions used in file-name-with-extension, ELPA Syncer, 2021/10/17
- [elpa] externals/compat db218d0 79/99: Handle top-level JSON objects in Emacs 27.x, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 8981d4b 85/99: Handle multiple signals in string-replace test case, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 8ea6272 86/99: Add define-error compatibility function,
ELPA Syncer <=
- [elpa] externals/compat 5d5b215 87/99: Factor out issue with should-error in Emacs 24.3, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 93cee71 88/99: Generate a docstring for manual compatibility advice, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 0a72e60 97/99: Fix the number of expected argument in count-windows :cond check, ELPA Syncer, 2021/10/17