[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 400a976: Call `user-error' instead of `error' where approp
From: |
Michael Heerdegen |
Subject: |
[elpa] master 400a976: Call `user-error' instead of `error' where appropriate |
Date: |
Wed, 28 Dec 2016 15:28:45 +0000 (UTC) |
branch: master
commit 400a97646b2e1fd6fd413eeea97a307de6a6d275
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
Call `user-error' instead of `error' where appropriate
Also improve some error messages.
---
packages/el-search/el-search-x.el | 4 ++--
packages/el-search/el-search.el | 23 ++++++++++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/packages/el-search/el-search-x.el
b/packages/el-search/el-search-x.el
index b01a93c..9a8f67f 100644
--- a/packages/el-search/el-search-x.el
+++ b/packages/el-search/el-search-x.el
@@ -196,7 +196,7 @@ Use variable `el-search--cached-changes' for caching."
(list revision (visited-file-modtime))))
(cdr el-search--cached-changes)
(when (buffer-modified-p)
- (error "Buffer is modified - please save"))
+ (user-error "Buffer is modified - please save"))
(require 'vc)
(require 'diff-hl)
;; `diff-hl-changes' returns line numbers. We must convert them into
positions.
@@ -238,7 +238,7 @@ Use variable `el-search--cached-changes' for caching."
(defun el-search--changed-p (posn &optional revision)
;; Non-nil when sexp after POSN contains a change
(when (buffer-modified-p)
- (error "Buffer is modified - please save"))
+ (user-error "Buffer is modified - please save"))
(save-restriction
(widen)
(let ((changes (el-search--changes-from-diff-hl revision)))
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index c7812a7..dfe3b78 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -568,7 +568,7 @@ matches the (only) argument (that should be a string)."
(when (and (symbolp pattern)
(not (eq pattern '_))
(not (keywordp pattern)))
- (error "Free symbol: `%S' (missing a quote?)" pattern)))
+ (user-error "Error: free variable `%S' (missing a quote?)" pattern)))
(defun el-search--read-pattern (prompt &optional default histvar)
(cl-callf or histvar 'el-search-pattern-history)
@@ -821,10 +821,10 @@ Raise an error if not. The string arguments TYPE and
optional
MESSAGE are used to construct the error message."
(dolist (arg args)
(unless (funcall predicate arg)
- (error (concat "Pattern `%s': "
- (or message (format "argument doesn't fulfill %S"
predicate))
- ": %S")
- type arg))))
+ (user-error (concat "Pattern `%s': "
+ (or message (format "argument doesn't fulfill %S"
predicate))
+ ": %S")
+ type arg))))
(defun el-search--elisp-file-name-p (file)
(and (string-match-p (concat "\\.el" (regexp-opt jka-compr-load-suffixes)
"?\\'") file)
@@ -1337,7 +1337,8 @@ expression, the absolute FILE-NAME is tested."
('nil)
((pred stringp) (apply-partially #'string-match-p
regexp-or-predicate))
((pred functionp) regexp-or-predicate)
- (_ (error "Pattern `file': illegal argument: %S"
regexp-or-predicate)))))
+ (_ (user-error "Pattern `file': illegal argument:
%S"
+ regexp-or-predicate)))))
(if (not regexp-or-predicate)
(lambda (file-name-or-buffer _) (funcall get-file-name
file-name-or-buffer))
(let ((test-file-name-or-buffer
@@ -1508,7 +1509,7 @@ that the current search."
(current-head (el-search-object-head search))
(current-search-buffer (el-search-head-buffer current-head)))
(if (not (buffer-live-p current-search-buffer))
- (error "Search head points to a killed buffer")
+ (user-error "Search head points to a killed buffer")
(setq this-command 'el-search-pattern)
(let ((win (display-buffer current-search-buffer
el-search-display-buffer-action)))
(select-frame-set-input-focus (window-frame win))
@@ -1547,9 +1548,9 @@ continued."
((eq (current-buffer) current-search-buffer)
(setf (el-search-head-position head) (copy-marker (point))))
((and current-search-buffer (buffer-live-p current-search-buffer))
- (error "Please resume from buffer %s" (buffer-name
current-search-buffer)))
+ (user-error "Please resume from buffer %s" (buffer-name
current-search-buffer)))
(current-search-buffer
- (error "Search head points to a killed buffer")))))
+ (user-error "Search head points to a killed buffer")))))
(unwind-protect
(let ((stream-of-matches (el-search-object-matches
el-search--current-search)))
(if (not (stream-empty-p stream-of-matches))
@@ -1639,7 +1640,7 @@ additional pattern types are currently defined:"
;; FIXME: This case is tricky; the user would expect that when he hits
;; C-S afterwards, the search is restored with the old matches
;; "merged". So for now, we raise this:
- (error "Last search completed, please start a new search")
+ (user-error "Last search completed, please restart the search")
(setq this-command 'el-search-pattern)
(let ((last-match-beg (el-search-object-last-match
el-search--current-search)))
(if (< last-match-beg (point))
@@ -1813,7 +1814,7 @@ reindent."
;; layout of subexpressions shared with the original (replaced)
;; expression and the replace expression.
(if (and splice (not (listp replacement)))
- (error "Expression to splice in is an atom")
+ (error "Expression to splice in is not a list")
(let ((orig-buffer (generate-new-buffer "orig-expr")))
(with-current-buffer orig-buffer
(emacs-lisp-mode)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master 400a976: Call `user-error' instead of `error' where appropriate,
Michael Heerdegen <=