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

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

bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list.


From: Kenjiro NAKAYAMA
Subject: bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list.
Date: Wed, 08 Jan 2014 11:19:28 +0900
User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.3

(I sent this mail before, but since the mail did not receive mailing
list , I resend. Sorry if it is duplicated.)

Altough current eww bookmark list shows "URL" and "Title", it is better
that "Title" is left side and "URL" is right, in my opinion.
And it makes possible to display full URL withought clip.

This is the patch for it. Please review and install it to the official tree if 
appreciated.

Signed-off-by: Kenjiro NAKAYAMA <address@hidden>

          * net/eww.el (eww-bookmark-prepare): Tiny fix to display
            bookmark list.

---
 lisp/net/eww.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 38726fd..a9f97bb 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1140,19 +1140,24 @@ 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 ((inhibit-read-only t)
+       (domain-length 0)
+       (title-length 0)
+       start url title format)
     (erase-buffer)
-    (setq header-line-format (concat " " (format format "URL" "Title")))
+    (dolist (bookmark eww-bookmarks)
+      (setq start (point))
+      (setq domain-length (max domain-length (length (plist-get bookmark 
:url))))
+      (setq title-length (max title-length (length (plist-get bookmark 
:title)))))
+    (setq format (format "%%-%ds %%-%ds" title-length domain-length)
+         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 title (plist-get bookmark :title))
+      (insert (format format title url))
+      (insert "\n")
       (put-text-property start (1+ start) 'eww-bookmark bookmark))
     (goto-char (point-min))))


--
1.8.3.1

Kenjiro





reply via email to

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