1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-16 11:52:55 -07:00

Use single-arg form of signal to re-throw an error

* lisp/vc/smerge-mode.el (smerge-extend):
* lisp/vc/diff-mode.el (diff-beginning-of-file-and-junk):
* lisp/transient.el (transient--with-emergency-exit):
* lisp/textmodes/tex-mode.el (latex-forward-sexp):
* lisp/tar-mode.el (tar-mode):
* lisp/savehist.el (savehist--reload):
* lisp/progmodes/octave.el (inferior-octave-resync-dirs):
* lisp/progmodes/js.el (js--re-search-forward):
* lisp/plstore.el (plstore--decrypt):
* lisp/net/dbus.el (dbus-ignore-errors, dbus-register-signal)
(dbus-handle-event):
* lisp/mouse.el (mouse-drag-track, mouse-drag-region-rectangle):
* lisp/minibuffer.el (completion-pcm--find-all-completions):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2047.el (rfc2047-encode-region):
* lisp/jit-lock.el (jit-lock-fontify-now):
* lisp/international/ja-dic-utl.el (skkdic-lookup-key):
* lisp/gnus/nnselect.el (nnselect-generate-artlist):
* lisp/gnus/mml-sec.el (mml-secure-epg-encrypt, mml-secure-epg-sign):
* lisp/gnus/mail-source.el (mail-source-fetch-pop)
(mail-source-check-pop):
* lisp/gnus/gnus-art.el (gnus-article-read-summary-keys):
* lisp/files.el (basic-save-buffer-2, files--ensure-directory)
(files--force, copy-directory):
* lisp/eshell/esh-io.el (eshell-output-object-to-target):
* lisp/epa.el (epa-decrypt-file, epa-verify-file, epa-sign-file)
(epa-encrypt-file, epa-decrypt-region, epa-verify-region)
(epa-sign-region, epa-encrypt-region, epa-delete-keys)
(epa-export-keys, epa-insert-keys):
* lisp/emacs-lisp/package.el (package--unless-error):
* lisp/emacs-lisp/multisession.el (multisession--read-file-value):
* lisp/emacs-lisp/lisp.el (up-list-default-function):
* lisp/desktop.el (desktop-kill):
* lisp/calendar/time-date.el (date-to-time):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calc/calc.el (calc-do):
* lisp/bookmark.el (bookmark-handle-bookmark):
* src/fileio.c (report_file_errno):
* lisp/vc/vc.el (vc-checkout, vc-pull): Use `(signal err)` instead
of `(signal (car err) (cdr err))`.
This commit is contained in:
Stefan Monnier 2026-03-09 10:34:05 -04:00
parent 08e109d45a
commit 9348c19b82
33 changed files with 52 additions and 55 deletions

View file

@ -1381,7 +1381,7 @@ then offer interactively to relocate BOOKMARK-NAME-OR-RECORD."
(message
"Bookmark not relocated; consider removing it (%s)."
bookmark-name-or-record)
(signal (car err) (cdr err))))))))))
(signal err)))))))))
;; Added by db.
(when (stringp bookmark-name-or-record)
(setq bookmark-current-bookmark bookmark-name-or-record))

View file

@ -1688,7 +1688,7 @@ See calc-keypad for details."
(error (substitute-command-keys
"Computation got stuck or ran too long. Type \\`M' to increase the limit"))
(setq calc-aborted-prefix nil)
(signal (car err) (cdr err)))))
(signal err))))
(when calc-aborted-prefix
(calc-record "<Aborted>" calc-aborted-prefix))
(and calc-start-time

View file

@ -232,7 +232,7 @@ also calls `beep' for an audible reminder."
time string)
(wrong-type-argument
(if (not (listp mins))
(signal (car err) (cdr err))
(signal err)
(message "Argtype error in `appt-disp-window-function' - \
update it for multiple appts?")
;; Fallback to just displaying the first appt, as we used to.

View file

@ -161,7 +161,7 @@ If DATE lacks time zone information, local time is assumed."
(encode-time parsed))
(error
(if (equal err '(error "Specified time is not representable"))
(signal (car err) (cdr err))
(signal err)
(error "Invalid date: %s" date)))))
;;;###autoload

