unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list.
@ 2014-01-08  2:19 Kenjiro NAKAYAMA
  2014-01-08 15:53 ` Ted Zlatanov
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kenjiro NAKAYAMA @ 2014-01-08  2:19 UTC (permalink / raw)
  To: 16398

(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 <nakayamakenjiro@gmail.com>

          * 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





^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-12-07 19:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  2:19 bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list Kenjiro NAKAYAMA
2014-01-08 15:53 ` Ted Zlatanov
2014-01-18 18:32 ` Lars Ingebrigtsen
2014-01-19  3:07   ` Stefan Monnier
2014-01-19  5:55     ` Lars Ingebrigtsen
2014-01-19  6:50       ` Kenjiro NAKAYAMA
2014-01-19 15:31         ` Lars Ingebrigtsen
2014-01-20 16:09           ` Ted Zlatanov
2014-01-20 20:24             ` Lars Ingebrigtsen
2014-02-10  2:04               ` Ted Zlatanov
2014-12-07 19:32 ` Lars Magne Ingebrigtsen

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).