emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c3d4505: * lisp/net/eww.el (eww-add-bookmark): Fix


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master c3d4505: * lisp/net/eww.el (eww-add-bookmark): Fix prompt
Date: Mon, 26 Jan 2015 01:50:09 +0000

branch: master
commit c3d4505b5a8bf55044a1f40da5018e83a43157ff
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    * lisp/net/eww.el (eww-add-bookmark): Fix prompt
    
    And clean up the code slightly.
---
 lisp/ChangeLog  |    5 +++++
 lisp/net/eww.el |   25 ++++++++++++-------------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 70293af..044c299 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26  Lars Ingebrigtsen  <address@hidden>
+
+       * net/eww.el (eww-add-bookmark): Fix prompt and clean up the code
+       slightly.
+
 2015-01-25  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/cl-generic.el (cl--generic-no-next-method-function): New 
fun.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 879eb53..ec7a0ba 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1430,24 +1430,23 @@ Differences in #targets are ignored."
 (defvar eww-bookmarks nil)
 
 (defun eww-add-bookmark ()
-  "Add the current page to the bookmarks."
+  "Bookmark the current page."
   (interactive)
   (eww-read-bookmarks)
   (dolist (bookmark eww-bookmarks)
     (when (equal (plist-get eww-data :url) (plist-get bookmark :url))
       (user-error "Already bookmarked")))
-  (if (y-or-n-p "bookmark this page? ")
-      (progn
-       (let ((title (replace-regexp-in-string "[\n\t\r]" " "
-                                              (plist-get eww-data :title))))
-         (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title))
-         (push (list :url (plist-get eww-data :url)
-                     :title title
-                     :time (current-time-string))
-               eww-bookmarks))
-       (eww-write-bookmarks)
-       (message "Bookmarked %s (%s)" (plist-get eww-data :url)
-                (plist-get eww-data :title)))))
+  (when (y-or-n-p "Bookmark this page?")
+    (let ((title (replace-regexp-in-string "[\n\t\r]" " "
+                                          (plist-get eww-data :title))))
+      (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title))
+      (push (list :url (plist-get eww-data :url)
+                 :title title
+                 :time (current-time-string))
+           eww-bookmarks))
+    (eww-write-bookmarks)
+    (message "Bookmarked %s (%s)" (plist-get eww-data :url)
+            (plist-get eww-data :title))))
 
 (defun eww-write-bookmarks ()
   (with-temp-file (expand-file-name "eww-bookmarks" eww-bookmarks-directory)



reply via email to

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