[gnus git] branch master updated: m0-7-46-gf39e572 =1= (eww-previous-url): New command.
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via f39e57245fa29c620d0b9c499788a12504eebb2e (commit)
from c2cced874fe3e2cfb9694d8a43dec8401c9f93da (commit)
- Log -----------------------------------------------------------------
commit f39e57245fa29c620d0b9c499788a12504eebb2e
Author: Lars Magne Ingebrigtsen <[email protected]>
Date: Mon Jun 10 11:47:26 2013 +0200
(eww-previous-url): New command.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8064dcd..0bd0fe8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,7 @@
2013-06-10 Lars Magne Ingebrigtsen <[email protected]>
* eww.el: Start writing a new, tiny web browser.
+ (eww-previous-url): New command.
2013-06-10 Albert Krewinkel <[email protected]>
diff --git a/lisp/eww.el b/lisp/eww.el
index e23e390..b43586b 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -30,13 +30,15 @@
(require 'cl-lib)
(defvar eww-current-url nil)
+(defvar eww-history nil)
+(defvar eww-current-page nil)
(defun eww (url)
"Fetch URL and render the page."
(interactive "sUrl: ")
(url-retrieve url 'eww-render (list url)))
-(defun eww-render (status url)
+(defun eww-render (status url &optional point)
(let* ((headers (eww-parse-headers))
(content-type
(mail-header-parse-content-type
@@ -48,6 +50,7 @@
"utf8"))))
(data-buffer (current-buffer)))
(unwind-protect
+ (progn
(cond
((equal (car content-type) "text/html")
(eww-display-html charset url))
@@ -55,6 +58,8 @@
(eww-display-image))
(t
(eww-display-raw charset)))
+ (when point
+ (goto-char point)))
(kill-buffer data-buffer))))
(defun eww-parse-headers ()
@@ -102,6 +107,10 @@
(defvar eww-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "q" 'eww-quit)
+ (define-key map [tab] 'widget-forward)
+ (define-key map [backtab] 'widget-backward)
+ (define-key map "p" 'eww-previous-url)
+ ;;(define-key map "n" 'eww-next-url)
map))
(defun eww-mode ()
@@ -112,8 +121,22 @@
(setq major-mode 'eww-mode
mode-name "eww")
(set (make-local-variable 'eww-current-url) 'author)
+ (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url)
(use-local-map eww-mode-map))
+(defun eww-browse-url (url &optional new-window)
+ (push (list eww-current-url (point))
+ eww-history)
+ (eww url))
+
+(defun eww-previous-url ()
+ "Go to the previously displayed page."
+ (interactive)
+ (when (zerop (length eww-history))
+ (error "No previous page"))
+ (let ((prev (pop eww-history)))
+ (url-retrieve (car prev) 'eww-render (list (car prev) (cadr prev)))))
+
(provide 'eww)
;;; eww.el ends here
-----------------------------------------------------------------------
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 | 1 +
lisp/eww.el | 39 +++++++++++++++++++++++++++++++--------
2 files changed, 32 insertions(+), 8 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