unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
To: 16398@debbugs.gnu.org
Subject: bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list.
Date: Wed, 08 Jan 2014 11:19:28 +0900	[thread overview]
Message-ID: <87iotvb4gf.fsf@dhcp-193-97.nrt.redhat.com> (raw)

(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





             reply	other threads:[~2014-01-08  2:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08  2:19 Kenjiro NAKAYAMA [this message]
2014-01-08 15:53 ` bug#16398: 24.3.50; [PATCH] eww: Tiny fix to display bookmark list 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iotvb4gf.fsf@dhcp-193-97.nrt.redhat.com \
    --to=nakayamakenjiro@gmail.com \
    --cc=16398@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).