unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenjiro NAKAYAMA <knakayam@redhat.com>
To: 15966@debbugs.gnu.org
Subject: bug#15966: 24.3.50; [PATCH] eww: ask confirmation when add bookmarks
Date: Sun, 24 Nov 2013 23:41:44 +0900	[thread overview]
Message-ID: <87eh65rhef.fsf@dhcp-193-97.nrt.redhat.com> (raw)

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	other threads:[~2013-11-24 14:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eh65rhef.fsf@dhcp-193-97.nrt.redhat.com \
    --to=knakayam@redhat.com \
    --cc=15966@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).