From 1b8f9081b9d06575e81cb2b52bf7f62089f844ac Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sat, 8 Aug 2020 13:45:23 +0200 Subject: [PATCH] lisp/bookmark.el: Customize choice to show bookmark list in a new tab * lisp/bookmark.el (bookmark-bmenu-get-buffer): Add as a choice for new-tab targets (bug#41225). --- etc/NEWS | 4 ++++ lisp/bookmark.el | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 2b3cc80df15..01245d14f90 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -138,6 +138,10 @@ The width now depends of the width of the window, but will never be wider than the length of the longest buffer name, except that it will never be narrower than 19 characters. +*** Bookmarks can now be targets for new tabs. +When the 'bookmark.el' library is loaded, a customize choice is added +to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list. + ** Windows *** The key prefix 'C-x 4 1' displays next command buffer in the same window. diff --git a/lisp/bookmark.el b/lisp/bookmark.el index de7d60f97eb..fb293adb779 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1666,6 +1666,19 @@ Don't affect the buffer ring order." (bookmark-bmenu-list))))) +;;;###autoload +(defun bookmark-bmenu-get-buffer () + "Return the Bookmark List, building it if it doesn't exists. +Don't affect the buffer ring order." + (or (get-buffer bookmark-bmenu-buffer) + (save-excursion + (save-window-excursion + (bookmark-bmenu-list) + (get-buffer bookmark-bmenu-buffer))))) + +(custom-add-choice 'tab-bar-new-tab-choice + '(const :tag "Bookmark List" bookmark-bmenu-get-buffer)) + ;;;###autoload (defun bookmark-bmenu-list () "Display a list of existing bookmarks. -- 2.39.2