aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Fischer <frank-fischer@shadow-soft.de>2014-10-25 22:06:10 +0200
committerFrank Fischer <frank-fischer@shadow-soft.de>2014-10-25 22:06:10 +0200
commitd0a41bd516b103df724540e4f08603515477a372 (patch)
tree84cc4d621f45fc10818e13720715bfeb1657f4d4
parent86954af17bcc686de589ff5a76e2018326c00a07 (diff)
replace `error` with `user-error` where appropriate
-rw-r--r--evil-command-window.el4
-rw-r--r--evil-commands.el42
-rw-r--r--evil-common.el34
-rw-r--r--evil-ex.el10
-rw-r--r--evil-repeat.el4
-rw-r--r--evil-search.el14
-rw-r--r--evil-types.el2
7 files changed, 55 insertions, 55 deletions
diff --git a/evil-command-window.el b/evil-command-window.el
index dafa984..bef885a 100644
--- a/evil-command-window.el
+++ b/evil-command-window.el
@@ -48,7 +48,7 @@ the key whose history is being shown (one of \":\", \"/\", or
\"?\"). EXECUTE-FN should be a function of one argument to
execute on the result that the user selects."
(when (eq major-mode 'evil-command-window-mode)
- (error "Cannot recursively open command line window"))
+ (user-error "Cannot recursively open command line window"))
(mapc #'(lambda (win)
(when (equal (buffer-name (window-buffer win))
"*Command Line*")
@@ -87,7 +87,7 @@ function to execute."
(command-window (get-buffer-window)))
(select-window (previous-window))
(unless (equal evil-command-window-current-buffer (current-buffer))
- (error "Originating buffer is no longer active"))
+ (user-error "Originating buffer is no longer active"))
(kill-buffer "*Command Line*")
(delete-window command-window)
(funcall execute-fn result)
diff --git a/evil-commands.el b/evil-commands.el
index 34a8a6c..022d00b 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -516,7 +516,7 @@ and jump to the corresponding one."
(state (syntax-ppss (point))))
(if (not (evil-in-string-p))
;; no, then we really failed
- (error "No matching item found on the current line")
+ (user-error "No matching item found on the current line")
;; yes, go to the end of the string and try again
(let ((endstr (evil-string-end (point) (line-end-position))))
(when (or (evil-in-string-p endstr) ; not at end of string
@@ -528,7 +528,7 @@ and jump to the corresponding one."
(error t)))
;; failed again, go back to original point
(goto-char pnt)
- (error "No matching item found on the current line"))))))
+ (user-error "No matching item found on the current line"))))))
((< open close) (goto-char open-pair))
(t (goto-char close-pair)))))))
@@ -586,7 +586,7 @@ and jump to the corresponding one."
(line-beginning-position)))
t count)
(when fwd (backward-char)))
- (error "Can't find %c" char)))))
+ (user-error "Can't find %c" char)))))
(evil-define-motion evil-find-char-backward (count char)
"Move to the previous COUNT'th occurrence of CHAR."
@@ -639,7 +639,7 @@ and jump to the corresponding one."
(funcall cmd (if fwd count (- count)) char)
(unless (nth 2 evil-last-find)
(setq evil-this-type 'exclusive)))
- (error "No previous search")))
+ (user-error "No previous search")))
(evil-define-motion evil-repeat-find-char-reverse (count)
"Repeat the last find COUNT times in the opposite direction."
@@ -674,9 +674,9 @@ Columns are counted from zero."
(find-file (car marker))))
(goto-char (cdr marker))))
((not noerror)
- (error "Marker `%c' is not set%s" char
- (if (evil-global-marker-p char) ""
- " in this buffer"))))))
+ (user-error "Marker `%c' is not set%s" char
+ (if (evil-global-marker-p char) ""
+ " in this buffer"))))))
(evil-define-command evil-goto-mark-line (char &optional noerror)
"Go to the line of the marker specified by CHAR."
@@ -1165,7 +1165,7 @@ or line COUNT to the top of the window."
"Select next match."
(unless (and (boundp 'evil-search-module)
(eq evil-search-module 'evil-search))
- (error "next-match text objects only work with Evil search module."))
+ (user-error "next-match text objects only work with Evil search module."))
(let ((pnt (point)))
(cond
((eq evil-ex-search-direction 'forward)
@@ -1184,7 +1184,7 @@ or line COUNT to the top of the window."
"Select next match."
(unless (and (boundp 'evil-search-module)
(eq evil-search-module 'evil-search))
- (error "previous-match text objects only work with Evil search module."))
+ (user-error "previous-match text objects only work with Evil search module."))
(let ((evil-ex-search-direction
(if (eq evil-ex-search-direction 'backward)
'forward
@@ -1310,13 +1310,13 @@ be joined with the previous line if and only if
(interactive "p")
(if (or evil-backspace-join-lines (not (bolp)))
(call-interactively 'delete-backward-char)
- (error "Beginning of line")))
+ (user-error "Beginning of line")))
(evil-define-command evil-delete-backward-word ()
"Delete previous word."
(if (and (bolp) (not (bobp)))
(progn
- (unless evil-backspace-join-lines (error "Beginning of line"))
+ (unless evil-backspace-join-lines (user-error "Beginning of line"))
(delete-char -1))
(evil-delete (max
(save-excursion
@@ -1881,7 +1881,7 @@ when called interactively."
;; allow references to currently empty registers
;; when defining macro
(unless evil-this-macro
- (error "No previous macro")))
+ (user-error "No previous macro")))
(t
(condition-case err
(evil-with-single-undo
@@ -2403,7 +2403,7 @@ The search is unbounded, i.e., the pattern is not wrapped in
(require 'imenu)
(error nil)))
(if (null string)
- (error "No symbol under cursor")
+ (user-error "No symbol under cursor")
(setq isearch-forward t)
;; if imenu is available, try it
(cond
@@ -2508,7 +2508,7 @@ without confirmation."
(setq filename bufname))
(cond
((zerop (length filename))
- (error "Please specify a file name for the buffer"))
+ (user-error "Please specify a file name for the buffer"))
;; execute command on region
((eq (aref filename 0) ?!)
(shell-command-on-region beg end (substring filename 1)))
@@ -2734,8 +2734,8 @@ the previous shell command is executed instead."
(setq evil-previous-shell-command command))
(cond
((zerop (length command))
- (if previous (error "No previous shell command")
- (error "No shell command")))
+ (if previous (user-error "No previous shell command")
+ (user-error "No shell command")))
(evil-ex-range
(shell-command-on-region beg end command nil t)
(goto-char beg)
@@ -2827,7 +2827,7 @@ corresponding to the characters of this string are shown."
(when line
(goto-char (point-min))
(forward-line (1- line))))
- (error "File does not exist."))))
+ (user-error "File does not exist."))))
(evil-ex-define-argument-type state
"Defines an argument type which can take state names."
@@ -2867,7 +2867,7 @@ This is the state the buffer comes up in. See `evil-set-initial-state'."
(interactive "<state>")
(if (not (or (assq state evil-state-properties)
(null state)))
- (error "State %s cannot be set as initial Evil state" state)
+ (user-error "State %s cannot be set as initial Evil state" state)
(let ((current-initial-state (evil-initial-state major-mode)))
(unless (eq current-initial-state state)
;; only if we selected a new mode
@@ -2976,7 +2976,7 @@ resp. after executing the command."
(interactive "<r><s/>")
(evil-ex-nohighlight)
(unless pattern
- (error "No pattern given"))
+ (user-error "No pattern given"))
(setq replacement (or replacement ""))
(setq evil-ex-last-was-search nil)
(let* ((flags (append flags nil))
@@ -3150,9 +3150,9 @@ This is the same as :%s//~/&"
:move-point nil
(interactive "<r><g/><!>")
(unless pattern
- (error "No pattern given"))
+ (user-error "No pattern given"))
(unless command
- (error "No command given"))
+ (user-error "No command given"))
(evil-with-single-undo
(let ((case-fold-search
(eq (evil-ex-regex-case pattern 'smart) 'insensitive))
diff --git a/evil-common.el b/evil-common.el
index 25b0ed2..481dc88 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -610,7 +610,7 @@ Translates it according to the input method."
(cmd
(call-interactively cmd))
(t
- (error "No replacement character typed"))))
+ (user-error "No replacement character typed"))))
(quit
(when (fboundp 'evil-repeat-abort)
(evil-repeat-abort))
@@ -718,7 +718,7 @@ recursively."
(let ((cmd (key-binding (substring keys beg end))))
(cond
((memq cmd '(undefined nil))
- (error "No command bound to %s" (substring keys beg end)))
+ (user-error "No command bound to %s" (substring keys beg end)))
((arrayp cmd) ; keyboard macro, replace command with macro
(setq keys (vconcat (substring keys 0 beg)
cmd
@@ -745,7 +745,7 @@ recursively."
(substring keys end))))))
(t ; append a further event
(setq end (1+ end))))))
- (error "Key sequence contains no complete binding"))))
+ (user-error "Key sequence contains no complete binding"))))
(defmacro evil-redirect-digit-argument (map keys target)
"Bind a wrapper function calling TARGET or `digit-argument'.
@@ -1469,7 +1469,7 @@ otherwise, it stays behind."
(set marker (or (symbol-value marker) (make-marker)))
(setq marker (symbol-value marker)))
((functionp marker)
- (error "Cannot set special marker `%c'" char))
+ (user-error "Cannot set special marker `%c'" char))
((evil-global-marker-p char)
(setq alist (default-value 'evil-markers-alist)
marker (make-marker))
@@ -1569,10 +1569,10 @@ The following special registers are supported.
((eq register ?+)
(x-get-clipboard))
((eq register ?%)
- (or (buffer-file-name) (error "No file name")))
+ (or (buffer-file-name) (user-error "No file name")))
((= register ?#)
(or (with-current-buffer (other-buffer) (buffer-file-name))
- (error "No file name")))
+ (user-error "No file name")))
((eq register ?/)
(or (car-safe
(or (and (boundp 'evil-search-module)
@@ -1580,10 +1580,10 @@ The following special registers are supported.
evil-ex-search-history)
(and isearch-regexp regexp-search-ring)
search-ring))
- (error "No previous regular expression")))
+ (user-error "No previous regular expression")))
((eq register ?:)
(or (car-safe evil-ex-history)
- (error "No previous command line")))
+ (user-error "No previous command line")))
((eq register ?.)
evil-last-insertion)
((eq register ?-)
@@ -1598,13 +1598,13 @@ The following special registers are supported.
(prin1-to-string result))
((sequencep result)
(mapconcat #'prin1-to-string result "\n"))
- (t (error "Using %s as a string" (type-of result))))))
+ (t (user-error "Using %s as a string" (type-of result))))))
((eq register ?_) ; the black hole register
"")
(t
(setq register (downcase register))
(get-register register)))
- (error "Register `%c' is empty" register)))
+ (user-error "Register `%c' is empty" register)))
(error (unless err (signal (car err) (cdr err))))))
(defun evil-set-register (register text)
@@ -2127,9 +2127,9 @@ is negative this is a more recent kill."
'(evil-paste-after
evil-paste-before
evil-visual-paste))
- (error "Previous command was not an evil-paste: %s" last-command))
+ (user-error "Previous command was not an evil-paste: %s" last-command))
(unless evil-last-paste
- (error "Previous paste command used a register"))
+ (user-error "Previous paste command used a register"))
(evil-undo-pop)
(goto-char (nth 2 evil-last-paste))
(setq this-command (nth 0 evil-last-paste))
@@ -2213,8 +2213,8 @@ list of command properties as passed to `evil-define-command'."
(setq pos (1+ pos))
(setq match (evil-match-interactive-code string pos))
(if (null match)
- (error "Unknown interactive code: `%s'"
- (substring string pos))
+ (user-error "Unknown interactive code: `%s'"
+ (substring string pos))
(setq code (car match)
expr (car (cdr match))
plist (cdr (cdr match))
@@ -3007,7 +3007,7 @@ in `evil-temporary-undo' instead."
evil-temporary-undo
buffer-undo-list)))
(when (or (not undo-list) (car undo-list))
- (error "Can't undo previous change"))
+ (user-error "Can't undo previous change"))
(while (and undo-list (null (car undo-list)))
(pop undo-list)) ; remove nil
(while (and undo-list (car undo-list))
@@ -3237,9 +3237,9 @@ REST is the unparsed remainder of TO."
((eq char ?=)
(when (or (zerop (length rest))
(not (eq (aref rest 0) ?@)))
- (error "Expected @ after \\="))
+ (user-error "Expected @ after \\="))
(when (< (length rest) 2)
- (error "Expected register after \\=@"))
+ (user-error "Expected register after \\=@"))
(list (evil-get-register (aref rest 1))
(substring rest 2)))
((eq char ?,)
diff --git a/evil-ex.el b/evil-ex.el
index 7482717..9dd5489 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -185,7 +185,7 @@ is appended to the line."
(unless (zerop (length result))
(if evil-ex-expression
(eval evil-ex-expression)
- (error "Ex: syntax error"))))
+ (user-error "Ex: syntax error"))))
(defun evil-ex-delete-backward-char ()
"Close the minibuffer if it is empty.
@@ -601,7 +601,7 @@ works accordingly."
(if (commandp binding)
binding
(unless noerror
- (error "Unknown command: `%s'" command))))))
+ (user-error "Unknown command: `%s'" command))))))
(defun evil-ex-completed-binding (command &optional noerror)
"Returns the final binding of the completion of COMMAND."
@@ -657,7 +657,7 @@ This function interprets special file names like # and %."
(setq hist nil)
(if evil-ex-expression
(eval evil-ex-expression)
- (error "Ex: syntax error")))))))))
+ (user-error "Ex: syntax error")))))))))
(defun evil-ex-call-command (range command argument)
"Execute the given command COMMAND."
@@ -737,7 +737,7 @@ Signal an error if MARKER is in a different buffer."
(setq marker (evil-get-marker marker))
(if (numberp marker)
(line-number-at-pos marker)
- (error "Ex does not support markers in other files")))
+ (user-error "Ex does not support markers in other files")))
(defun evil-ex-char-marker-range (beg end)
(when (stringp beg) (setq beg (aref beg 0)))
@@ -750,7 +750,7 @@ Signal an error if MARKER is in a different buffer."
(if (evil-visual-state-p)
(evil-visual-type)
'inclusive)))
- (error "Ex does not support markers in other files")))
+ (user-error "Ex does not support markers in other files")))
(defun evil-ex-re-fwd (pattern)
"Search forward for PATTERN.
diff --git a/evil-repeat.el b/evil-repeat.el
index f4edc1c..33abf77 100644
--- a/evil-repeat.el
+++ b/evil-repeat.el
@@ -561,7 +561,7 @@ If SAVE-POINT is non-nil, do not move point."
(let ((confirm-kill-emacs t)
(kill-buffer-hook
(cons #'(lambda ()
- (error "Cannot delete buffer in repeat command"))
+ (user-error "Cannot delete buffer in repeat command"))
kill-buffer-hook))
(undo-pointer buffer-undo-list))
(evil-with-single-undo
@@ -586,7 +586,7 @@ If COUNT is negative, this is a more recent kill."
(cond
((not (and (eq last-command #'evil-repeat)
evil-last-repeat))
- (error "Previous command was not evil-repeat: %s" last-command))
+ (user-error "Previous command was not evil-repeat: %s" last-command))
(save-point
(save-excursion
(evil-repeat-pop count)))
diff --git a/evil-search.el b/evil-search.el
index a87167a..7d58d96 100644
--- a/evil-search.el
+++ b/evil-search.el
@@ -231,8 +231,8 @@ one more than the current position."
(funcall search-func string)
(search-failed
(goto-char orig)
- (error "\"%s\": %s not found"
- string (if regexp-p "pattern" "string"))))
+ (user-error "\"%s\": %s not found"
+ string (if regexp-p "pattern" "string"))))
(setq isearch-string string)
(isearch-update-ring string regexp-p)
;; handle opening and closing of invisible area
@@ -274,7 +274,7 @@ otherwise for the word at point."
(setq string (evil-find-thing forward (if symbol 'symbol 'word)))
(cond
((null string)
- (error "No word under point"))
+ (user-error "No word under point"))
(unbounded
(setq string (regexp-quote string)))
(t
@@ -667,7 +667,7 @@ The following properties are supported:
(search-failed
(setq result (nth 2 lossage)))
- (error
+ (user-error
(setq result (format "%s" lossage)))))
;; no pattern, remove all highlights
(mapc #'delete-overlay old-ovs)
@@ -1022,7 +1022,7 @@ current search result."
(string-match
"^\\([esb]\\)?\\(\\([-+]\\)?\\([0-9]*\\)\\)$"
offset)
- (error "Invalid search offset: %s" offset))
+ (user-error "Invalid search offset: %s" offset))
(let ((count (if (= (match-beginning 4) (match-end 4))
(cond
((not (match-beginning 3)) 0)
@@ -1098,7 +1098,7 @@ point."
(let ((string (evil-find-thing (eq direction 'forward)
(if symbol 'symbol 'word))))
(if (null string)
- (error "No word under point")
+ (user-error "No word under point")
(let ((regex (if unbounded
(regexp-quote string)
(format (if symbol "\\_<%s\\_>" "\\<%s\\>")
@@ -1160,7 +1160,7 @@ This handler highlights the pattern of the current substitution."
(end-of-file
(evil-ex-pattern-update-ex-info nil
"incomplete replacement"))
- (error
+ (user-error
(evil-ex-pattern-update-ex-info nil
(format "%s" lossage))))))))
diff --git a/evil-types.el b/evil-types.el
index 57dc8ac..23a0dd9 100644
--- a/evil-types.el
+++ b/evil-types.el
@@ -347,7 +347,7 @@ If visual state is inactive then those values are nil."
(save-excursion
(goto-char evil-ex-point)
(eval (cadr expr)))
- (error "Invalid address"))))))
+ (user-error "Invalid address"))))))
(evil-define-interactive-code "<!>"
"Ex bang argument."