View file

@ -812,7 +812,7 @@ is nil, ask the user where to save the desktop."
(desktop-save desktop-dirname t)
(file-error
(unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
(signal (car err) (cdr err))))))
(signal err)))))
(desktop--on-kill)
t)

View file

@ -331,7 +331,7 @@ On error, location of point is unspecified."
(if no-syntax-crossing
;; Assume called interactively; don't signal an error.
(user-error "At top level")
(signal (car err) (cdr err)))))))
(signal err))))))
(setq arg (- arg inc)))))
(defun kill-sexp (&optional arg interactive)

View file

@ -295,7 +295,7 @@ DOC should be a doc string, and ARGS are keywords as applicable to
(setq i (1+ i)
last-error err)
(sleep-for (+ 0.1 (/ (float (random 10)) 10))))))
(signal (car last-error) (cdr last-error)))))
(signal last-error))))
(defun multisession--object-file-name (object)
(expand-file-name

View file

@ -1219,8 +1219,7 @@ errors signaled by ERROR-FORM or by BODY).
(when (condition-case ,err
(progn ,@before-body t)
(error (funcall error-function)
(unless noerror
(signal (car ,err) (cdr ,err)))))
(unless noerror (signal ,err))))
(funcall ,body)))))
(cl-defun package--with-response-buffer-1 (url body &key async file error-function noerror &allow-other-keys)

View file

@ -702,7 +702,7 @@ If you do not specify PLAIN-FILE, this functions prompts for the value to use."
(epg-decrypt-file context decrypt-file plain-file)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Decrypting %s...wrote %s" (file-name-nondirectory decrypt-file)
(file-name-nondirectory plain-file))
(if (epg-context-result-for context 'verify)
@ -727,7 +727,7 @@ If you do not specify PLAIN-FILE, this functions prompts for the value to use."
(epg-verify-file context file plain)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Verifying %s...done" (file-name-nondirectory file))
(if (epg-context-result-for context 'verify)
(epa-display-info (epg-verify-result-to-string
@ -798,7 +798,7 @@ If no one is selected, default secret key is used. "
(epg-sign-file context file signature mode)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Signing %s...wrote %s" (file-name-nondirectory file)
(file-name-nondirectory signature))))
@ -828,7 +828,7 @@ If no one is selected, symmetric encryption will be performed. ")))
(epg-encrypt-file context file recipients cipher)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Encrypting %s...wrote %s" (file-name-nondirectory file)
(file-name-nondirectory cipher))))
@ -870,7 +870,7 @@ For example:
(setq plain (epg-decrypt-string context (buffer-substring start end)))
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Decrypting...done")
(setq plain (decode-coding-string
plain
@ -969,7 +969,7 @@ For example:
(get-text-property start 'epa-coding-system-used)))))
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Verifying...done")
(setq plain (decode-coding-string
plain
@ -1077,7 +1077,7 @@ If no one is selected, default secret key is used. "
mode))
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Signing...done")
(delete-region start end)
(goto-char start)
@ -1155,7 +1155,7 @@ If no one is selected, symmetric encryption will be performed. ")
sign))
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Encrypting...done")
(delete-region start end)
(goto-char start)
@ -1185,7 +1185,7 @@ If no one is selected, symmetric encryption will be performed. ")
(epg-delete-keys context keys allow-secret)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Deleting...done")
(apply #'epa--list-keys epa-list-keys-arguments)))
@ -1273,7 +1273,7 @@ If no one is selected, symmetric encryption will be performed. ")
(epg-export-keys-to-file context keys file)
(error
(epa-display-error context)
(signal (car error) (cdr error))))
(signal error)))
(message "Exporting to %s...done" (file-name-nondirectory file))))
;;;###autoload
@ -1290,7 +1290,7 @@ If no one is selected, default public key is exported. ")))
(insert (epg-export-keys-to-string context keys))
(error
(epa-display-error context)
(signal (car error) (cdr error))))))
(signal error)))))
(provide 'epa)

View file

@ -751,7 +751,7 @@ Returns what was actually sent, or nil if nothing was sent.")
;; here. Maybe `process-send-string' should handle SIGPIPE even
;; in batch mode (bug#66186).
(if (process-live-p target)
(signal (car err) (cdr err))
(signal err)
(signal 'eshell-pipe-broken (list target)))))
object)

View file

@ -6276,7 +6276,7 @@ Before and after saving the buffer, this function runs
(when save-silently (message nil)))
;; If we failed, restore the buffer's modtime.
(error (set-visited-file-modtime old-modtime)
(signal (car err) (cdr err))))
(signal err)))
;; Since we have created an entirely new file,
;; make sure it gets the right permission bits set.
(setq setmodes
@ -6680,7 +6680,7 @@ Return non-nil if DIR is already a directory."
(make-directory-internal dir)
(error
(or (file-directory-p dir)
(signal (car err) (cdr err))))))
(signal err)))))
(defun make-directory (dir &optional parents)
"Create the directory DIR and optionally any nonexistent parent dirs.
@ -6753,7 +6753,7 @@ This acts like (apply FN ARGS) except it returns NO-SUCH if it is
non-nil and if FN fails due to a missing file or directory."
(condition-case err
(apply fn args)
(file-missing (or no-such (signal (car err) (cdr err))))))
(file-missing (or no-such (signal err)))))
(defun delete-file (filename &optional trash)
"Delete file named FILENAME. If it is a symlink, remove the symlink.
@ -6994,7 +6994,7 @@ into NEWNAME instead."
(make-directory (directory-file-name newname) parents)
(error
(or (file-directory-p newname)
(signal (car err) (cdr err)))))))
(signal err))))))
;; Copy recursively.
(dolist (file

View file

@ -6946,7 +6946,7 @@ not have a face in `gnus-article-boring-faces'."
(set-window-hscroll win new-sum-hscroll))))
(set-window-configuration owin)
(if err
(signal (car err) (cdr err))
(signal err)
(ding))))))))
(defun gnus-article-read-summary-send-keys ()

View file

@ -831,7 +831,7 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
(setq mail-source-password-cache
(delq (assoc from mail-source-password-cache)
mail-source-password-cache))
(signal (car err) (cdr err)))))))))
(signal err))))))))
(if result
(progn
(when (eq authentication 'password)
@ -896,7 +896,7 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
(setq mail-source-password-cache
(delq (assoc from mail-source-password-cache)
mail-source-password-cache))
(signal (car err) (cdr err)))))))))
(signal err))))))))
(if result
;; Inform display-time that we have new mail.
(setq mail-source-new-mail-available (> result 0))

View file

@ -939,7 +939,7 @@ If no one is selected, symmetric encryption will be performed. "
mml-secure-secret-key-id-list nil)
(error
(mml-secure-clear-secret-key-id-list)
(signal (car error) (cdr error))))
(signal error)))
cipher))
(defun mml-secure-sender-sign-query (protocol sender)
@ -1029,7 +1029,7 @@ Returns non-nil if the user has chosen to use SENDER."
mml-secure-secret-key-id-list nil)
(error
(mml-secure-clear-secret-key-id-list)
(signal (car error) (cdr error))))
(signal error)))
(if (epg-context-result-for context 'sign)
(setq micalg (epg-new-signature-digest-algorithm
(car (epg-context-result-for context 'sign)))))

View file

@ -346,8 +346,7 @@ group info."
gnus-newsgroup-selection))
;; Don't swallow gnus-search errors; the user should be made
;; aware of them.
(gnus-search-error
(signal (car err) (cdr err)))
(gnus-search-error (signal err))
(error
(gnus-error
3

View file

@ -115,7 +115,7 @@ The library `ja-dic' can't be loaded.
This might indicate a problem with your Emacs installation, as
LEIM (Libraries of Emacs Input Method) should normally always be
installed together with Emacs.")))
(signal (car err) (cdr err)))))
(signal err))))
(let ((vec (make-vector len 0))
(i 0)

View file

@ -449,7 +449,7 @@ Defaults to the whole buffer. END can be out of bounds."
;; on-the-fly jit-locking), make sure the fontification
;; will be performed before displaying the block again.
(quit (put-text-property start next 'fontified nil)
(signal (car err) (cdr err))))))
(signal err)))))
;; In case we fontified more than requested, take
;; advantage of the good news.

View file

@ -543,7 +543,7 @@ Dynamically bind `rfc2047-encoding-type' to change that."
(setq last-encoded nil)))))
(error
(if (or debug-on-quit debug-on-error)
(signal (car err) (cdr err))
(signal err)
(error "Invalid data for rfc2047 encoding: %s"
(replace-regexp-in-string "[ \t\n]+" " " orig-text))))))))
(unless dont-fold

View file

@ -176,7 +176,7 @@ must never cause a Lisp error."
(error
(setq parameters nil)
(when signal-error
(signal (car err) (cdr err)))))
(signal err))))
;; Now collect and concatenate continuation parameters.
(let ((cparams nil)

View file

@ -4634,7 +4634,7 @@ filter out additional entries (because TABLE might not obey PRED)."
(if between (list between)) pattern))
(setq prefix subprefix)))
(if (and (null all) firsterror)
(signal (car firsterror) (cdr firsterror))
(signal firsterror)
(list pattern all prefix suffix)))))
(defun completion-pcm-all-completions (string table pred point)

View file

@ -2025,7 +2025,7 @@ The region will be defined with mark and point."
(pop-mark)))))
;; Cleanup on errors
(error (funcall cleanup)
(signal (car err) (cdr err))))))
(signal err)))))
(defun mouse--drag-set-mark-and-point (start click click-count)
(let* ((range (mouse-start-end start click click-count))
@ -2790,7 +2790,7 @@ This must be bound to a button-down mouse event."
;; Clean up in case something went wrong.
(error (setq track-mouse old-track-mouse)
(setq mouse-fine-grained-tracking old-mouse-fine-grained-tracking)
(signal (car err) (cdr err))))))
(signal err)))))
;; The drag event must be bound to something but does not need any effect,
;; as everything takes place in `mouse-drag-region-rectangle'.

View file

@ -245,7 +245,7 @@ Otherwise, return result of last form in BODY, or all other errors."
(declare (indent 0) (debug t))
`(condition-case err
(progn ,@body)
(dbus-error (when dbus-debug (signal (car err) (cdr err))))))
(dbus-error (when dbus-debug (signal err)))))
(defvar dbus-event-error-functions
'(dbus-notice-synchronous-call-errors
@ -878,7 +878,7 @@ Example:
"AddMatch" rule)
(dbus-error
(if (not (string-match-p "eavesdrop" rule))
(signal (car err) (cdr err))
(signal err)
;; The D-Bus spec says we shall fall back to a rule without eavesdrop.
(when dbus-debug (message "Removing eavesdrop from rule %s" rule))
(setq rule (replace-regexp-in-string ",eavesdrop='true'" "" rule t t))
@ -1234,7 +1234,7 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
;; Propagate D-Bus error messages.
(run-hook-with-args 'dbus-event-error-functions event err)
(when dbus-debug
(signal (car err) (cdr err))))))
(signal err)))))
(defun dbus-event-bus-name (event)
"Return the bus name the event is coming from.

View file

@ -432,7 +432,7 @@ accordingly."
plstore-passphrase-alist)))
(if entry
(setcdr entry nil)))
(signal (car error) (cdr error))))
(signal error)))
(plstore--set-secret-alist plstore (car (read-from-string plain)))
(plstore--merge-secret plstore)
(plstore--set-encrypted-data plstore nil))))

