From e47112ee5ddf21ae73238aa0262e2830ea85ec5f Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Tue, 26 Nov 2013 15:05:48 -0500 Subject: [PATCH] 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 --- lisp/ChangeLog | 6 ++++++ lisp/net/eww.el | 26 +++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1e7fc7c9184..44048d841f8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-26 Kenjiro NAKAYAMA (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 * vc/vc.el (vc-diff-internal): Use *-dos coding-system when diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 86e09776b42..0c84e782aa3 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -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." -- 2.39.2