From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: emacs-devel@gnu.org
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>,
Ted Zlatanov <tzz@lifelogs.com>
Subject: [PATCH 1/5] eww: Use `user-error'.
Date: Fri, 20 Dec 2013 00:44:24 +0100 [thread overview]
Message-ID: <5736070.MFe9JdVJE8@descartes> (raw)
In-Reply-To: <cover.1387496431.git.ruediger@c-plusplus.de>
* 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 <ruediger@c-plusplus.de>
+
+ * 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 <tzz@lifelogs.com>
* 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
next parent reply other threads:[~2013-12-19 23:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1387496431.git.ruediger@c-plusplus.de>
2013-12-19 23:44 ` Rüdiger Sonderfeld [this message]
2013-12-19 23:44 ` [PATCH 2/5] eww: Add menu for `eww-bookmark-mode' Rüdiger Sonderfeld
2013-12-19 23:44 ` [PATCH 3/5] eww: Use `setq-local' Rüdiger Sonderfeld
2013-12-19 23:44 ` [PATCH 4/5] eww: Add tool bar support Rüdiger Sonderfeld
2013-12-19 23:44 ` [PATCH 5/5] eww: Check for `html-mode' using `fboundp' Rüdiger Sonderfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5736070.MFe9JdVJE8@descartes \
--to=ruediger@c-plusplus.de \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=tzz@lifelogs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.