:group 'find-function
:version "21.1")
+(defvar find-error-regexp
+ (concat "^\\s-*(define-error" find-function-space-re "%s\\(\\s-\\|$\\)"))
+
(defvar find-widget-regexp
(concat "^\\s-*(define-widget" find-function-space-re "%s\\(\\s-\\|$\\)"))
(feature . find-feature-regexp)
(defalias . find-alias-regexp)
(ert-deftest . find-ert-deftest-regexp)
- (define-widget . find-widget-regexp))
+ (define-widget . find-widget-regexp)
+ (define-error . find-error-regexp))
"Alist mapping definition types into regexp variables.
Each regexp variable's value should actually be a format string
to be used to substitute the desired symbol name into the regexp.
(put name 'widget-type nil)
(put name 'widget-documentation nil)))
+(cl-defmethod loadhist-unload-element ((x (head define-error)))
+ (let ((name (cdr x)))
+ (put name 'error-conditions nil)
+ (put name 'error-message nil)))
+
;;;###autoload
(defun unload-feature (feature &optional force)
"Unload the library that provided FEATURE.
(lambda (sym) (or (alist-get sym macro-declarations-alist)
(alist-get sym defun-declarations-alist))))
((group) (lambda (sym) (get sym 'group-documentation)))
+ ((condition) (lambda (sym) (get sym 'error-conditions)))
((face) #'facep)
((theme) #'custom-theme-p)
((thing) (lambda (sym)
((defface face) 'face)
((feature) 'feature)
((widget-type) 'widget-type)
+ ((condition) 'condition)
((defvar variable constant) 'variable)
((defun function macro special-form top-level major-mode) 'function))))
('variable '(defvar))
('face '(defface))
('feature '(feature))
+ ('condition '(define-error))
('widget-type '(define-widget)))))
(cl-loop for d in definitions
when (memq
(when file
(push (elisp--xref-make-xref 'defface symbol file) xrefs))))
- (when (get 'symbol 'widget-type)
+ (when (get symbol 'widget-type)
(when-let ((file (find-lisp-object-file-name symbol 'define-widget)))
(push (elisp--xref-make-xref 'define-widget symbol file) xrefs)))
+ (when (get symbol 'error-conditions)
+ (when-let ((file (find-lisp-object-file-name symbol 'define-error)))
+ (push (elisp--xref-make-xref 'define-error symbol file) xrefs)))
+
(when (fboundp symbol)
(let ((file (find-lisp-object-file-name symbol (symbol-function symbol)))
generic doc)
(cons parent (get parent 'error-conditions)))))
(put name 'error-conditions
(delete-dups (copy-sequence (cons name conditions))))
+ (add-to-list 'current-load-list `(define-error . ,name))
(when message (put name 'error-message message))))
;; We put this here instead of in frame.el so that it's defined even on