emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] eww: Use `user-error'.


From: Rüdiger Sonderfeld
Subject: [PATCH 1/5] eww: Use `user-error'.
Date: Fri, 20 Dec 2013 00:44:24 +0100
User-agent: KMail/4.11.2 (Linux/3.11.0-14-generic; KDE/4.11.2; x86_64; ; )

* lisp/net/eww.el (eww-back-url, eww-forward-url, eww-next-url)
(eww-previous-url, eww-up-url, eww-top-url, eww-add-bookmark)
(eww-bookmark-prepare, eww-bookmark-kill, eww-bookmark-yank)
(eww-bookmark-browse, eww-next-bookmark, eww-previous-bookmark):
Use `user-error'.
---
 lisp/ChangeLog  |  8 ++++++++
 lisp/net/eww.el | 28 ++++++++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 85e961e..db57dbc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2013-12-19  Rüdiger Sonderfeld  <address@hidden>
+
+       * net/eww.el (eww-back-url, eww-forward-url, eww-next-url)
+       (eww-previous-url, eww-up-url, eww-top-url, eww-add-bookmark)
+       (eww-bookmark-prepare, eww-bookmark-kill, eww-bookmark-yank)
+       (eww-bookmark-browse, eww-next-bookmark, eww-previous-bookmark):
+       Use `user-error'.
+
 2013-12-19  Teodor Zlatanov  <address@hidden>
 
        * net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 2263f81..feec873 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -474,7 +474,7 @@ (defun eww-back-url ()
   "Go to the previously displayed page."
   (interactive)
   (when (>= eww-history-position (length eww-history))
-    (error "No previous page"))
+    (user-error "No previous page"))
   (eww-save-history)
   (setq eww-history-position (+ eww-history-position 2))
   (eww-restore-history (elt eww-history (1- eww-history-position))))
@@ -483,7 +483,7 @@ (defun eww-forward-url ()
   "Go to the next displayed page."
   (interactive)
   (when (zerop eww-history-position)
-    (error "No next page"))
+    (user-error "No next page"))
   (eww-save-history)
   (eww-restore-history (elt eww-history (1- eww-history-position))))
 
@@ -505,7 +505,7 @@ (defun eww-next-url ()
   (interactive)
   (if eww-next-url
       (eww-browse-url (shr-expand-url eww-next-url eww-current-url))
-    (error "No `next' on this page")))
+    (user-error "No `next' on this page")))
 
 (defun eww-previous-url ()
   "Go to the page marked `previous'.
@@ -514,7 +514,7 @@ (defun eww-previous-url ()
   (interactive)
   (if eww-previous-url
       (eww-browse-url (shr-expand-url eww-previous-url eww-current-url))
-    (error "No `previous' on this page")))
+    (user-error "No `previous' on this page")))
 
 (defun eww-up-url ()
   "Go to the page marked `up'.
@@ -523,7 +523,7 @@ (defun eww-up-url ()
   (interactive)
   (if eww-up-url
       (eww-browse-url (shr-expand-url eww-up-url eww-current-url))
-    (error "No `up' on this page")))
+    (user-error "No `up' on this page")))
 
 (defun eww-top-url ()
   "Go to the page marked `top'.
@@ -535,7 +535,7 @@ (defun eww-top-url ()
                      eww-home-url)))
     (if best-url
        (eww-browse-url (shr-expand-url best-url eww-current-url))
-      (error "No `top' for this page"))))
+      (user-error "No `top' for this page"))))
 
 (defun eww-reload ()
   "Reload the current page."
@@ -1073,7 +1073,7 @@ (defun eww-add-bookmark ()
   (dolist (bookmark eww-bookmarks)
     (when (equal eww-current-url
                 (plist-get bookmark :url))
-      (error "Already bookmarked")))
+      (user-error "Already bookmarked")))
   (if (y-or-n-p "bookmark this page? ")
       (progn
        (let ((title (replace-regexp-in-string "[\n\t\r]" " " 
eww-current-title)))
@@ -1106,8 +1106,8 @@ (defun eww-list-bookmarks ()
 
 (defun eww-bookmark-prepare ()
   (eww-read-bookmarks)
-  (when (null eww-bookmarks)
-    (error "No bookmarks are defined"))
+  (unless eww-bookmarks
+    (user-error "No bookmarks are defined"))
   (set-buffer (get-buffer-create "*eww bookmarks*"))
   (eww-bookmark-mode)
   (let ((format "%-40s %s")
@@ -1135,7 +1135,7 @@ (defun eww-bookmark-kill ()
         (bookmark (get-text-property start 'eww-bookmark))
         (inhibit-read-only t))
     (unless bookmark
-      (error "No bookmark on the current line"))
+      (user-error "No bookmark on the current line"))
     (forward-line 1)
     (push (buffer-substring start (point)) eww-bookmark-kill-ring)
     (delete-region start (point))
@@ -1146,7 +1146,7 @@ (defun eww-bookmark-yank ()
   "Yank a previously killed bookmark to the current line."
   (interactive)
   (unless eww-bookmark-kill-ring
-    (error "No previously killed bookmark"))
+    (user-error "No previously killed bookmark"))
   (beginning-of-line)
   (let ((inhibit-read-only t)
        (start (point))
@@ -1170,7 +1170,7 @@ (defun eww-bookmark-browse ()
   (interactive)
   (let ((bookmark (get-text-property (line-beginning-position) 'eww-bookmark)))
     (unless bookmark
-      (error "No bookmark on the current line"))
+      (user-error "No bookmark on the current line"))
     ;; We wish to leave this window, but if it's the only window here,
     ;; just let it remain.
     (ignore-errors
@@ -1192,7 +1192,7 @@ (defun eww-next-bookmark ()
       (setq bookmark (get-text-property (line-beginning-position)
                                        'eww-bookmark))
       (unless bookmark
-       (error "No next bookmark")))
+       (user-error "No next bookmark")))
     (eww-browse-url (plist-get bookmark :url))))
 
 (defun eww-previous-bookmark ()
@@ -1211,7 +1211,7 @@ (defun eww-previous-bookmark ()
       (when (eolp)
        (forward-line -1))
       (if (bobp)
-         (error "No previous bookmark")
+         (user-error "No previous bookmark")
        (forward-line -1))
       (setq bookmark (get-text-property (line-beginning-position)
                                        'eww-bookmark)))
-- 
1.8.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]