diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-05-04 19:16:47 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-05-04 19:16:47 -0400 |
commit | 71873e2b335b721e0b3c585e88211c9564f4c743 (patch) | |
tree | 1a8cbd541abed3098018185e3b84301eed2966d4 /src/print.c | |
parent | 956cceb9b1ffb4117fd1ad556e782de281ee68e3 (diff) | |
download | emacs-71873e2b335b721e0b3c585e88211c9564f4c743.tar.gz |
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/print.c b/src/print.c index b8ee44d0d10..c2edde590fe 100644 --- a/src/print.c +++ b/src/print.c @@ -865,7 +865,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, { Lisp_Object errname, errmsg, file_error, tail; struct gcpro gcpro1; - int i; if (context != 0) write_string_1 (context, -1, stream); @@ -893,9 +892,8 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, } else { - Lisp_Object error_conditions; + Lisp_Object error_conditions = Fget (errname, Qerror_conditions); errmsg = Fget (errname, Qerror_message); - error_conditions = Fget (errname, Qerror_conditions); file_error = Fmemq (Qfile_error, error_conditions); } @@ -909,22 +907,30 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, if (!NILP (file_error) && CONSP (tail)) errmsg = XCAR (tail), tail = XCDR (tail); - if (STRINGP (errmsg)) - Fprinc (errmsg, stream); - else - write_string_1 ("peculiar error", -1, stream); + { + const char *sep = ": "; - for (i = 0; CONSP (tail); tail = XCDR (tail), i = 1) - { - Lisp_Object obj; + if (!STRINGP (errmsg)) + write_string_1 ("peculiar error", -1, stream); + else if (SCHARS (errmsg)) + Fprinc (errmsg, stream); + else + sep = NULL; - write_string_1 (i ? ", " : ": ", 2, stream); - obj = XCAR (tail); - if (!NILP (file_error) || EQ (errname, Qend_of_file)) - Fprinc (obj, stream); - else - Fprin1 (obj, stream); - } + for (; CONSP (tail); tail = XCDR (tail), sep = ", ") + { + Lisp_Object obj; + + if (sep) + write_string_1 (sep, 2, stream); + obj = XCAR (tail); + if (!NILP (file_error) + || EQ (errname, Qend_of_file) || EQ (errname, Quser_error)) + Fprinc (obj, stream); + else + Fprin1 (obj, stream); + } + } UNGCPRO; } |