Tweak recent error descriptor changes

* etc/NEWS: Fix capitalization and markup.
* lisp/emacs-lisp/ert.el (ert--should-error-handle-error): Prefer
any over cl-some where either will do.
* lisp/epa-file.el (epa-file--find-file-not-found-function):
Reindent.
(epa-file--error-add-context): Use correct variables.  Add
docstring.
* lisp/ffap.el (ffap-machine-p):
* lisp/gnus/nnmaildir.el (nnmaildir--emlink-p): Prefer
string-equal-ignore-case over case fiddling.
* lisp/gnus/gnus-search.el (gnus-search-run-query): Fix typo in
error re-signaling.
* lisp/ibuffer.el (ibuffer-confirm-operation-on): Prefer string
search over regexp matching where either will do.
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--run-maybe-unsupported-function): Pacify unused
condition-case error variable warnings (bug#72212).
This commit is contained in:
Basil L. Contovounesios 2026-03-11 20:21:58 +01:00 committed by Stefan Monnier
parent 261f4a012e
commit 8d356c55ad
8 changed files with 16 additions and 15 deletions

View file

@ -4011,11 +4011,11 @@ that will provide an Xref backend when used.
+++ +++
** The API to manipulate error descriptors has been improved. ** The API to manipulate error descriptors has been improved.
there are new functions: 'error-type-p', 'error-type', There are new functions: 'error-type-p', 'error-type',
'error-has-type-p', and 'error-slot-value'. 'error-has-type-p', and 'error-slot-value'.
And you can now do (signal err) instead (signal (car err) (cdr err)), which And you can now do '(signal err)' instead of
is not just more concise but also preserves the 'eq'uality of the '(signal (car err) (cdr err))', which is not only more concise
error descriptor. but also preserves the 'eq'uality of the error descriptor.
+++ +++
** 'secure-hash' now supports generating SHA-3 message digests. ** 'secure-hash' now supports generating SHA-3 message digests.

View file

@ -399,8 +399,8 @@ and aborts the current test as failed if it doesn't."
(let ((handled-conditions (pcase-exhaustive type (let ((handled-conditions (pcase-exhaustive type
((pred listp) type) ((pred listp) type)
((pred symbolp) (list type))))) ((pred symbolp) (list type)))))
(unless (cl-some (lambda (hc) (error-has-type-p condition hc)) (unless (any (lambda (hc) (error-has-type-p condition hc))
handled-conditions) handled-conditions)
(ert-fail (append (ert-fail (append
(funcall form-description-fn) (funcall form-description-fn)
(list (list

View file

@ -116,7 +116,7 @@ encryption is used."
(defun epa-file--find-file-not-found-function () (defun epa-file--find-file-not-found-function ()
(let ((error epa-file-error)) (let ((error epa-file-error))
(save-window-excursion (save-window-excursion
(kill-buffer)) (kill-buffer))
;; FIXME: How do we know that slot 3 can hold only a message related ;; FIXME: How do we know that slot 3 can hold only a message related
;; to a wrong passphrase? ;; to a wrong passphrase?
(if (error-slot-value error 3) (if (error-slot-value error 3)
@ -140,8 +140,9 @@ encryption is used."
error-string) error-string)
(match-string 1 error-string)))) (match-string 1 error-string))))
(defun epa-file--error-add-context (err ctxt) (defun epa-file--error-add-context (error context)
(setf (cdr error) (append (cdr error) (list ctx)))) "Append CONTEXT to ERROR data by side effect."
(setf (cdr error) (append (cdr error) (list context))))
(defvar last-coding-system-used) (defvar last-coding-system-used)
(defun epa-file-insert-file-contents (file &optional visit beg end replace) (defun epa-file-insert-file-contents (file &optional visit beg end replace)

View file

@ -474,8 +474,8 @@ Returned values:
;; (file-error "Connection failed" "address already in use" ;; (file-error "Connection failed" "address already in use"
;; "ftp.uu.net" "ffap-machine-p") ;; "ftp.uu.net" "ffap-machine-p")
((equal mesg "connection failed") ((equal mesg "connection failed")
(if (string= (downcase (error-slot-value error 2)) (if (string-equal-ignore-case (error-slot-value error 2)
"permission denied") "permission denied")
nil ; host does not exist nil ; host does not exist
;; Other errors mean the host exists: ;; Other errors mean the host exists:
(error-slot-value error 2))) (error-slot-value error 2)))

View file

@ -2087,7 +2087,7 @@ Assume \"size\" key is equal to \"larger\"."
(apply #'nnheader-message 4 (apply #'nnheader-message 4
"Search engine for %s improperly configured: %s" "Search engine for %s improperly configured: %s"
server (error-slot-value err 1)) server (error-slot-value err 1))
(signal err err))))) (signal err)))))
(alist-get 'search-group-spec specs)) (alist-get 'search-group-spec specs))
;; Some search engines do their own limiting, but some don't, so ;; Some search engines do their own limiting, but some don't, so
;; do it again here. This is bad because, if the user is ;; do it again here. This is bad because, if the user is

View file

@ -364,7 +364,7 @@ This variable is set by `nnmaildir-request-article'.")
(defun nnmaildir--emlink-p (err) (defun nnmaildir--emlink-p (err)
(and (error-has-type-p err 'file-error) (and (error-has-type-p err 'file-error)
(string= (downcase (error-slot-value err 2)) "too many links"))) (string-equal-ignore-case (error-slot-value err 2) "too many links")))
(defun nnmaildir--enoent-p (err) (defun nnmaildir--enoent-p (err)
(error-has-type-p err 'file-missing)) (error-has-type-p err 'file-missing))

View file

@ -1131,7 +1131,7 @@ a new window in the current frame, splitting vertically."
(and (stringp msg) (and (stringp msg)
;; This definitely falls in the ;; This definitely falls in the
;; ghetto hack category... ;; ghetto hack category...
(not (string-match-p "too small" msg))))) (not (string-search "too small" msg)))))
(signal err) (signal err)
(enlarge-window 3)))))) (enlarge-window 3))))))
(select-window (next-window)) (select-window (next-window))

View file

@ -236,7 +236,7 @@ For backends which don't support it, `vc-not-supported' is signaled."
(defmacro vc-test--run-maybe-unsupported-function (func &rest args) (defmacro vc-test--run-maybe-unsupported-function (func &rest args)
"Run FUNC with ARGS as arguments. "Run FUNC with ARGS as arguments.
Catch the `vc-not-supported' error." Catch the `vc-not-supported' error."
`(condition-case err `(condition-case nil
(funcall ,func ,@args) (funcall ,func ,@args)
(vc-not-supported 'vc-not-supported))) (vc-not-supported 'vc-not-supported)))