Commit 61e51fee authored by Stefan Kangas's avatar Stefan Kangas

Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293)

Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode'
allows us to greatly simplify the code in several cases.  In addition,
we get some features for free, such as sorting by column.

The only functional step backwards is that we no longer support the
optional "inline" header line, a bookmark.el-specific feature to have
a header without using 'header-line-format'.  This feature is believed
to be not very useful or widely used.

* lisp/bookmark.el (tabulated-list): Require.
(bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of
'special-mode' and make the necessary changes to support that.
(bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map'
instead of 'special-mode-map'.  Remove now duplicate key bindings.
(bookmark-bmenu--revert): New function to show the bookmark list using
'tabulated-list-mode'.
(bookmark-bmenu-list): Simplify by using above new function.
(bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'.
(bookmark-bmenu--name-predicate)
(bookmark-bmenu--file-predicate): New functions used by
'tabulated-list-mode' to sort.

(bookmark-bmenu-set-header): Redefine as obsolete function alias for
'tabulated-list-init-header'.
(bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames)
(bookmark-bmenu-hide-filenames, bookmark-bmenu-mark)
(bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all)
(bookmark-bmenu-delete-all, bookmark-bmenu-unmark)
(bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now
that we can depend on 'tabulated-list-mode' to do more work.

(bookmark-bmenu-use-header-line)
(bookmark-bmenu-inline-header-height): Declare variables relating to
the now unsupported "inline" header obsolete.
(bookmark-bmenu-ensure-position)
(bookmark-bmenu-execute-deletions): Remove code to handle "inline" header.

* test/lisp/bookmark-tests.el
(bookmark-test-bmenu-edit-annotation/show-annotation)
(bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests
for minor changes when using 'tabulated-list-mode'.
parent f532e0c3
Pipeline #7392 failed with stage
in 95 minutes and 54 seconds
......@@ -607,6 +607,16 @@ defaulting to active region when used interactively.
---
** The old non-SMIE indentation of 'sh-mode' has been removed.
---
** The 'list-bookmark' menu is now based on 'tabulated-list-mode'.
The interactive bookmark list will now benefit from features in
'tabulated-list-mode' like sorting columns or changing column width.
Support for the optional "inline" header line, allowing for a header
without using 'header-line-format', has been dropped. Consequently,
the variables 'bookmark-bmenu-use-header-line' and
'bookmark-bmenu-inline-header-height' are now declared obsolete.
---
** The sb-image.el library is now marked obsolete.
This file was a compatibility kludge which is no longer needed.
......
This diff is collapsed.
......@@ -471,6 +471,8 @@ testing `bookmark-bmenu-list'."
(insert "foo")
(bookmark-send-edited-annotation)
(should (equal (buffer-name (current-buffer)) bookmark-bmenu-buffer))
(beginning-of-line)
(forward-char 4)
(should (looking-at "name"))))
(ert-deftest bookmark-test-bmenu-toggle-filenames ()
......@@ -503,6 +505,7 @@ testing `bookmark-bmenu-list'."
(ert-deftest bookmark-test-bmenu-mark ()
(with-bookmark-bmenu-test
(bookmark-bmenu-mark)
(forward-line -1)
(beginning-of-line)
(should (looking-at "^>"))))
......@@ -563,6 +566,7 @@ testing `bookmark-bmenu-list'."
(bookmark-bmenu-mark)
(goto-char (point-min))
(bookmark-bmenu-unmark)
(forward-line -1)
(beginning-of-line)
(should (looking-at "^ "))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment