bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15966: 24.3.50; [PATCH] eww: ask confirmation when add bookmarks


From: Kenjiro NAKAYAMA
Subject: bug#15966: 24.3.50; [PATCH] eww: ask confirmation when add bookmarks
Date: Sun, 24 Nov 2013 23:41:44 +0900
User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.2

eww should ask "yes or no" when add current page to bookmarks, since
only "b" key to add bookmarks is easy to mistake.
(My bookmarklist has amazingly increased.)

Signed-off-by: Kenjiro NAKAYAMA <knakayam@redhat.com>

        * net/eww.el (eww-add-bookmark): ask confirmation when add to bookmarks

---
 lisp/net/eww.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 86e0977..6f09d86 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -964,14 +964,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 "add 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)
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]