View file

@ -849,7 +849,7 @@ macro as normal text."
(search-failed
(goto-char saved-point)
(unless noerror
(signal (car err) (cdr err)))))))
(signal err))))))
(defun js--re-search-backward-inner (regexp &optional bound count)

View file

@ -995,7 +995,7 @@ directory and makes this the current buffer's default directory."
(progn
(cd (car inferior-octave-output-list))
t)
(error (unless noerror (signal (car err) (cdr err))))))
(error (unless noerror (signal err)))))
(defcustom inferior-octave-minimal-columns 80
"The minimal column width for the inferior Octave process."

View file

@ -235,7 +235,7 @@ Be careful to do it while preserving the current history data."
;; effectively destroy the user's data at the next save.
(setq savehist-mode nil)
(savehist-uninstall)
(signal (car errvar) (cdr errvar))))
(signal errvar)))
;; In case we're loading the file late, there was info in the history
;; variables that may have been overwritten by the info extracted from

View file

@ -879,7 +879,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
;; tar data. Rather than show a mysterious empty buffer, let's
;; revert to fundamental-mode.
(fundamental-mode)
(signal (car err) (cdr err)))))
(signal err))))
(autoload 'woman-tar-extract-file "woman"
"In tar mode, run the WoMan man-page browser on this file." t)

