aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2026-03-08 23:28:11 -0400
committerStefan Monnier2026-03-08 23:28:11 -0400
commit225977cda7c819c3bbf018d870c0eedfa92023bd (patch)
treeb81e3e98b3cb651f47ddc96bb926ec62fe0d5fa7
parent0349286fb6c4d4b4c67b5ae0e51e8ece196fbfb9 (diff)
downloademacs-feature/error-API.tar.gz
emacs-feature/error-API.zip
Use the new error API functionsfeature/error-API
* lisp/epa-file.el (epa-file--find-file-not-found-function): Use `error-slot-value` and `error-data`. (epa-file-insert-file-contents): Use `error-has-type-p`, `error-slot-value`, and `error-data`. * lisp/jka-compr.el (jka-compr-insert-file-contents): Use `error-has-type-p` and `error-slot-value` as well as new re-signaling form of `signal`. * lisp/simple.el (minibuffer-error-function): Use `error-has-type-p`. * lisp/startup.el (startup--load-user-init-file): Use `error-message-string`. (command-line): Use `error-has-type-p` and `error-message-string`. * lisp/type-break.el (type-break-demo-life): Use `error-message-string`. * lisp/emacs-lisp/bytecomp.el (batch-byte-compile-file): Use `error-message-string` and `error-has-type-p`. * lisp/emacs-lisp/edebug.el (edebug-safe-eval, edebug-report-error) (edebug-eval-expression): * lisp/emacs-lisp/debug.el (debugger-eval-expression): Use `error-message-string`. * lisp/emacs-lisp/ert.el (ert--should-error-handle-error): Use `error-has-type-p` and `error-type`. * lisp/net/sasl.el (sasl-error): Use `define-error`. * lisp/net/tramp-compat.el (tramp-error-type-p): New function. (tramp-permission-denied, tramp-compat-permission-denied): Use it. * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Use `error-type-p`.
-rw-r--r--lisp/emacs-lisp/bytecomp.el27
-rw-r--r--lisp/emacs-lisp/debug.el4
-rw-r--r--lisp/emacs-lisp/edebug.el18
-rw-r--r--lisp/emacs-lisp/ert.el9
-rw-r--r--lisp/epa-file.el22
-rw-r--r--lisp/jka-compr.el17
-rw-r--r--lisp/net/sasl.el3
-rw-r--r--lisp/net/soap-client.el2
-rw-r--r--lisp/net/tramp-compat.el9
-rw-r--r--lisp/net/tramp-message.el4
-rw-r--r--lisp/progmodes/elisp-mode.el8
-rw-r--r--lisp/simple.el2
-rw-r--r--lisp/startup.el14
-rw-r--r--lisp/type-break.el4
14 files changed, 59 insertions, 84 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e2d73804eb5..aadfc4c335a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4966,9 +4966,9 @@ binding slots have been popped."
4966 (unless (and c (symbolp c)) 4966 (unless (and c (symbolp c))
4967 (byte-compile-warn-x 4967 (byte-compile-warn-x
4968 c "`%S' is not a condition name (in condition-case)" c)) 4968 c "`%S' is not a condition name (in condition-case)" c))
4969 ;; In reality, the `error-conditions' property is only required 4969 ;; In reality, the `error-conditions' property is required only
4970 ;; for the argument to `signal', not to `condition-case'. 4970 ;; for the argument to `signal', not to `condition-case'.
4971 ;;(unless (consp (get c 'error-conditions)) 4971 ;;(unless (error-type-p c)
4972 ;; (byte-compile-warn 4972 ;; (byte-compile-warn
4973 ;; "`%s' is not a known condition name (in condition-case)" 4973 ;; "`%s' is not a known condition name (in condition-case)"
4974 ;; c)) 4974 ;; c))
@@ -5778,24 +5778,13 @@ already up-to-date."
5778 (byte-compile-file file) 5778 (byte-compile-file file)
5779 (condition-case err 5779 (condition-case err
5780 (byte-compile-file file) 5780 (byte-compile-file file)
5781 (file-error
5782 (message (if (cdr err)
5783 ">>Error occurred processing %s: %s (%s)"
5784 ">>Error occurred processing %s: %s")
5785 file
5786 (get (car err) 'error-message)
5787 (prin1-to-string (cdr err)))
5788 (let ((destfile (byte-compile-dest-file file)))
5789 (if (file-exists-p destfile)
5790 (delete-file destfile)))
5791 nil)
5792 (error 5781 (error
5793 (message (if (cdr err) 5782 (message ">>Error occurred processing %s: %s"
5794 ">>Error occurred processing %s: %s (%s)" 5783 file (error-message-string err))
5795 ">>Error occurred processing %s: %s") 5784 (when (error-has-type-p err 'file-error)
5796 file 5785 (let ((destfile (byte-compile-dest-file file)))
5797 (get (car err) 'error-message) 5786 (if (file-exists-p destfile)
5798 (prin1-to-string (cdr err))) 5787 (delete-file destfile))))
5799 nil))))) 5788 nil)))))
5800 5789
5801(defun byte-compile-refresh-preloaded () 5790(defun byte-compile-refresh-preloaded ()
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index bcea708c678..3019ada1bbd 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -560,9 +560,7 @@ The environment used is the one when entering the activation frame at point."
560 (condition-case err 560 (condition-case err
561 (backtrace-eval exp nframe base) 561 (backtrace-eval exp nframe base)
562 (error (setq errored 562 (error (setq errored
563 (format "%s: %s" 563 (error-message-string err)))))))
564 (get (car err) 'error-message)
565 (car (cdr err)))))))))
566 (if errored 564 (if errored
567 (progn 565 (progn
568 (message "Error: %s" errored) 566 (message "Error: %s" errored)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 5cb781cb39f..3bb12e18842 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -3745,9 +3745,7 @@ Return the result of the last expression."
3745 ;; If there is an error, a string is returned describing the error. 3745 ;; If there is an error, a string is returned describing the error.
3746 (condition-case edebug-err 3746 (condition-case edebug-err
3747 (edebug-eval expr) 3747 (edebug-eval expr)
3748 (error (edebug-format "%s: %s" ;; could 3748 (error (error-message-string edebug-err))))
3749 (get (car edebug-err) 'error-message)
3750 (car (cdr edebug-err))))))
3751 3749
3752;;; Printing 3750;;; Printing
3753 3751
@@ -3755,14 +3753,7 @@ Return the result of the last expression."
3755(defun edebug-report-error (value) 3753(defun edebug-report-error (value)
3756 ;; Print an error message like command level does. 3754 ;; Print an error message like command level does.
3757 ;; This also prints the error name if it has no error-message. 3755 ;; This also prints the error name if it has no error-message.
3758 (message "%s: %s" 3756 (message "%s" (error-message-string value)))
3759 (or (get (car value) 'error-message)
3760 (format "peculiar error (%s)" (car value)))
3761 (mapconcat (lambda (edebug-arg)
3762 ;; continuing after an error may
3763 ;; complain about edebug-arg. why??
3764 (prin1-to-string edebug-arg))
3765 (cdr value) ", ")))
3766 3757
3767;; Alternatively, we could change the definition of 3758;; Alternatively, we could change the definition of
3768;; edebug-safe-prin1-to-string to only use these if defined. 3759;; edebug-safe-prin1-to-string to only use these if defined.
@@ -3812,10 +3803,7 @@ this is the prefix key.)"
3812 (condition-case err 3803 (condition-case err
3813 (edebug-eval expr) 3804 (edebug-eval expr)
3814 (error 3805 (error
3815 (setq errored 3806 (setq errored (error-message-string err)))))))
3816 (format "%s: %s"
3817 (get (car err) 'error-message)
3818 (car (cdr err)))))))))
3819 (result 3807 (result
3820 (unless errored 3808 (unless errored
3821 (values--store-value value) 3809 (values--store-value value)
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d5e0afe3b92..6dacd568c7a 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -396,12 +396,11 @@ Returns nil."
396 396
397Determines whether CONDITION matches TYPE and EXCLUDE-SUBTYPES, 397Determines whether CONDITION matches TYPE and EXCLUDE-SUBTYPES,
398and aborts the current test as failed if it doesn't." 398and aborts the current test as failed if it doesn't."
399 (let ((signaled-conditions (get (car condition) 'error-conditions)) 399 (let ((handled-conditions (pcase-exhaustive type
400 (handled-conditions (pcase-exhaustive type
401 ((pred listp) type) 400 ((pred listp) type)
402 ((pred symbolp) (list type))))) 401 ((pred symbolp) (list type)))))
403 (cl-assert signaled-conditions) 402 (unless (cl-some (lambda (hc) (error-has-type-p condition hc))
404 (unless (cl-intersection signaled-conditions handled-conditions) 403 handled-conditions)
405 (ert-fail (append 404 (ert-fail (append
406 (funcall form-description-fn) 405 (funcall form-description-fn)
407 (list 406 (list
@@ -409,7 +408,7 @@ and aborts the current test as failed if it doesn't."
409 :fail-reason (concat "the error signaled did not" 408 :fail-reason (concat "the error signaled did not"
410 " have the expected type"))))) 409 " have the expected type")))))
411 (when exclude-subtypes 410 (when exclude-subtypes
412 (unless (member (car condition) handled-conditions) 411 (unless (member (error-type condition) handled-conditions)
413 (ert-fail (append 412 (ert-fail (append
414 (funcall form-description-fn) 413 (funcall form-description-fn)
415 (list 414 (list
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 9bf6916ff7a..ced54b6eeed 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -117,10 +117,10 @@ encryption is used."
117 (let ((error epa-file-error)) 117 (let ((error epa-file-error))
118 (save-window-excursion 118 (save-window-excursion
119 (kill-buffer)) 119 (kill-buffer))
120 (if (nth 3 error) 120 (if (error-slot-value error 3)
121 (user-error "Wrong passphrase: %s" (nth 3 error)) 121 (user-error "Wrong passphrase: %s" (error-slot-value error 3))
122 (signal 'file-missing 122 (signal 'file-missing
123 (cons "Opening input file" (cdr error)))))) 123 (cons "Opening input file" (error-data error))))))
124 124
125(defun epa--wrong-password-p (context) 125(defun epa--wrong-password-p (context)
126 "Return whether a wrong password caused the error in CONTEXT." 126 "Return whether a wrong password caused the error in CONTEXT."
@@ -171,23 +171,25 @@ encryption is used."
171 ;; signal that as a non-file error 171 ;; signal that as a non-file error
172 ;; so that find-file-noselect-1 won't handle it. 172 ;; so that find-file-noselect-1 won't handle it.
173 ;; Borrowed from jka-compr.el. 173 ;; Borrowed from jka-compr.el.
174 (if (and (memq 'file-error (get (car error) 'error-conditions)) 174 (if (and (error-has-type-p error 'file-error)
175 (equal (cadr error) "Searching for program")) 175 (equal (error-slot-value error 1)
176 "Searching for program"))
176 (error "Decryption program `%s' not found" 177 (error "Decryption program `%s' not found"
177 (nth 3 error))) 178 (error-slot-value error 3)))
178 (let ((exists (file-exists-p local-file))) 179 (let ((exists (file-exists-p local-file)))
179 (when exists 180 (when exists
180 (if-let* ((wrong-password (epa--wrong-password-p context))) 181 (if-let* ((wrong-password (epa--wrong-password-p context)))
181 ;; Don't display the *error* buffer if we just 182 ;; Don't display the *error* buffer if we just
182 ;; have a wrong password; let the later error 183 ;; have a wrong password; let the later error
183 ;; handler notify the user. 184 ;; handler notify the user.
184 (setq error (append error (list wrong-password))) 185 (setf (error-data error)
186 (append (error-data error) (list wrong-password)))
185 (epa-display-error context)) 187 (epa-display-error context))
186 ;; When the .gpg file isn't an encrypted file (e.g., 188 ;; When the .gpg file isn't an encrypted file (e.g.,
187 ;; it's a keyring.gpg file instead), then gpg will 189 ;; it's a keyring.gpg file instead), then gpg will
188 ;; say "Unexpected exit" as the error message. In 190 ;; say "Unexpected exit" as the error message. In
189 ;; that case, just display the bytes. 191 ;; that case, just display the bytes.
190 (if (equal (caddr error) "Unexpected; Exit") 192 (if (equal (error-slot-value error 2) "Unexpected; Exit")
191 (setq string (with-temp-buffer 193 (setq string (with-temp-buffer
192 (insert-file-contents-literally local-file) 194 (insert-file-contents-literally local-file)
193 (buffer-string))) 195 (buffer-string)))
@@ -197,10 +199,10 @@ encryption is used."
197 ;; `find-file-noselect-1'. 199 ;; `find-file-noselect-1'.
198 (setq-local epa-file-error error) 200 (setq-local epa-file-error error)
199 (add-hook 'find-file-not-found-functions 201 (add-hook 'find-file-not-found-functions
200 'epa-file--find-file-not-found-function 202 #'epa-file--find-file-not-found-function
201 nil t))) 203 nil t)))
202 (signal (if exists 'file-error 'file-missing) 204 (signal (if exists 'file-error 'file-missing)
203 (cons "Opening input file" (cdr error)))))) 205 (cons "Opening input file" (error-data error))))))
204 (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! 206 (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
205 (setq-local epa-file-encrypt-to 207 (setq-local epa-file-encrypt-to
206 (mapcar #'car (epg-context-result-for 208 (mapcar #'car (epg-context-result-for
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 8258ab32495..c4643fb2d8c 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -471,22 +471,21 @@ There should be no more than seven characters after the final `/'."
471 ;; If the file we wanted to uncompress does not exist, 471 ;; If the file we wanted to uncompress does not exist,
472 ;; handle that according to VISIT as `insert-file-contents' 472 ;; handle that according to VISIT as `insert-file-contents'
473 ;; would, maybe signaling the same error it normally would. 473 ;; would, maybe signaling the same error it normally would.
474 (if (and (eq (car error-code) 'file-missing) 474 (if (and (error-has-type-p error-code 'file-missing)
475 (eq (nth 3 error-code) local-file)) 475 (eq (error-slot-value error-code 3) local-file))
476 (if visit 476 (if visit
477 (setq notfound error-code) 477 (setq notfound error-code)
478 (signal 'file-missing 478 (setf (error-slot-value error-code 1)
479 (cons "Opening input file" 479 "Opening input file")
480 (nthcdr 2 error-code)))) 480 (signal error-code))
481 ;; If the uncompression program can't be found, 481 ;; If the uncompression program can't be found,
482 ;; signal that as a non-file error 482 ;; signal that as a non-file error
483 ;; so that find-file-noselect-1 won't handle it. 483 ;; so that find-file-noselect-1 won't handle it.
484 (if (and (memq 'file-error (get (car error-code) 484 (if (and (error-has-type-p error-code 'file-error)
485 'error-conditions))
486 (equal (cadr error-code) "Searching for program")) 485 (equal (cadr error-code) "Searching for program"))
487 (error "Uncompression program `%s' not found" 486 (error "Uncompression program `%s' not found"
488 (nth 3 error-code))) 487 (error-slot-value error-code 3))
489 (signal (car error-code) (cdr error-code))))))) 488 (signal error-code)))))))
490 489
491 (and 490 (and
492 local-copy 491 local-copy
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el
index 289e867e672..3f805237683 100644
--- a/lisp/net/sasl.el
+++ b/lisp/net/sasl.el
@@ -50,8 +50,7 @@
50 50
51(defvar sasl-unique-id-function #'sasl-unique-id-function) 51(defvar sasl-unique-id-function #'sasl-unique-id-function)
52 52
53(put 'sasl-error 'error-message "SASL error") 53(define-error 'sasl-error "SASL error")
54(put 'sasl-error 'error-conditions '(sasl-error error))
55 54
56(defun sasl-error (datum) 55(defun sasl-error (datum)
57 (signal 'sasl-error (list datum))) 56 (signal 'sasl-error (list datum)))
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index beebe9b4445..f6d2ba229e5 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -2886,7 +2886,7 @@ decode function to perform the actual decoding."
2886 2886
2887;;;; Soap Envelope parsing 2887;;;; Soap Envelope parsing
2888 2888
2889(if (fboundp 'define-error) 2889(if (fboundp 'define-error) ;Emacs-24.4
2890 (define-error 'soap-error "SOAP error") 2890 (define-error 'soap-error "SOAP error")
2891 ;; Support Emacs<24.4 that do not have define-error, so 2891 ;; Support Emacs<24.4 that do not have define-error, so
2892 ;; that soap-client can remain unchanged in GNU ELPA. 2892 ;; that soap-client can remain unchanged in GNU ELPA.
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index f975457d4df..ecc6fe96855 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -102,14 +102,19 @@ Add the extension of F, if existing."
102 tramp-temp-name-prefix tramp-compat-temporary-file-directory) 102 tramp-temp-name-prefix tramp-compat-temporary-file-directory)
103 dir-flag (file-name-extension f t))) 103 dir-flag (file-name-extension f t)))
104 104
105(defalias 'tramp-error-type-p
106 (if (fboundp 'error-type-p) ;Emacs-31
107 #'error-type-p
108 (lambda (symbol) (get symbol 'error-conditions))))
109
105;; `permission-denied' is introduced in Emacs 29.1. 110;; `permission-denied' is introduced in Emacs 29.1.
106(defconst tramp-permission-denied 111(defconst tramp-permission-denied
107 (if (get 'permission-denied 'error-conditions) 'permission-denied 'file-error) 112 (if (tramp-error-type-p 'permission-denied) 'permission-denied 'file-error)
108 "The error symbol for the `permission-denied' error.") 113 "The error symbol for the `permission-denied' error.")
109 114
110(defsubst tramp-compat-permission-denied (vec file) 115(defsubst tramp-compat-permission-denied (vec file)
111 "Emit the `permission-denied' error." 116 "Emit the `permission-denied' error."
112 (if (get 'permission-denied 'error-conditions) 117 (if (tramp-error-type-p 'permission-denied)
113 (tramp-error vec tramp-permission-denied file) 118 (tramp-error vec tramp-permission-denied file)
114 (tramp-error vec tramp-permission-denied "Permission denied: %s" file))) 119 (tramp-error vec tramp-permission-denied "Permission denied: %s" file)))
115 120
diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el
index 7b405061ba8..37628e2f001 100644
--- a/lisp/net/tramp-message.el
+++ b/lisp/net/tramp-message.el
@@ -398,8 +398,12 @@ FMT-STRING and ARGUMENTS."
398 vec-or-proc 1 "%s" 398 vec-or-proc 1 "%s"
399 (error-message-string 399 (error-message-string
400 (list signal 400 (list signal
401 ;; FIXME: Looks redundant since `error-message-string'
402 ;; already uses the `error-message' property of `signal'!
401 (get signal 'error-message) 403 (get signal 'error-message)
402 (apply #'format-message fmt-string arguments)))) 404 (apply #'format-message fmt-string arguments))))
405 ;; FIXME: This doesn't look right: ELisp code should be able to rely on
406 ;; the "shape" of the list based on the type of the signal.
403 (signal signal (list (substring-no-properties 407 (signal signal (list (substring-no-properties
404 (apply #'format-message fmt-string arguments)))))) 408 (apply #'format-message fmt-string arguments))))))
405 409
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 946d3ba10be..2773f5e76b0 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1104,8 +1104,7 @@ functions are annotated with \"<f>\" via the
1104 ;; specific completion table in more cases. 1104 ;; specific completion table in more cases.
1105 (is-ignore-error 1105 (is-ignore-error
1106 (list t (elisp--completion-local-symbols) 1106 (list t (elisp--completion-local-symbols)
1107 :predicate (lambda (sym) 1107 :predicate #'error-type-p))
1108 (get sym 'error-conditions))))
1109 ((elisp--expect-function-p beg) 1108 ((elisp--expect-function-p beg)
1110 (list nil (elisp--completion-local-symbols) 1109 (list nil (elisp--completion-local-symbols)
1111 :predicate 1110 :predicate
@@ -1179,12 +1178,11 @@ functions are annotated with \"<f>\" via the
1179 (forward-sexp 2) 1178 (forward-sexp 2)
1180 (< (point) beg))))) 1179 (< (point) beg)))))
1181 (list t (elisp--completion-local-symbols) 1180 (list t (elisp--completion-local-symbols)
1182 :predicate (lambda (sym) (get sym 'error-conditions)))) 1181 :predicate #'error-type-p))
1183 ;; `ignore-error' with a list CONDITION parameter. 1182 ;; `ignore-error' with a list CONDITION parameter.
1184 ('ignore-error 1183 ('ignore-error
1185 (list t (elisp--completion-local-symbols) 1184 (list t (elisp--completion-local-symbols)
1186 :predicate (lambda (sym) 1185 :predicate #'error-type-p))
1187 (get sym 'error-conditions))))
1188 ((and (or ?\( 'let 'let* 'cond 'cond* 'bind*) 1186 ((and (or ?\( 'let 'let* 'cond 'cond* 'bind*)
1189 (guard (save-excursion 1187 (guard (save-excursion
1190 (goto-char (1- beg)) 1188 (goto-char (1- beg))
diff --git a/lisp/simple.el b/lisp/simple.el
index 99930c3090c..67a4894e315 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3397,7 +3397,7 @@ Go to the history element by the absolute history position HIST-POS."
3397The same as `command-error-default-function' but display error messages 3397The same as `command-error-default-function' but display error messages
3398at the end of the minibuffer using `minibuffer-message' to not obscure 3398at the end of the minibuffer using `minibuffer-message' to not obscure
3399the minibuffer contents." 3399the minibuffer contents."
3400 (if (memq 'minibuffer-quit (get (car data) 'error-conditions)) 3400 (if (error-has-type-p data 'minibuffer-quit)
3401 (ding t) 3401 (ding t)
3402 (discard-input) 3402 (discard-input)
3403 (ding)) 3403 (ding))
diff --git a/lisp/startup.el b/lisp/startup.el
index 9c1eafdae07..5b8f90a81c4 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1123,15 +1123,12 @@ init-file, or to a default value if loading is not possible."
1123 (display-warning 1123 (display-warning
1124 'initialization 1124 'initialization
1125 (format-message "\ 1125 (format-message "\
1126An error occurred while loading `%s':\n\n%s%s%s\n\n\ 1126An error occurred while loading `%s':\n\n%s\n\n\
1127To ensure normal operation, you should investigate and remove the 1127To ensure normal operation, you should investigate and remove the
1128cause of the error in your initialization file. Start Emacs with 1128cause of the error in your initialization file. Start Emacs with
1129the `--debug-init' option to view a complete error backtrace." 1129the `--debug-init' option to view a complete error backtrace."
1130 user-init-file 1130 user-init-file
1131 (get (car error) 'error-message) 1131 (error-message-string error))
1132 (if (cdr error) ": " "")
1133 (mapconcat (lambda (s) (prin1-to-string s t))
1134 (cdr error) ", "))
1135 :warning) 1132 :warning)
1136 (setq init-file-had-error t)))))) 1133 (setq init-file-had-error t))))))
1137 1134
@@ -1593,15 +1590,12 @@ please check its value")
1593 (princ 1590 (princ
1594 (if (eq (car error) 'error) 1591 (if (eq (car error) 'error)
1595 (apply #'concat (cdr error)) 1592 (apply #'concat (cdr error))
1596 (if (memq 'file-error (get (car error) 'error-conditions)) 1593 (if (error-has-type-p error 'file-error)
1597 (format "%s: %s" 1594 (format "%s: %s"
1598 (nth 1 error) 1595 (nth 1 error)
1599 (mapconcat (lambda (obj) (prin1-to-string obj t)) 1596 (mapconcat (lambda (obj) (prin1-to-string obj t))
1600 (cdr (cdr error)) ", ")) 1597 (cdr (cdr error)) ", "))
1601 (format "%s: %s" 1598 (error-message-string error)))
1602 (get (car error) 'error-message)
1603 (mapconcat (lambda (obj) (prin1-to-string obj t))
1604 (cdr error) ", "))))
1605 'external-debugging-output) 1599 'external-debugging-output)
1606 (terpri 'external-debugging-output) 1600 (terpri 'external-debugging-output)
1607 (setq initial-window-system nil) 1601 (setq initial-window-system nil)
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 440a7136f1d..d71b41da531 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -1025,7 +1025,7 @@ With optional non-nil ALL, force redisplay of all mode-lines."
1025 (setq continue nil) 1025 (setq continue nil)
1026 (and (get-buffer "*Life*") 1026 (and (get-buffer "*Life*")
1027 (kill-buffer "*Life*")) 1027 (kill-buffer "*Life*"))
1028 (condition-case () 1028 (condition-case err
1029 (progn 1029 (progn
1030 (life 3) 1030 (life 3)
1031 ;; wait for user to return 1031 ;; wait for user to return
@@ -1033,7 +1033,7 @@ With optional non-nil ALL, force redisplay of all mode-lines."
1033 (type-break-catch-up-event) 1033 (type-break-catch-up-event)
1034 (kill-buffer "*Life*")) 1034 (kill-buffer "*Life*"))
1035 (life-extinct 1035 (life-extinct
1036 (message "%s" (get 'life-extinct 'error-message)) 1036 (message "%s" (error-message-string err))
1037 ;; restart demo 1037 ;; restart demo
1038 (setq continue t)) 1038 (setq continue t))
1039 (quit 1039 (quit