(eww-add-bookmark): Remove newlines from the title.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Wed, 26 Jun 2013 16:59:21 +0000 (18:59 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Wed, 26 Jun 2013 16:59:21 +0000 (18:59 +0200)
lisp/ChangeLog
lisp/net/eww.el

index ea99e5c..24cc16e 100644 (file)
@@ -5,6 +5,7 @@
        (eww-mode-map): Add a menu bar.
        (eww-add-bookmark): New command.
        (eww-bookmark-mode): New mode and commands.
+       (eww-add-bookmark): Remove newlines from the title.
 
 2013-06-26  Glenn Morris  <rgm@gnu.org>
 
index 0fd6591..cee2146 100644 (file)
@@ -950,10 +950,12 @@ The browser to used is specified by the `shr-external-browser' variable."
     (when (equal eww-current-url
                 (plist-get bookmark :url))
       (error "Already bookmarked")))
-  (push (list :url eww-current-url
-             :title eww-current-title
-             :time (current-time-string))
-       eww-bookmarks)
+  (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))