diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 45 | ||||
-rw-r--r-- | lisp/bindings.el | 19 | ||||
-rw-r--r-- | lisp/calendar/calendar.el | 4 | ||||
-rw-r--r-- | lisp/comint.el | 28 | ||||
-rw-r--r-- | lisp/completion.el | 8 | ||||
-rw-r--r-- | lisp/cus-edit.el | 35 | ||||
-rw-r--r-- | lisp/dabbrev.el | 17 | ||||
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 33 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 6 | ||||
-rw-r--r-- | lisp/files.el | 4 | ||||
-rw-r--r-- | lisp/imenu.el | 14 | ||||
-rw-r--r-- | lisp/info.el | 74 | ||||
-rw-r--r-- | lisp/man.el | 9 | ||||
-rw-r--r-- | lisp/mouse.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 7 | ||||
-rw-r--r-- | lisp/progmodes/etags.el | 56 | ||||
-rw-r--r-- | lisp/simple.el | 28 | ||||
-rw-r--r-- | lisp/subr.el | 11 | ||||
-rw-r--r-- | lisp/vc/smerge-mode.el | 9 | ||||
-rw-r--r-- | lisp/window.el | 4 |
20 files changed, 183 insertions, 230 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0c5c2050754..5c38eb86fa7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,50 @@ 2012-05-04 Stefan Monnier <monnier@iro.umontreal.ca> + * subr.el (user-error): New function. + * window.el (switch-to-buffer): + * vc/smerge-mode.el (smerge-resolve-function, smerge-resolve) + (smerge-match-conflict): + * simple.el (previous-matching-history-element) + (next-matching-history-element, goto-history-element, undo-more) + (undo-start): + * 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): + * progmodes/compile.el (compilation-loop): + * mouse.el (mouse-minibuffer-check): + * man.el (Man-bgproc-sentinel, Man-goto-page): + * 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): + * imenu.el (imenu--make-index-alist) + (imenu-default-create-index-function, imenu-add-to-menubar): + * files.el (basic-save-buffer, recover-file): + * emacs-lisp/easy-mmode.el (easy-mmode-define-navigation): + * emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments) + (checkdoc-message-text, checkdoc-defun): + * dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point): + * 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): + * completion.el (check-completion-length): + * 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): + * calendar/calendar.el (calendar-cursor-to-date): Use it. + * bindings.el (debug-ignored-errors): Remove regexps, add `user-error'. + +2012-05-04 Stefan Monnier <monnier@iro.umontreal.ca> + * dabbrev.el (dabbrev--ignore-case-p): New function. (dabbrev-completion, dabbrev-expand, dabbrev--substitute-expansion): Use it. diff --git a/lisp/bindings.el b/lisp/bindings.el index 8cfeecf5b40..f04ee723220 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -623,24 +623,13 @@ is okay. See `mode-line-format'.") ;; Packages should add to this list appropriately when they are ;; loaded, rather than listing everything here. (setq debug-ignored-errors + ;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line, + ;; end-of-buffer, end-of-file, buffer-read-only, and + ;; file-supersession should all be user-errors! `(beginning-of-line beginning-of-buffer end-of-line end-of-buffer end-of-file buffer-read-only file-supersession - ,(purecopy "^Previous command was not a yank$") - ,(purecopy "^Minibuffer window is not active$") - ,(purecopy "^No previous history search regexp$") - ,(purecopy "^No later matching history item$") - ,(purecopy "^No earlier matching history item$") - ,(purecopy "^End of history; no default available$") - ,(purecopy "^End of defaults; no next item$") - ,(purecopy "^Beginning of history; no preceding item$") - ,(purecopy "^No recursive edit is in progress$") - ,(purecopy "^Changes to be undone are outside visible portion of buffer$") - ,(purecopy "^No undo information in this buffer$") - ,(purecopy "^No further undo information") - ,(purecopy "^Save not confirmed$") - ,(purecopy "^Recover-file cancelled\\.$") - ,(purecopy "^Cannot switch buffers in a dedicated window$") + user-error ;; That's the main one! )) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index d9ec27b4f88..4d4f7e14187 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1888,7 +1888,7 @@ use instead of point." ;; or on or before the digit of a 1-digit date. (if (not (and (looking-at "[ 0-9]?[0-9][^0-9]") (get-text-property (point) 'date))) - (if error (error "Not on a date!")) + (if error (user-error "Not on a date!")) ;; Convert segment to real month and year. (if (zerop month) (setq month 12)) ;; Go back to before the first date digit. @@ -1903,8 +1903,6 @@ use instead of point." ((and (= 1 month) (= segment 2)) (1+ displayed-year)) (t displayed-year)))))))) -(add-to-list 'debug-ignored-errors "Not on a date!") - ;; The following version of calendar-gregorian-from-absolute is preferred for ;; reasons of clarity, BUT it's much slower than the version that follows it. diff --git a/lisp/comint.el b/lisp/comint.el index 8103db0e9bb..43e42c87be7 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1076,10 +1076,10 @@ See also `comint-read-input-ring'." (defun comint-search-arg (arg) ;; First make sure there is a ring and that we are after the process mark (cond ((not (comint-after-pmark-p)) - (error "Not at command line")) + (user-error "Not at command line")) ((or (null comint-input-ring) (ring-empty-p comint-input-ring)) - (error "Empty input ring")) + (user-error "Empty input ring")) ((zerop arg) ;; arg of zero resets search from beginning, and uses arg of 1 (setq comint-input-ring-index nil) @@ -1146,7 +1146,7 @@ Moves relative to `comint-input-ring-index'." Moves relative to START, or `comint-input-ring-index'." (if (or (not (ring-p comint-input-ring)) (ring-empty-p comint-input-ring)) - (error "No history")) + (user-error "No history")) (let* ((len (ring-length comint-input-ring)) (motion (if (> arg 0) 1 -1)) (n (mod (- (or start (comint-search-start arg)) motion) len)) @@ -1186,7 +1186,7 @@ If N is negative, find the next or Nth next match." (let ((pos (comint-previous-matching-input-string-position regexp n))) ;; Has a match been found? (if (null pos) - (error "Not found") + (user-error "Not found") ;; If leaving the edit line, save partial input (if (null comint-input-ring-index) ;not yet on ring (setq comint-stored-incomplete-input @@ -1372,7 +1372,7 @@ actual side-effect." (goto-char (match-beginning 0)) (if (not (search-forward old pos t)) (or silent - (error "Not found")) + (user-error "Not found")) (replace-match new t t) (message "History item: substituted")))) (t @@ -1777,7 +1777,7 @@ Similarly for Soar, Scheme, etc." (interactive) ;; Note that the input string does not include its terminal newline. (let ((proc (get-buffer-process (current-buffer)))) - (if (not proc) (error "Current buffer has no process") + (if (not proc) (user-error "Current buffer has no process") (widen) (let* ((pmark (process-mark proc)) (intxt (if (>= (point) (marker-position pmark)) @@ -2201,7 +2201,7 @@ Calls `comint-get-old-input' to get old input." (let ((input (funcall comint-get-old-input)) (process (get-buffer-process (current-buffer)))) (if (not process) - (error "Current buffer has no process") + (user-error "Current buffer has no process") (goto-char (process-mark process)) (insert input)))) @@ -2508,7 +2508,7 @@ If N is negative, find the next or Nth next match." (save-excursion (while (/= n 0) (unless (re-search-backward regexp nil t dir) - (error "Not found")) + (user-error "Not found")) (unless (get-char-property (point) 'field) (setq n (- n dir)))) (field-beginning)))) @@ -3364,7 +3364,7 @@ The process mark separates output, and input already sent, from input that has not yet been sent." (interactive) (let ((proc (or (get-buffer-process (current-buffer)) - (error "Current buffer has no process")))) + (user-error "Current buffer has no process")))) (goto-char (process-mark proc)) (when (called-interactively-p 'interactive) (message "Point is now at the process mark")))) @@ -3389,7 +3389,7 @@ the process mark is at the beginning of the accumulated input." "Set the process mark at point." (interactive) (let ((proc (or (get-buffer-process (current-buffer)) - (error "Current buffer has no process")))) + (user-error "Current buffer has no process")))) (set-marker (process-mark proc) (point)) (message "Process mark set"))) @@ -3741,14 +3741,6 @@ REGEXP-GROUP is the regular expression group in REGEXP to use." (match-end regexp-group)) results)) results))) - -(dolist (x '("^Not at command line$" - "^Empty input ring$" - "^No history$" - "^Not found$" ; Too common? - "^Current buffer has no process$")) - (add-to-list 'debug-ignored-errors x)) - ;; Converting process modes to use comint mode ;; =========================================================================== diff --git a/lisp/completion.el b/lisp/completion.el index 9c6cd60c96c..75f8920920c 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -1301,8 +1301,8 @@ String must be longer than `completion-prefix-min-length'." (defun check-completion-length (string) (if (< (length string) completion-min-length) - (error "The string `%s' is too short to be saved as a completion" - string) + (user-error "The string `%s' is too short to be saved as a completion" + string) (list string))) (defun add-completion (string &optional num-uses last-use-time) @@ -2467,10 +2467,6 @@ if ARG is omitted or nil." (defvaralias 'cmpl-syntax-table 'completion-syntax-table) (defalias 'initialize-completions 'completion-initialize) -(dolist (x '("^To complete, the point must be after a symbol at least [0-9]* character long\\.$" - "^The string \".*\" is too short to be saved as a completion\\.$")) - (add-to-list 'debug-ignored-errors x)) - (provide 'completion) ;;; completion.el ends here diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 4458bb7b56f..52308319f15 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1254,8 +1254,8 @@ that were added or redefined since that version." (if found (custom-buffer-create (custom-sort-items found t 'first) "*Customize Changed Options*") - (error "No user option defaults have been changed since Emacs %s" - since-version)))) + (user-error "No user option defaults have been changed since Emacs %s" + since-version)))) (defun customize-package-emacs-version (symbol package-version) "Return the Emacs version in which SYMBOL's meaning last changed. @@ -1386,7 +1386,7 @@ suggest to customize that face, if it's customizable." (default-value symbol)))) (push (list symbol 'custom-variable) found))))) (if (not found) - (error "No rogue user options") + (user-error "No rogue user options") (custom-buffer-create (custom-sort-items found t nil) "*Customize Rogue*")))) ;;;###autoload @@ -1403,8 +1403,8 @@ suggest to customize that face, if it's customizable." (get symbol 'saved-variable-comment)) (boundp symbol) (push (list symbol 'custom-variable) found)))) - (if (not found ) - (error "No saved user options") + (if (not found) + (user-error "No saved user options") (custom-buffer-create (custom-sort-items found t nil) "*Customize Saved*")))) @@ -2879,7 +2879,7 @@ Optional EVENT is the location for the menu." (comment (widget-value comment-widget)) val) (cond ((eq state 'hidden) - (error "Cannot set hidden variable")) + (user-error "Cannot set hidden variable")) ((setq val (widget-apply child :validate)) (goto-char (widget-get val :from)) (error "%s" (widget-get val :error))) @@ -2921,7 +2921,7 @@ Optional EVENT is the location for the menu." (comment (widget-value comment-widget)) val) (cond ((eq state 'hidden) - (error "Cannot set hidden variable")) + (user-error "Cannot set hidden variable")) ((setq val (widget-apply child :validate)) (goto-char (widget-get val :from)) (error "Saving %s: %s" symbol (widget-get val :error))) @@ -2995,7 +2995,7 @@ redraw the widget immediately." (let* ((symbol (widget-value widget))) (if (get symbol 'standard-value) (custom-variable-backup-value widget) - (error "No standard setting known for %S" symbol)) + (user-error "No standard setting known for %S" symbol)) (put symbol 'variable-comment nil) (put symbol 'customized-value nil) (put symbol 'customized-variable-comment nil) @@ -3057,7 +3057,7 @@ to switch between two values." (condition-case nil (funcall set symbol (car value)) (error nil))) - (error "No backup value for %s" symbol)) + (user-error "No backup value for %s" symbol)) (put symbol 'customized-value (list (custom-quote (car value)))) (put symbol 'variable-comment comment) (put symbol 'customized-variable-comment comment) @@ -3795,7 +3795,7 @@ redraw the widget immediately." (value (get symbol 'face-defface-spec)) (comment-widget (widget-get widget :comment-widget))) (unless value - (error "No standard setting for this face")) + (user-error "No standard setting for this face")) (put symbol 'customized-face nil) (put symbol 'customized-face-comment nil) (custom-push-theme 'theme-face symbol 'user 'reset) @@ -4414,7 +4414,7 @@ if only the first line of the docstring is shown.")) ;; sense. (if no-error nil - (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) + (user-error "Saving settings from \"emacs -q\" would overwrite existing customizations")) (file-chase-links (or custom-file user-init-file)))) ;; If recentf-mode is non-nil, this is defined. @@ -4875,18 +4875,7 @@ if that value is non-nil." (put 'custom-mode 'mode-class 'special) (define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1") -(dolist (regexp - '("^No user option defaults have been changed since Emacs " - "^Invalid face:? " - "^No \\(?:customized\\|rogue\\|saved\\) user options" - "^No customizable items matching " - "^There are unset changes" - "^Cannot set hidden variable" - "^No \\(?:saved\\|backup\\) value for " - "^No standard setting known for " - "^No standard setting for this face" - "^Saving settings from \"emacs -q\" would overwrite existing customizations")) - (add-to-list 'debug-ignored-errors regexp)) +(add-to-list 'debug-ignored-errors "^Invalid face:? ") ;;; The End. diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index c169e07ac30..87a03fd24da 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -406,10 +406,10 @@ then it searches *all* buffers." (dabbrev--find-all-expansions abbrev ignore-case-p)) (completion-ignore-case ignore-case-p)) (or (consp completion-list) - (error "No dynamic expansion for \"%s\" found%s" - abbrev - (if dabbrev--check-other-buffers - "" " in this-buffer"))) + (user-error "No dynamic expansion for \"%s\" found%s" + abbrev + (if dabbrev--check-other-buffers + "" " in this-buffer"))) (setq list (cond ((not (and ignore-case-p dabbrev-case-replace)) @@ -585,7 +585,7 @@ all skip characters." "Extract the symbol at point to serve as abbreviation." ;; Check for error (if (bobp) - (error "No possible abbreviation preceding point")) + (user-error "No possible abbreviation preceding point")) ;; Return abbrev at point (save-excursion ;; Record the end of the abbreviation. @@ -603,7 +603,7 @@ all skip characters." "\\sw\\|\\s_") nil t) (forward-char 1) - (error "No possible abbreviation preceding point")))) + (user-error "No possible abbreviation preceding point")))) ;; Now find the beginning of that one. (dabbrev--goto-start-of-abbrev) (buffer-substring-no-properties @@ -974,11 +974,6 @@ Leaves point at the location of the start of the expansion." (cons found-string dabbrev--last-table)) result))))) -(dolist (mess '("^No dynamic expansion for .* found" - "^No further dynamic expansion for .* found$" - "^No possible abbreviation preceding point$")) - (add-to-list 'debug-ignored-errors mess)) - (provide 'dabbrev) ;;; dabbrev.el ends here diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 7a9a33fc2cc..ee8cbd2c3bc 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -916,7 +916,7 @@ is the starting location. If this is nil, `point-min' is used instead." (progn (goto-char wrong) (if (not take-notes) - (error "%s" (checkdoc-error-text msg))))) + (user-error "%s" (checkdoc-error-text msg))))) (checkdoc-show-diagnostics) (if (called-interactively-p 'interactive) (message "No style warnings.")))) @@ -949,7 +949,7 @@ if there is one." (e (checkdoc-file-comments-engine)) (checkdoc-generate-compile-warnings-flag (or take-notes checkdoc-generate-compile-warnings-flag))) - (if e (error "%s" (checkdoc-error-text e))) + (if e (user-error "%s" (checkdoc-error-text e))) (checkdoc-show-diagnostics) e)) @@ -987,7 +987,7 @@ Optional argument TAKE-NOTES causes all errors to be logged." (if (not (called-interactively-p 'interactive)) e (if e - (error "%s" (checkdoc-error-text e)) + (user-error "%s" (checkdoc-error-text e)) (checkdoc-show-diagnostics))) (goto-char p)) (if (called-interactively-p 'interactive) @@ -1027,19 +1027,14 @@ space at the end of each line." (car (memq checkdoc-spellcheck-documentation-flag '(defun t)))) (beg (save-excursion (beginning-of-defun) (point))) - (end (save-excursion (end-of-defun) (point))) - (msg (checkdoc-this-string-valid))) - (if msg (if no-error - (message "%s" (checkdoc-error-text msg)) - (error "%s" (checkdoc-error-text msg))) - (setq msg (checkdoc-message-text-search beg end)) - (if msg (if no-error - (message "%s" (checkdoc-error-text msg)) - (error "%s" (checkdoc-error-text msg))) - (setq msg (checkdoc-rogue-space-check-engine beg end)) - (if msg (if no-error - (message "%s" (checkdoc-error-text msg)) - (error "%s" (checkdoc-error-text msg)))))) + (end (save-excursion (end-of-defun) (point)))) + (dolist (fun (list #'checkdoc-this-string-valid + (lambda () (checkdoc-message-text-search beg end)) + (lambda () (checkdoc-rogue-space-check-engine beg end)))) + (let ((msg (funcall fun))) + (if msg (if no-error + (message "%s" (checkdoc-error-text msg)) + (user-error "%s" (checkdoc-error-text msg)))))) (if (called-interactively-p 'interactive) (message "Checkdoc: done.")))))) @@ -2644,12 +2639,6 @@ function called to create the messages." (custom-add-option 'emacs-lisp-mode-hook 'checkdoc-minor-mode) -(add-to-list 'debug-ignored-errors - "Argument `.*' should appear (as .*) in the doc string") -(add-to-list 'debug-ignored-errors - "Lisp symbol `.*' should appear in quotes") -(add-to-list 'debug-ignored-errors "Disambiguate .* by preceding .*") - (provide 'checkdoc) ;;; checkdoc.el ends here diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 0d6716a2e63..301947f0735 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -572,8 +572,6 @@ BODY is executed after moving to the destination location." (when was-narrowed (,narrowfun))))))) (unless name (setq name base-name)) `(progn - (add-to-list 'debug-ignored-errors - ,(concat "^No \\(previous\\|next\\) " (regexp-quote name))) (defun ,next-sym (&optional count) ,(format "Go to the next COUNT'th %s." name) (interactive "p") @@ -584,7 +582,7 @@ BODY is executed after moving to the destination location." `(if (not (re-search-forward ,re nil t count)) (if (looking-at ,re) (goto-char (or ,(if endfun `(,endfun)) (point-max))) - (error "No next %s" ,name)) + (user-error "No next %s" ,name)) (goto-char (match-beginning 0)) (when (and (eq (current-buffer) (window-buffer (selected-window))) (called-interactively-p 'interactive)) @@ -603,7 +601,7 @@ BODY is executed after moving to the destination location." (if (< count 0) (,next-sym (- count)) ,(funcall when-narrowed `(unless (re-search-backward ,re nil t count) - (error "No previous %s" ,name))) + (user-error "No previous %s" ,name))) ,@body)) (put ',prev-sym 'definition-name ',base)))) diff --git a/lisp/files.el b/lisp/files.el index ee455f4bf42..dd80ce69811 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4497,7 +4497,7 @@ Before and after saving the buffer, this function runs (format "%s has changed since visited or saved. Save anyway? " (file-name-nondirectory buffer-file-name))) - (error "Save not confirmed")) + (user-error "Save not confirmed")) (save-restriction (widen) (save-excursion @@ -5364,7 +5364,7 @@ non-nil, it is called instead of rereading visited file contents." (insert-file-contents file-name nil) (set-buffer-file-coding-system coding-system)) (after-find-file nil nil t)) - (t (error "Recover-file cancelled"))))) + (t (user-error "Recover-file cancelled"))))) (defun recover-session () "Recover auto save files from a previous Emacs session. diff --git a/lisp/imenu.el b/lisp/imenu.el index 12ac3540925..feebb96d379 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -579,7 +579,7 @@ See `imenu--index-alist' for the format of the index alist." (funcall imenu-create-index-function)))) (imenu--truncate-items imenu--index-alist))) (or imenu--index-alist noerror - (error "No items suitable for an index found in this buffer")) + (user-error "No items suitable for an index found in this buffer")) (or imenu--index-alist (setq imenu--index-alist (list nil))) ;; Add a rescan option to the index. @@ -695,7 +695,7 @@ The alternate method, which is the one most often used, is to call ((and imenu-generic-expression) (imenu--generic-function imenu-generic-expression)) (t - (error "This buffer cannot use `imenu-default-create-index-function'")))) + (user-error "This buffer cannot use `imenu-default-create-index-function'")))) ;;; ;;; Generic index gathering function. @@ -968,8 +968,8 @@ See the command `imenu' for more information." `(menu-item ,name ,(make-sparse-keymap "Imenu"))) (use-local-map newmap) (add-hook 'menu-bar-update-hook 'imenu-update-menubar))) - (error "The mode `%s' does not support Imenu" - (format-mode-line mode-name)))) + (user-error "The mode `%s' does not support Imenu" + (format-mode-line mode-name)))) ;;;###autoload (defun imenu-add-menubar-index () @@ -1058,12 +1058,6 @@ for more information." (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) -(dolist (mess - '("^No items suitable for an index found in this buffer$" - "^This buffer cannot use `imenu-default-create-index-function'$" - "^The mode `.*' does not support Imenu$")) - (add-to-list 'debug-ignored-errors mess)) - (provide 'imenu) ;;; imenu.el ends here diff --git a/lisp/info.el b/lisp/info.el index 042ff158362..1e3b14632e6 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1071,7 +1071,7 @@ a case-insensitive match is tried." (throw 'foo t)) ;; No such anchor in tag table or node in tag table or file - (error "No such node or anchor: %s" nodename)) + (user-error "No such node or anchor: %s" nodename)) (Info-select-node) (goto-char (point-min)) @@ -2012,8 +2012,8 @@ if ERRORNAME is nil, just return nil." (concat name ":" (Info-following-node-name-re)) bound t) (match-string-no-properties 1)) ((not (eq errorname t)) - (error "Node has no %s" - (capitalize (or errorname name))))))))) + (user-error "Node has no %s" + (capitalize (or errorname name))))))))) (defun Info-following-node-name-re (&optional allowedchars) "Return a regexp matching a node name. @@ -2082,7 +2082,7 @@ If SAME-FILE is non-nil, do not move to a different Info file." "Go back in the history to the last node visited." (interactive) (or Info-history - (error "This is the first Info node you looked at")) + (user-error "This is the first Info node you looked at")) (let ((history-forward (cons (list Info-current-file Info-current-node (point)) Info-history-forward)) @@ -2102,7 +2102,7 @@ If SAME-FILE is non-nil, do not move to a different Info file." "Go forward in the history of visited nodes." (interactive) (or Info-history-forward - (error "This is the last Info node you looked at")) + (user-error "This is the last Info node you looked at")) (let ((history-forward (cdr Info-history-forward)) filename nodename opoint) (setq filename (car (car Info-history-forward))) @@ -2388,7 +2388,7 @@ new buffer." completions nil t))) (list (if (equal input "") default input) current-prefix-arg)) - (error "No cross-references in this node")))) + (user-error "No cross-references in this node")))) (unless footnotename (error "No reference was specified")) @@ -2419,7 +2419,8 @@ new buffer." (abs (- prev-ref (point)))) next-ref prev-ref)) ((or next-ref prev-ref)) - ((error "No cross-reference named %s" footnotename)))) + ((user-error "No cross-reference named %s" + footnotename)))) (setq target (Info-extract-menu-node-name t)))) (while (setq i (string-match "[ \t\n]+" target i)) (setq target (concat (substring target 0 i) " " @@ -2564,7 +2565,7 @@ new buffer." (save-excursion (goto-char (point-min)) (if (not (search-forward "\n* menu:" nil t)) - (error "No menu in this node")) + (user-error "No menu in this node")) (setq beg (point)) (and (< (point) p) (save-excursion @@ -2605,10 +2606,10 @@ new buffer." (let ((case-fold-search t)) (goto-char (point-min)) (or (search-forward "\n* menu:" nil t) - (error "No menu in this node")) + (user-error "No menu in this node")) (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t) (re-search-forward (concat "\n\\* +" menu-item) nil t) - (error "No such item in menu")) + (user-error "No such item in menu")) (beginning-of-line) (forward-char 2) (Info-extract-menu-node-name nil (Info-index-node)))))) @@ -2624,7 +2625,7 @@ new buffer." (match-beginning 0)))) (goto-char (point-min)) (or (search-forward "\n* menu:" bound t) - (error "No menu in this node")) + (user-error "No menu in this node")) (if count (or (search-forward "\n* " bound t count) (error "Too few items in menu")) @@ -2696,7 +2697,7 @@ N is the digit argument used to invoke this command." (if Info-history-skip-intermediate-nodes (setq Info-history old-history))))) (no-error nil) - (t (error "No pointer forward from this node"))))) + (t (user-error "No pointer forward from this node"))))) (defun Info-backward-node () "Go backward one node, considering all nodes as forming one sequence." @@ -2705,7 +2706,7 @@ N is the digit argument used to invoke this command." (upnode (Info-extract-pointer "up" t)) (case-fold-search t)) (cond ((and upnode (string-match "(" upnode)) - (error "First node in file")) + (user-error "First node in file")) ((and upnode (or (null prevnode) ;; Use string-equal, not equal, ;; to ignore text properties. @@ -2723,7 +2724,7 @@ N is the digit argument used to invoke this command." (if Info-history-skip-intermediate-nodes (setq Info-history old-history)))) (t - (error "No pointer backward from this node"))))) + (user-error "No pointer backward from this node"))))) (defun Info-exit () "Exit Info by selecting some other buffer." @@ -2744,7 +2745,7 @@ N is the digit argument used to invoke this command." (and (search-forward "\n* " nil t) (Info-extract-menu-node-name))))) (if node (Info-goto-node node) - (error "No more items in menu")))) + (user-error "No more items in menu")))) (defun Info-last-menu-item () "Go to the node of the previous menu item." @@ -2757,7 +2758,7 @@ N is the digit argument used to invoke this command." (and (search-backward "\n* menu:" nil t) (point))))) (or (and beg (search-backward "\n* " beg t)) - (error "No previous items in menu"))) + (user-error "No previous items in menu"))) (Info-goto-node (save-excursion (goto-char (match-end 0)) (Info-extract-menu-node-name))))) @@ -2782,7 +2783,7 @@ N is the digit argument used to invoke this command." (if Info-history-skip-intermediate-nodes (setq Info-history old-history)))) (t - (error "No more nodes")))) + (user-error "No more nodes")))) (defun Info-last-preorder () "Go to the last node, popping up a level if there is none." @@ -2822,7 +2823,7 @@ N is the digit argument used to invoke this command." (let ((case-fold-search t)) (or (search-forward "\n* Menu:" nil t) (goto-char (point-max))))) - (t (error "No previous nodes")))) + (t (user-error "No previous nodes")))) (defun Info-scroll-up () "Scroll one screenful forward in Info, considering all nodes as one sequence. @@ -2911,11 +2912,11 @@ See `Info-scroll-down'." (or (re-search-forward pat nil t) (progn (goto-char old-pt) - (error "No cross references in this node"))))) + (user-error "No cross references in this node"))))) (goto-char (or (match-beginning 1) (match-beginning 0))) (if (looking-at "\\* Menu:") (if recur - (error "No cross references in this node") + (user-error "No cross references in this node") (Info-next-reference t)) (if (looking-at "^\\* ") (forward-char 2))))) @@ -2932,11 +2933,11 @@ See `Info-scroll-down'." (or (re-search-backward pat nil t) (progn (goto-char old-pt) - (error "No cross references in this node"))))) + (user-error "No cross references in this node"))))) (goto-char (or (match-beginning 1) (match-beginning 0))) (if (looking-at "\\* Menu:") (if recur - (error "No cross references in this node") + (user-error "No cross references in this node") (Info-prev-reference t)) (if (looking-at "^\\* ") (forward-char 2))))) @@ -3107,7 +3108,7 @@ Give an empty topic name to go to the Index node itself." (or matches (progn (Info-goto-node orignode) - (error "No `%s' in index" topic))) + (user-error "No `%s' in index" topic))) ;; Here it is a feature that assoc is case-sensitive. (while (setq found (assoc topic matches)) (setq exact (cons found exact) @@ -3120,7 +3121,7 @@ Give an empty topic name to go to the Index node itself." "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command." (interactive "p") (or Info-index-alternatives - (error "No previous `i' command")) + (user-error "No previous `i' command")) (while (< num 0) (setq num (+ num (length Info-index-alternatives)))) (while (> num 0) @@ -3640,7 +3641,7 @@ If FORK is a string, it is the name to use for the new buffer." ;; Don't raise an error when mouse-1 is bound to this - it's ;; often used to simply select the window or frame. (eq 'mouse-1 (event-basic-type last-input-event))) - (error "Point neither on reference nor in menu item description"))) + (user-error "Point neither on reference nor in menu item description"))) ;; Common subroutine. (defun Info-try-follow-nearest-node (&optional fork) @@ -3907,7 +3908,7 @@ The name of the Info file is prepended to the node name in parentheses. With a zero prefix arg, put the name inside a function call to `info'." (interactive "P") (unless Info-current-node - (error "No current Info node")) + (user-error "No current Info node")) (let ((node (if (stringp Info-current-file) (concat "(" (file-name-nondirectory Info-current-file) ") " Info-current-node)))) @@ -4899,25 +4900,8 @@ BUFFER is the buffer speedbar is requesting buttons for." (erase-buffer)) (Info-speedbar-hierarchy-buttons nil 0)) -(dolist (mess '("^First node in file$" - "^No `.*' in index$" - "^No cross-reference named" - "^No cross.references in this node$" - "^No current Info node$" - "^No menu in this node$" - "^No more items in menu$" - "^No more nodes$" - "^No pointer \\(?:forward\\|backward\\) from this node$" - "^No previous `i' command$" - "^No previous items in menu$" - "^No previous nodes$" - "^No such item in menu$" - "^No such node or anchor" - "^Node has no" - "^Point neither on reference nor in menu item description$" - "^This is the \\(?:first\\|last\\) Info node you looked at$" - search-failed)) - (add-to-list 'debug-ignored-errors mess)) +;; FIXME: Really? Why here? +(add-to-list 'debug-ignored-errors 'search-failed) ;;;; Desktop support diff --git a/lisp/man.el b/lisp/man.el index 6912486dffa..dd64613c495 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1273,8 +1273,8 @@ manpage command." (if (not Man-page-list) (let ((args Man-arguments)) (kill-buffer (current-buffer)) - (error "Can't find the %s manpage" - (Man-page-from-arguments args))) + (user-error "Can't find the %s manpage" + (Man-page-from-arguments args))) (set-buffer-modified-p nil)))) ;; Restore case-fold-search before calling ;; Man-notify-when-ready because it may switch buffers. @@ -1649,7 +1649,7 @@ Specify which REFERENCE to use; default is based on word at point." (when Man-page-list (if (or (< page 1) (> page (length Man-page-list))) - (error "No manpage %d found" page)) + (user-error "No manpage %d found" page)) (let* ((page-range (nth (1- page) Man-page-list)) (page-start (car page-range)) (page-end (car (cdr page-range)))) @@ -1742,9 +1742,6 @@ Uses `Man-name-local-regexp'." ;; Init the man package variables, if not already done. (Man-init-defvars) -(add-to-list 'debug-ignored-errors "^No manpage [0-9]* found$") -(add-to-list 'debug-ignored-errors "^Can't find the .* manpage$") - (provide 'man) ;;; man.el ends here diff --git a/lisp/mouse.el b/lisp/mouse.el index 46e50ed9508..f40a0199525 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -298,7 +298,7 @@ Use the former if the menu bar is showing, otherwise the latter." (let ((w (posn-window (event-start event)))) (and (window-minibuffer-p w) (not (minibuffer-window-active-p w)) - (error "Minibuffer window is not active"))) + (user-error "Minibuffer window is not active"))) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook)) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 2608ba0b0c3..f22ee4f7ea5 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2132,14 +2132,14 @@ and runs `compilation-filter-hook'." (if (or (eq (get-text-property ,limit 'compilation-message) (get-text-property opt 'compilation-message)) (eq pt opt)) - (error ,error compilation-error) + (user-error ,error compilation-error) (setq pt ,limit))) ;; prop 'compilation-message usually has 2 changes, on and off, so ;; re-search if off (or (setq msg (get-text-property pt 'compilation-message)) (if (setq pt (,property-change pt 'compilation-message nil ,limit)) (setq msg (get-text-property pt 'compilation-message))) - (error ,error compilation-error)) + (user-error ,error compilation-error)) (or (< (compilation--message->type msg) compilation-skip-threshold) (if different-file (eq (prog1 last @@ -2660,9 +2660,6 @@ The file-structure looks like this: (if (eq v fs) (remhash k compilation-locs))) compilation-locs))) -(add-to-list 'debug-ignored-errors "\\`No more [-a-z ]+s yet\\'") -(add-to-list 'debug-ignored-errors "\\`Moved past last .*") - ;;; Compatibility with the old compile.el. (defvaralias 'compilation-last-buffer 'next-error-last-buffer) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 638410ae627..2664b51eea9 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -554,11 +554,10 @@ Returns t if it visits a tags table, or nil if there are no more in the list." (cond ((eq cont 'same) ;; Use the ambient value of tags-file-name. (or tags-file-name - (error "%s" - (substitute-command-keys - (concat "No tags table in use; " - "use \\[visit-tags-table] to select one"))))) - + (user-error "%s" + (substitute-command-keys + (concat "No tags table in use; " + "use \\[visit-tags-table] to select one"))))) ((eq t cont) ;; Find the next table. (if (tags-next-table) @@ -566,7 +565,6 @@ Returns t if it visits a tags table, or nil if there are no more in the list." (while (and (not (or (get-file-buffer tags-file-name) (file-exists-p tags-file-name))) (tags-next-table))))) - (t ;; Pick a table out of our hat. (tags-table-check-computed-list) ;Get it up to date, we might use it. @@ -706,7 +704,8 @@ Returns t if it visits a tags table, or nil if there are no more in the list." (kill-local-variable 'tags-file-name) (if (eq local-tags-file-name tags-file-name) (setq tags-file-name nil)) - (error "File %s is not a valid tags table" local-tags-file-name))))) + (user-error "File %s is not a valid tags table" + local-tags-file-name))))) (defun tags-reset-tags-tables () "Reset tags state to cancel effect of any previous \\[visit-tags-table] or \\[find-tag]." @@ -831,7 +830,7 @@ If no tags table is loaded, do nothing and return nil." (tags-lazy-completion-table) nil nil nil nil default))) (if (equal spec "") - (or default (error "There is no default tag")) + (or default (user-error "There is no default tag")) spec))) (defvar last-tag nil @@ -886,7 +885,7 @@ See documentation of variable `tags-file-name'." (if (eq '- next-p) ;; Pop back to a previous location. (if (ring-empty-p tags-location-ring) - (error "No previous tag locations") + (user-error "No previous tag locations") (let ((marker (ring-remove tags-location-ring 0))) (prog1 ;; Move to the saved location. @@ -1150,8 +1149,8 @@ error message." (set-marker (car tag-lines-already-matched) nil nil) (setq tag-lines-already-matched (cdr tag-lines-already-matched))) (set-marker match-marker nil nil) - (error "No %stags %s %s" (if first-search "" "more ") - matching pattern)) + (user-error "No %stags %s %s" (if first-search "" "more ") + matching pattern)) ;; Found a tag; extract location info. (beginning-of-line) @@ -1391,8 +1390,8 @@ hits the start of file." offset (* 3 offset))) ; expand search window (or found (re-search-forward pat nil t) - (error "Rerun etags: `%s' not found in %s" - pat buffer-file-name))) + (user-error "Rerun etags: `%s' not found in %s" + pat buffer-file-name))) ;; Position point at the right place ;; if the search string matched an extra Ctrl-m at the beginning. (and (eq selective-display t) @@ -1742,7 +1741,7 @@ if the file was newly read in, the value is the filename." (and novisit (get-buffer " *next-file*") (kill-buffer " *next-file*")) - (error "All files processed")) + (user-error "All files processed")) (let* ((next (car next-file-list)) (buffer (get-file-buffer next)) (new (not buffer))) @@ -1775,9 +1774,9 @@ if the file was newly read in, the value is the filename." "Form for `tags-loop-continue' to eval to change one file.") (defvar tags-loop-scan - '(error "%s" - (substitute-command-keys - "No \\[tags-search] or \\[tags-query-replace] in progress")) + '(user-error "%s" + (substitute-command-keys + "No \\[tags-search] or \\[tags-query-replace] in progress")) "Form for `tags-loop-continue' to eval to scan one file. If it returns non-nil, this file needs processing by evalling \`tags-loop-operate'. Otherwise, move on to the next file.") @@ -1937,7 +1936,7 @@ directory specification." (if (funcall list-tags-function file) (setq gotany t))) (or gotany - (error "File %s not in current tags tables" file))))) + (user-error "File %s not in current tags tables" file))))) (with-current-buffer "*Tags List*" (require 'apropos) (with-no-warnings @@ -2067,28 +2066,15 @@ for \\[find-tag] (which see)." (interactive) (or tags-table-list tags-file-name - (error "%s" - (substitute-command-keys - "No tags table loaded; try \\[visit-tags-table]"))) + (user-error "%s" + (substitute-command-keys + "No tags table loaded; try \\[visit-tags-table]"))) (let ((comp-data (tags-completion-at-point-function))) (if (null comp-data) - (error "Nothing to complete") + (user-error "Nothing to complete") (completion-in-region (car comp-data) (cadr comp-data) (nth 2 comp-data) (plist-get (nthcdr 3 comp-data) :predicate))))) - -(dolist (x '("^No tags table in use; use .* to select one$" - "^There is no default tag$" - "^No previous tag locations$" - "^File .* is not a valid tags table$" - "^No \\(more \\|\\)tags \\(matching\\|containing\\) " - "^Rerun etags: `.*' not found in " - "^All files processed$" - "^No .* or .* in progress$" - "^File .* not in current tags tables$" - "^No tags table loaded" - "^Nothing to complete$")) - (add-to-list 'debug-ignored-errors x)) (provide 'etags) diff --git a/lisp/simple.el b/lisp/simple.el index 3d8a3a38dbd..2b7d5580ba2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1465,7 +1465,7 @@ See also `minibuffer-history-case-insensitive-variables'." (list (if (string= regexp "") (if minibuffer-history-search-history (car minibuffer-history-search-history) - (error "No previous history search regexp")) + (user-error "No previous history search regexp")) regexp) (prefix-numeric-value current-prefix-arg)))) (unless (zerop n) @@ -1491,9 +1491,9 @@ See also `minibuffer-history-case-insensitive-variables'." (setq prevpos pos) (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history))) (when (= pos prevpos) - (error (if (= pos 1) - "No later matching history item" - "No earlier matching history item"))) + (user-error (if (= pos 1) + "No later matching history item" + "No earlier matching history item"))) (setq match-string (if (eq minibuffer-history-sexp-flag (minibuffer-depth)) (let ((print-level nil)) @@ -1536,7 +1536,7 @@ makes the search case-sensitive." (list (if (string= regexp "") (if minibuffer-history-search-history (car minibuffer-history-search-history) - (error "No previous history search regexp")) + (user-error "No previous history search regexp")) regexp) (prefix-numeric-value current-prefix-arg)))) (previous-matching-history-element regexp (- n))) @@ -1595,11 +1595,11 @@ The argument NABS specifies the absolute history position." (setq minibuffer-text-before-history (minibuffer-contents-no-properties))) (if (< nabs minimum) - (if minibuffer-default - (error "End of defaults; no next item") - (error "End of history; no default available"))) + (user-error (if minibuffer-default + "End of defaults; no next item" + "End of history; no default available"))) (if (> nabs (length (symbol-value minibuffer-history-variable))) - (error "Beginning of history; no preceding item")) + (user-error "Beginning of history; no preceding item")) (unless (memq last-command '(next-history-element previous-history-element)) (let ((prompt-end (minibuffer-prompt-end))) @@ -1945,8 +1945,8 @@ Some change-hooks test this variable to do something different.") Call `undo-start' to get ready to undo recent changes, then call `undo-more' one or more times to undo them." (or (listp pending-undo-list) - (error (concat "No further undo information" - (and undo-in-region " for region")))) + (user-error (concat "No further undo information" + (and undo-in-region " for region")))) (let ((undo-in-progress t)) ;; Note: The following, while pulling elements off ;; `pending-undo-list' will call primitive change functions which @@ -1972,7 +1972,7 @@ If BEG and END are specified, then only undo elements that apply to text between BEG and END are used; other undo elements are ignored. If BEG and END are nil, all undo elements are used." (if (eq buffer-undo-list t) - (error "No undo information in this buffer")) + (user-error "No undo information in this buffer")) (setq pending-undo-list (if (and beg end (not (= beg end))) (undo-make-selective-list (min beg end) (max beg end)) @@ -3244,10 +3244,6 @@ move the yanking point; just return the Nth kill forward." :type 'boolean :group 'killing) -(put 'text-read-only 'error-conditions - '(text-read-only buffer-read-only error)) -(put 'text-read-only 'error-message (purecopy "Text is read-only")) - (defun kill-region (beg end &optional yank-handler) "Kill (\"cut\") text between point and mark. This deletes the text from the buffer and saves it in the kill ring. diff --git a/lisp/subr.el b/lisp/subr.el index 1f9f3aee9fa..8cfb1eeea16 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -274,6 +274,17 @@ for the sake of consistency." (signal 'error (list (apply 'format args))))) (set-advertised-calling-convention 'error '(string &rest args) "23.1") +(defun user-error (format &rest args) + "Signal a pilot error, making error message by passing all args to `format'. +In Emacs, the convention is that error messages start with a capital +letter but *do not* end with a period. Please follow this convention +for the sake of consistency. +This is just like `error' except that `user-error's are expected to be the +result of an incorrect manipulation on the part of the user, rather than the +result of an actual problem." + (while t + (signal 'user-error (list (apply #'format format args))))) + ;; We put this here instead of in frame.el so that it's defined even on ;; systems where frame.el isn't loaded. (defun frame-configuration-p (object) diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index d2881b40ad0..3db1f669d63 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -342,12 +342,11 @@ Can be nil if the style is undecided, or else: )))) (defvar smerge-resolve-function - (lambda () (error "Don't know how to resolve")) + (lambda () (user-error "Don't know how to resolve")) "Mode-specific merge function. The function is called with zero or one argument (non-nil if the resolution function should only apply safe heuristics) and with the match data set according to `smerge-match-conflict'.") -(add-to-list 'debug-ignored-errors "Don't know how to resolve") (defvar smerge-text-properties `(help-echo "merge conflict: mouse-3 shows a menu" @@ -626,7 +625,7 @@ major modes. Uses `smerge-resolve-function' to do the actual work." (set-match-data md) (smerge-keep-n choice)) (t - (error "Don't know how to resolve")))) + (user-error "Don't know how to resolve")))) (if (buffer-name buf) (kill-buffer buf)) (if m (delete-file m)) (if b (delete-file b)) @@ -810,9 +809,7 @@ An error is raised if not inside a conflict." (when base-start (1- base-start)) base-start (1- other-start) other-start)) t) - (search-failed (error "Point not in conflict region"))))) - -(add-to-list 'debug-ignored-errors "Point not in conflict region") + (search-failed (user-error "Point not in conflict region"))))) (defun smerge-conflict-overlay (pos) "Return the conflict overlay at POS if any." diff --git a/lisp/window.el b/lisp/window.el index 9557dbf057e..a650c5602ba 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5094,11 +5094,11 @@ Return the buffer switched to." ((eq buffer (window-buffer))) ((window-minibuffer-p) (if force-same-window - (error "Cannot switch buffers in minibuffer window") + (user-error "Cannot switch buffers in minibuffer window") (pop-to-buffer buffer norecord))) ((eq (window-dedicated-p) t) (if force-same-window - (error "Cannot switch buffers in a dedicated window") + (user-error "Cannot switch buffers in a dedicated window") (pop-to-buffer buffer norecord))) (t (set-window-buffer nil buffer))) |