branch: master
commit 6a09f779e14ab3cf19f1ce32b15ce84bd3e53eeb
Merge: fa74f2f 04c3b01
Author: Dmitry Gutov <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #81 from Wilfred/user_error_no_hunks
Use `user-error` when we can't proceed
---
diff-hl.el | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/diff-hl.el b/diff-hl.el
index 4f8d474..5f45e02 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -6,7 +6,7 @@
;; URL: https://github.com/dgutov/diff-hl
;; Keywords: vc, diff
;; Version: 1.8.4
-;; Package-Requires: ((cl-lib "0.2"))
+;; Package-Requires: ((cl-lib "0.2") (emacs "24.3"))
;; This file is part of GNU Emacs.
@@ -399,7 +399,7 @@ in the source file, or the last line of the hunk above it."
`(let (beg-line end-line)
(when (eobp)
(with-current-buffer ,buffer (diff-hl-remove-overlays))
- (error "Buffer is up-to-date"))
+ (user-error "Buffer is up-to-date"))
(let (diff-auto-refine-mode)
(diff-hl-diff-skip-to ,line))
(save-excursion
@@ -420,7 +420,7 @@ in the source file, or the last line of the hunk above it."
(diff-refine-hunk))
(unless (yes-or-no-p (format "Revert current hunk in %s? "
,(cl-caadr fileset)))
- (error "Revert canceled"))
+ (user-error "Revert canceled"))
(let ((diff-advance-after-apply-hunk nil))
(diff-apply-hunk t))
(with-current-buffer ,buffer
@@ -447,7 +447,7 @@ in the source file, or the last line of the hunk above it."
(throw 'found (overlay-start o)))))))))
(if pos
(goto-char pos)
- (error "No further hunks found"))))
+ (user-error "No further hunks found"))))
(defun diff-hl-previous-hunk ()
"Go to the beginning of the previous hunk in the current buffer."
@@ -458,7 +458,7 @@ in the source file, or the last line of the hunk above it."
(interactive)
(let ((hunk (diff-hl-hunk-overlay-at (point))))
(unless hunk
- (error "No hunk at point"))
+ (user-error "No hunk at point"))
(goto-char (overlay-start hunk))
(push-mark (overlay-end hunk) nil t)))