diff options
| author | Lars Magne Ingebrigtsen | 2014-12-07 20:32:07 +0100 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2014-12-07 20:32:07 +0100 |
| commit | 2c3d1113927f19903a4909f010c9fe2a73a8f741 (patch) | |
| tree | f1b2b9c5fba2de3a7f8fec04a898f2433c1222d1 | |
| parent | 17ee1836462f7449bbe393c4fb4ea52eb9a657b8 (diff) | |
| download | emacs-2c3d1113927f19903a4909f010c9fe2a73a8f741.tar.gz emacs-2c3d1113927f19903a4909f010c9fe2a73a8f741.zip | |
eww bookmark display fixup
Fixes: debbugs:16398
* net/eww.el (eww-bookmark-prepare): Display URLs in first by
displaying shortened titles first.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/eww.el | 21 |
2 files changed, 15 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 50df1cd3253..287352cdb0d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/eww.el (eww-bookmark-prepare): Display URLs in first by | ||
| 4 | displaying shortened titles first (bug#16398). | ||
| 5 | |||
| 1 | 2014-12-07 Tom Willemse <tom@ryuslash.org> (tiny change) | 6 | 2014-12-07 Tom Willemse <tom@ryuslash.org> (tiny change) |
| 2 | 7 | ||
| 3 | * progmodes/python.el: Recognize docstrings. | 8 | * progmodes/python.el: Recognize docstrings. |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index e88afb50326..c1ba4294905 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -1440,19 +1440,18 @@ Differences in #targets are ignored." | |||
| 1440 | (user-error "No bookmarks are defined")) | 1440 | (user-error "No bookmarks are defined")) |
| 1441 | (set-buffer (get-buffer-create "*eww bookmarks*")) | 1441 | (set-buffer (get-buffer-create "*eww bookmarks*")) |
| 1442 | (eww-bookmark-mode) | 1442 | (eww-bookmark-mode) |
| 1443 | (let ((format "%-40s %s") | 1443 | (let* ((width (/ (window-width) 2)) |
| 1444 | (inhibit-read-only t) | 1444 | (format (format "%%-%ds %%s" width)) |
| 1445 | start url) | 1445 | (inhibit-read-only t) |
| 1446 | start title) | ||
| 1446 | (erase-buffer) | 1447 | (erase-buffer) |
| 1447 | (setq header-line-format (concat " " (format format "URL" "Title"))) | 1448 | (setq header-line-format (concat " " (format format "Title" "URL"))) |
| 1448 | (dolist (bookmark eww-bookmarks) | 1449 | (dolist (bookmark eww-bookmarks) |
| 1449 | (setq start (point)) | 1450 | (setq start (point) |
| 1450 | (setq url (plist-get bookmark :url)) | 1451 | title (plist-get bookmark :title)) |
| 1451 | (when (> (length url) 40) | 1452 | (when (> (length title) width) |
| 1452 | (setq url (substring url 0 40))) | 1453 | (setq title (substring title 0 width))) |
| 1453 | (insert (format format url | 1454 | (insert (format format title (plist-get bookmark :url)) "\n") |
| 1454 | (plist-get bookmark :title)) | ||
| 1455 | "\n") | ||
| 1456 | (put-text-property start (1+ start) 'eww-bookmark bookmark)) | 1455 | (put-text-property start (1+ start) 'eww-bookmark bookmark)) |
| 1457 | (goto-char (point-min)))) | 1456 | (goto-char (point-min)))) |
| 1458 | 1457 | ||