View file

@ -1874,7 +1874,7 @@ Mark is left at original location."
(progn (latex-backward-sexp-1) (1+ arg)))))
(scan-error
(goto-char pos)
(signal (car err) (cdr err))))))
(signal err)))))
(defun latex-syntax-after ()
"Like (char-syntax (char-after)) but aware of multi-char elements."

View file

@ -64,7 +64,7 @@
,(macroexp-progn body))
((debug error)
(transient--emergency-exit ,id)
(signal (car err) (cdr err)))))
(signal err))))
(defun transient--exit-and-debug (&rest args)
(transient--emergency-exit :debugger)

View file

@ -981,7 +981,7 @@ data such as \"Index: ...\" and such."
;; File starts *after* the starting point: we really weren't in
;; a file diff but elsewhere.
(goto-char orig)
(signal (car err) (cdr err)))))
(signal err))))
(defun diff-file-kill (&optional delete)
"Kill current file's hunks.

View file

@ -1444,7 +1444,7 @@ region, or with a numeric prefix. By default it uses a numeric prefix of 1."
;; conflicts instead!
(condition-case err
(smerge-match-conflict)
(error (if (not (markerp otherpos)) (signal (car err) (cdr err))
(error (if (not (markerp otherpos)) (signal err)
(goto-char (prog1 otherpos (setq otherpos (point-marker))))
(smerge-match-conflict))))
(let ((beg (match-beginning 0))

View file

@ -2045,7 +2045,7 @@ After check-out, runs the normal hook `vc-checkout-hook'."
(when t
(let ((buf (get-file-buffer file)))
(when buf (with-current-buffer buf (read-only-mode -1)))))
(signal (car err) (cdr err))))
(signal err)))
`((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit)
nil)
'up-to-date
@ -4695,7 +4695,7 @@ tip revision are merged into the working file."
(and-let* ((fileset (vc-deduce-fileset 'not-state-changing
'allow-unregistered)))
(vc-find-backend-function (car fileset) 'pull)))
(signal (car ret) (cdr ret))))
(signal ret)))
(:success
(setq backend (car ret) files (cadr ret)
fn (vc-find-backend-function backend 'pull))))

View file

@ -286,8 +286,7 @@ void
report_file_errno (char const *string, Lisp_Object name, int errorno)
{
Lisp_Object data = get_file_errno_data (string, name, errorno);
xsignal (Fcar (data), Fcdr (data));
xsignal (data, Qnil);
}
/* Signal a file-access failure that set errno. STRING describes the