[gnus git] branch master updated: m0-7-142-gc6b6290 =1= Improve prev/next link handling
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via c6b6290917b2629807df2f4bfa382e849495e5df (commit)
from f03aee0974ddab2895c85647ca516fad9cffe6be (commit)
- Log -----------------------------------------------------------------
commit c6b6290917b2629807df2f4bfa382e849495e5df
Author: Tom Tromey <[email protected]>
Date: Wed Jun 19 21:30:04 2013 +0200
Improve prev/next link handling
* net/eww.el (eww-top-url): Remove.
(eww-home-url, eww-start-url, eww-contents-url): New defvars.
(eww-render): Set new variables. Don't set eww-top-url.
(eww-handle-link): Handle "prev", "home", and "contents".
Downcase the rel text.
(eww-top-url): Choose best top URL.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a27f19..da02588 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2013-06-19 Tom Tromey <[email protected]>
+
+ * net/eww.el (eww-top-url): Remove.
+ (eww-home-url, eww-start-url, eww-contents-url): New defvars.
+ (eww-render): Set new variables. Don't set eww-top-url.
+ (eww-handle-link): Handle "prev", "home", and "contents".
+ Downcase the rel text.
+ (eww-top-url): Choose best top URL.
+
2013-06-19 Lars Magne Ingebrigtsen <[email protected]>
* eww.el: Rewrite to implement form elements "by hand" instead of
diff --git a/lisp/eww.el b/lisp/eww.el
index 7e5e2c5..2bc0750 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -83,7 +83,9 @@
(defvar eww-next-url nil)
(defvar eww-previous-url nil)
(defvar eww-up-url nil)
-(defvar eww-top-url nil)
+(defvar eww-home-url nil)
+(defvar eww-start-url nil)
+(defvar eww-contents-url nil)
;;;###autoload
(defun eww (url)
@@ -106,7 +108,9 @@
(set (make-local-variable 'eww-next-url) nil)
(set (make-local-variable 'eww-previous-url) nil)
(set (make-local-variable 'eww-up-url) nil)
- (set (make-local-variable 'eww-top-url) nil)
+ (set (make-local-variable 'eww-home-url) nil)
+ (set (make-local-variable 'eww-start-url) nil)
+ (set (make-local-variable 'eww-contents-url) nil)
(let* ((headers (eww-parse-headers))
(shr-target-id
(and (string-match "#\\(.*\\)" url)
@@ -195,10 +199,22 @@
(defun eww-handle-link (cont)
(let* ((rel (assq :rel cont))
(href (assq :href cont))
- (where (assoc (cdr rel)
+ (where (assoc
+ ;; The text associated with :rel is case-insensitive.
+ (if rel (downcase (cdr rel)))
'(("next" . eww-next-url)
+ ;; Texinfo uses "previous", but HTML specifies
+ ;; "prev", so recognize both.
("previous" . eww-previous-url)
- ("start" . eww-top-url)
+ ("prev" . eww-previous-url)
+ ;; HTML specifies "start" but also "contents",
+ ;; and Gtk seems to use "home". Recognize
+ ;; them all; but store them in different
+ ;; variables so that we can readily choose the
+ ;; "best" one.
+ ("start" . eww-start-url)
+ ("home" . eww-home-url)
+ ("contents" . eww-contents-url)
("up" . eww-up-url)))))
(and href
where
@@ -347,12 +363,15 @@ or <a> tag."
(defun eww-top-url ()
"Go to the page marked `top'.
-A page is marked `top' if rel=\"start\" appears in a <link>
-or <a> tag."
+A page is marked `top' if rel=\"start\", rel=\"home\", or rel=\"contents\"
+appears in a <link> or <a> tag."
(interactive)
- (if eww-top-url
- (eww-browse-url (shr-expand-url eww-top-url eww-current-url))
- (error "No `top' on this page")))
+ (let ((best-url (or eww-start-url
+ eww-contents-url
+ eww-home-url)))
+ (if best-url
+ (eww-browse-url (shr-expand-url best-url eww-current-url))
+ (error "No `top' for this page"))))
(defun eww-reload ()
"Reload the current page."
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 9 +++++++++
lisp/eww.el | 37 ++++++++++++++++++++++++++++---------
2 files changed, 37 insertions(+), 9 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project