eww usability improvements

* net/eww.el (eww-bookmark-browse): Use 'eww-browse-url'.
(eww-add-bookmark): ask confirmation when add to bookmarks
(eww-quit): ask confirmation before quitting eww
This commit is contained in:
Ted Zlatanov 2013-11-26 15:05:48 -05:00
parent 0e2c793ffe
commit e47112ee5d
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2013-11-26 Kenjiro NAKAYAMA <knakayam@redhat.com> (tiny change)
* net/eww.el (eww-bookmark-browse): Use 'eww-browse-url'.
(eww-add-bookmark): ask confirmation when add to bookmarks
(eww-quit): ask confirmation before quitting eww
2013-11-26 Eli Zaretskii <eliz@gnu.org>
* vc/vc.el (vc-diff-internal): Use *-dos coding-system when

View file

@ -403,8 +403,10 @@ word(s) will be searched for via `eww-search-prefix'."
(defun eww-quit ()
"Exit the Emacs Web Wowser."
(interactive)
(setq eww-history nil)
(kill-buffer (current-buffer)))
(if (y-or-n-p "quit eww? ")
(progn
(setq eww-history nil)
(kill-buffer (current-buffer)))))
(defun eww-back-url ()
"Go to the previously displayed page."
@ -964,14 +966,16 @@ The browser to used is specified by the `shr-external-browser' variable."
(when (equal eww-current-url
(plist-get bookmark :url))
(error "Already bookmarked")))
(let ((title (replace-regexp-in-string "[\n\t\r]" " " eww-current-title)))
(setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title))
(push (list :url eww-current-url
:title title
:time (current-time-string))
eww-bookmarks))
(eww-write-bookmarks)
(message "Bookmarked %s (%s)" eww-current-url eww-current-title))
(if (y-or-n-p "bookmark this page? ")
(progn
(let ((title (replace-regexp-in-string "[\n\t\r]" " " eww-current-title)))
(setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title))
(push (list :url eww-current-url
:title title
:time (current-time-string))
eww-bookmarks))
(eww-write-bookmarks)
(message "Bookmarked %s (%s)" eww-current-url eww-current-title))))
(defun eww-write-bookmarks ()
(with-temp-file (expand-file-name "eww-bookmarks" user-emacs-directory)
@ -1063,7 +1067,7 @@ The browser to used is specified by the `shr-external-browser' variable."
;; just let it remain.
(ignore-errors
(delete-window))
(eww (plist-get bookmark :url))))
(eww-browse-url (plist-get bookmark :url))))
(defun eww-next-bookmark ()
"Go to the next bookmark in the list."