From: Kelly Dean Date: Wed, 18 Feb 2015 07:35:49 +0000 (+0000) Subject: Use user-error where error is inappropriate X-Git-Tag: emacs-25.0.90~2564^2~355 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=72f7eded979c672662112304cc8615c0dbcf9803;p=emacs.git Use user-error where error is inappropriate * help-mode.el (help-go-back, help-go-forward, help-follow): * simple.el (yank-pop, pop-to-mark-command, exchange-point-and-mark): * winner.el (winner-redo): * windmove.el (windmove-do-window-select): * register.el (jump-to-register, increment-register, insert-register) (append-to-register, prepend-to-register): * files.el (find-alternate-file, abort-if-file-too-large, write-file) (set-visited-file-name): * emacs-lisp/lisp.el (kill-backward-up-list): Use user-error instead of error. (Bug#14480) --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6831508471..73e139657bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2015-02-18 Kelly Dean + + * help-mode.el (help-go-back, help-go-forward, help-follow): + * simple.el (yank-pop, pop-to-mark-command, exchange-point-and-mark): + * winner.el (winner-redo): + * windmove.el (windmove-do-window-select): + * register.el (jump-to-register, increment-register, insert-register) + (append-to-register, prepend-to-register): + * files.el (find-alternate-file, abort-if-file-too-large, write-file) + (set-visited-file-name): + * emacs-lisp/lisp.el (kill-backward-up-list): + Use user-error instead of error. (Bug#14480) + 2015-02-18 Stefan Monnier * emacs-lisp/checkdoc.el (checkdoc-show-diagnostics): Don't make bogus @@ -5,7 +18,7 @@ 2015-02-16 Kelly Dean - * lisp/files.el (insert-file-contents-literally): Fix docstring typo. + * files.el (insert-file-contents-literally): Fix docstring typo. 2015-02-16 Kelly Dean diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 214bed7622d..fb631a73da1 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -263,7 +263,7 @@ This command assumes point is not in a string or comment." (backward-up-list arg) (kill-sexp) (insert current-sexp)) - (error "Not at a sexp")))) + (user-error "Not at a sexp")))) (defvar beginning-of-defun-function nil "If non-nil, function for `beginning-of-defun-raw' to call. diff --git a/lisp/files.el b/lisp/files.el index 83369792fe7..1914ad8814c 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1628,10 +1628,10 @@ killed." (confirm-nonexistent-file-or-buffer) file-name) t))) (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions) - (error "Aborted")) + (user-error "Aborted")) (and (buffer-modified-p) buffer-file-name (not (yes-or-no-p "Kill and replace the buffer without saving it? ")) - (error "Aborted")) + (user-error "Aborted")) (let ((obuf (current-buffer)) (ofile buffer-file-name) (onum buffer-file-number) @@ -1844,7 +1844,7 @@ OP-TYPE specifies the file operation being performed (for message to user)." (not (y-or-n-p (format "File %s is large (%s), really %s? " (file-name-nondirectory filename) (file-size-human-readable size) op-type)))) - (error "Aborted"))) + (user-error "Aborted"))) (defun warn-maybe-out-of-memory (size) "Warn if an attempt to open file of SIZE bytes may run out of memory." @@ -3883,7 +3883,7 @@ the old visited file has been renamed to the new name FILENAME." (not no-query) (not (y-or-n-p (format "A buffer is visiting %s; proceed? " filename))) - (error "Aborted"))) + (user-error "Aborted"))) (or (equal filename buffer-file-name) (progn (and filename (lock-buffer filename)) @@ -4007,7 +4007,7 @@ Interactively, confirmation is required unless you supply a prefix argument." (listp last-nonmenu-event) use-dialog-box)) (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) - (error "Canceled"))) + (user-error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) ;; Make buffer writable if file is writable. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index b8b129dbc4a..d6679e9e4de 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -724,14 +724,14 @@ BUFFER or FRAME." (interactive) (if help-xref-stack (help-xref-go-back (current-buffer)) - (error "No previous help buffer"))) + (user-error "No previous help buffer"))) (defun help-go-forward () "Go back to next topic in this help buffer." (interactive) (if help-xref-forward-stack (help-xref-go-forward (current-buffer)) - (error "No next help buffer"))) + (user-error "No next help buffer"))) (defun help-do-xref (_pos function args) "Call the help cross-reference function FUNCTION with args ARGS. @@ -754,7 +754,7 @@ a proper [back] button." For the cross-reference format, see `help-make-xrefs'." (interactive) - (error "No cross-reference here")) + (user-error "No cross-reference here")) (defun help-follow-symbol (&optional pos) "In help buffer, show docs for symbol at POS, defaulting to point. diff --git a/lisp/register.el b/lisp/register.el index a60181e43c6..053657bd8cb 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -252,7 +252,7 @@ Interactively, reads the register using `register-read-with-preview'." (goto-char (cadr val))) ((markerp val) (or (marker-buffer val) - (error "That register's buffer no longer exists")) + (user-error "That register's buffer no longer exists")) (switch-to-buffer (marker-buffer val)) (goto-char val)) ((and (consp val) (eq (car val) 'file)) @@ -260,11 +260,11 @@ Interactively, reads the register using `register-read-with-preview'." ((and (consp val) (eq (car val) 'file-query)) (or (find-buffer-visiting (nth 1 val)) (y-or-n-p (format "Visit file %s again? " (nth 1 val))) - (error "Register access aborted")) + (user-error "Register access aborted")) (find-file (nth 1 val)) (goto-char (nth 2 val))) (t - (error "Register doesn't contain a buffer position or configuration"))))) + (user-error "Register doesn't contain a buffer position or configuration"))))) (defun register-swap-out () "Turn markers into file-query references when a buffer is killed." @@ -316,7 +316,7 @@ Interactively, reads the register using `register-read-with-preview'." (set-register register (+ number register-val)))) ((or (not register-val) (stringp register-val)) (append-to-register register (region-beginning) (region-end) prefix)) - (t (error "Register does not contain a number or text"))))) + (t (user-error "Register does not contain a number or text"))))) (defun view-register (register) "Display what is contained in register named REGISTER. @@ -449,7 +449,7 @@ Interactively, reads the register using `register-read-with-preview'." ((and (markerp val) (marker-position val)) (princ (marker-position val) (current-buffer))) (t - (error "Register does not contain text")))) + (user-error "Register does not contain text")))) (if (not arg) (exchange-point-and-mark))) (defun copy-to-register (register start end &optional delete-flag region) @@ -492,7 +492,7 @@ Interactively, reads the register using `register-read-with-preview'." (set-register register (cond ((not reg) text) ((stringp reg) (concat reg separator text)) - (t (error "Register does not contain text"))))) + (t (user-error "Register does not contain text"))))) (setq deactivate-mark t) (cond (delete-flag (delete-region start end)) @@ -516,7 +516,7 @@ Interactively, reads the register using `register-read-with-preview'." (set-register register (cond ((not reg) text) ((stringp reg) (concat text separator reg)) - (t (error "Register does not contain text"))))) + (t (user-error "Register does not contain text"))))) (setq deactivate-mark t) (cond (delete-flag (delete-region start end)) diff --git a/lisp/simple.el b/lisp/simple.el index 967fbc69cbc..b78286dc83b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4326,7 +4326,7 @@ When this command inserts killed text into the buffer, it honors doc string for `insert-for-yank-1', which see." (interactive "*p") (if (not (eq last-command 'yank)) - (error "Previous command was not a yank")) + (user-error "Previous command was not a yank")) (setq this-command 'yank) (unless arg (setq arg 1)) (let ((inhibit-read-only t) @@ -4958,7 +4958,7 @@ Start discarding off end if gets this big." \(Does not affect global mark ring)." (interactive) (if (null (mark t)) - (error "No mark set in this buffer") + (user-error "No mark set in this buffer") (if (= (point) (mark t)) (message "Mark popped")) (goto-char (mark t)) @@ -5107,7 +5107,7 @@ mode temporarily." (let ((omark (mark t)) (temp-highlight (eq (car-safe transient-mark-mode) 'only))) (if (null omark) - (error "No mark set in this buffer")) + (user-error "No mark set in this buffer")) (set-mark (point)) (goto-char omark) (cond (temp-highlight diff --git a/lisp/windmove.el b/lisp/windmove.el index d857dfc98dd..c461a00740a 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -479,10 +479,10 @@ DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'. If no window is at direction DIR, an error is signaled." (let ((other-window (windmove-find-other-window dir arg window))) (cond ((null other-window) - (error "No window %s from selected window" dir)) + (user-error "No window %s from selected window" dir)) ((and (window-minibuffer-p other-window) (not (minibuffer-window-active-p other-window))) - (error "Minibuffer is inactive")) + (user-error "Minibuffer is inactive")) (t (select-window other-window))))) diff --git a/lisp/winner.el b/lisp/winner.el index f244003b066..fdf62137514 100644 --- a/lisp/winner.el +++ b/lisp/winner.el @@ -415,7 +415,7 @@ In other words, \"undo\" changes in window configuration." (ring-ref winner-pending-undo-ring 0))) (unless (eq (selected-window) (minibuffer-window)) (message "Winner undid undo"))) - (t (error "Previous command was not a `winner-undo'")))) + (t (user-error "Previous command was not a `winner-undo'")))) (provide 'winner) ;;; winner.el ends here