emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 2c3d111: eww bookmark display fixup


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 2c3d111: eww bookmark display fixup
Date: Sun, 07 Dec 2014 19:32:56 +0000

branch: master
commit 2c3d1113927f19903a4909f010c9fe2a73a8f741
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    eww bookmark display fixup
    
    Fixes: debbugs:16398
    
    * net/eww.el (eww-bookmark-prepare): Display URLs in first by
    displaying shortened titles first.
---
 lisp/ChangeLog  |    5 +++++
 lisp/net/eww.el |   21 ++++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 50df1cd..287352c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-07  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * net/eww.el (eww-bookmark-prepare): Display URLs in first by
+       displaying shortened titles first (bug#16398).
+
 2014-12-07  Tom Willemse  <address@hidden>  (tiny change)
 
        * progmodes/python.el: Recognize docstrings.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e88afb5..c1ba429 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1440,19 +1440,18 @@ Differences in #targets are ignored."
     (user-error "No bookmarks are defined"))
   (set-buffer (get-buffer-create "*eww bookmarks*"))
   (eww-bookmark-mode)
-  (let ((format "%-40s %s")
-       (inhibit-read-only t)
-       start url)
+  (let* ((width (/ (window-width) 2))
+        (format (format "%%-%ds %%s" width))
+        (inhibit-read-only t)
+        start title)
     (erase-buffer)
-    (setq header-line-format (concat " " (format format "URL" "Title")))
+    (setq header-line-format (concat " " (format format "Title" "URL")))
     (dolist (bookmark eww-bookmarks)
-      (setq start (point))
-      (setq url (plist-get bookmark :url))
-      (when (> (length url) 40)
-       (setq url (substring url 0 40)))
-      (insert (format format url
-                     (plist-get bookmark :title))
-             "\n")
+      (setq start (point)
+           title (plist-get bookmark :title))
+      (when (> (length title) width)
+       (setq title (substring title 0 width)))
+      (insert (format format title (plist-get bookmark :url)) "\n")
       (put-text-property start (1+ start) 'eww-bookmark bookmark))
     (goto-char (point-min))))
 



reply via email to

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