* bug#41225: [PATCH] Show bookmark list in new tab
@ 2020-05-13 0:05 Matthias Meulien
2020-08-08 11:47 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Matthias Meulien @ 2020-05-13 0:05 UTC (permalink / raw)
To: 41225
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
A small patch that adds a customize choice to
`tab-bar-new-tab-choice` in order to show bookmark list in new
tab.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-bookmark.el-Customize-choice-to-show-bookmark-l.patch --]
[-- Type: text/x-diff, Size: 1642 bytes --]
From 67bc218224a548699e974d3276f54ae698987d93 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Tue, 12 May 2020 21:51:40 +0200
Subject: [PATCH] lisp/bookmark.el: Customize choice to show bookmark list in a
new tab
---
etc/NEWS | 5 +++++
lisp/bookmark.el | 14 ++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 01c584833b..f3725e954b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -348,6 +348,11 @@ symbol property to the browsing functions. With a new command
'browse-url-with-browser-kind', an URL can explicitly be browsed with
either an internal or external browser.
+** bookmark
+
+When the 'bookmark.el' library is loaded, a customize choice is added
+to 'tab-bar-new-tab-choice' for new tab to show the bookmark list.
+
** vc-dir.el
*** Support for bookmark.el.
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 0fa77ed322..3a8b07f241 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1666,6 +1666,20 @@ bookmark-bmenu-surreptitiously-rebuild-list
(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."
+ (cond
+ ((get-buffer bookmark-bmenu-buffer))
+ (t (save-excursion
+ (save-window-excursion
+ (bookmark-bmenu-list)
+ (get-buffer bookmark-bmenu-buffer))))))
+
+(nconc (get 'tab-bar-new-tab-choice 'custom-type)
+ '((const :tag "Bookmark List" bookmark-bmenu-get-buffer)))
+
;;;###autoload
(defun bookmark-bmenu-list ()
"Display a list of existing bookmarks.
--
2.20.1
[-- Attachment #3: Type: text/plain, Size: 22 bytes --]
--
Matthias Meulien
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#41225: [PATCH] Show bookmark list in new tab
2020-05-13 0:05 bug#41225: [PATCH] Show bookmark list in new tab Matthias Meulien
@ 2020-08-08 11:47 ` Lars Ingebrigtsen
2020-08-08 11:49 ` Lars Ingebrigtsen
2020-08-09 14:35 ` Matthias Meulien
0 siblings, 2 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-08 11:47 UTC (permalink / raw)
To: Matthias Meulien; +Cc: 41225
Matthias Meulien <orontee@gmail.com> writes:
> A small patch that adds a customize choice to `tab-bar-new-tab-choice`
> in order to show bookmark list in new tab.
[...]
> +When the 'bookmark.el' library is loaded, a customize choice is added
> +to 'tab-bar-new-tab-choice' for new tab to show the bookmark list.
Makes sense to me.
> +;;;###autoload
> +(defun bookmark-bmenu-get-buffer ()
> + "Return the Bookmark List, building it if it doesn't exists.
> +Don't affect the buffer ring order."
> + (cond
> + ((get-buffer bookmark-bmenu-buffer))
> + (t (save-excursion
> + (save-window-excursion
> + (bookmark-bmenu-list)
> + (get-buffer bookmark-bmenu-buffer))))))
I changed this bit into an `or' before committing.
> +(nconc (get 'tab-bar-new-tab-choice 'custom-type)
> + '((const :tag "Bookmark List" bookmark-bmenu-get-buffer)))
And I'm not sure this is safe. For one, if you load the file twice,
you'll get this added twice. And it's destructively modifying a list
that's dumped with Emacs, which I think is undefined behaviour?
So I've added a new utility function custom-add-choice to custom.el that
checks for double entry, and doesn't modify anything destructively, and
pushed this to Emacs 28.1.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41225: [PATCH] Show bookmark list in new tab
2020-08-08 11:47 ` Lars Ingebrigtsen
@ 2020-08-08 11:49 ` Lars Ingebrigtsen
2020-08-09 14:35 ` Matthias Meulien
1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-08 11:49 UTC (permalink / raw)
To: Matthias Meulien; +Cc: 41225
Lars Ingebrigtsen <larsi@gnus.org> writes:
> So I've added a new utility function custom-add-choice to custom.el that
> checks for double entry, and doesn't modify anything destructively, and
> pushed this to Emacs 28.1.
(The function seems like a somewhat generally useful function for modes
to use to add more choices, which is why I didn't keep it as a
bookmark-specific change.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41225: [PATCH] Show bookmark list in new tab
2020-08-08 11:47 ` Lars Ingebrigtsen
2020-08-08 11:49 ` Lars Ingebrigtsen
@ 2020-08-09 14:35 ` Matthias Meulien
2020-08-09 19:51 ` Lars Ingebrigtsen
1 sibling, 1 reply; 5+ messages in thread
From: Matthias Meulien @ 2020-08-09 14:35 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 41225
Lars Ingebrigtsen <larsi@gnus.org> writes:
> And I'm not sure this is safe. For one, if you load the file
> twice, you'll get this added twice. And it's destructively
> modifying a list that's dumped with Emacs, which I think is
> undefined behaviour?
Nice catch. I must admit I don't know the dump mecanism at all...
> So I've added a new utility function custom-add-choice to
> custom.el that checks for double entry, and doesn't modify
> anything destructively, and pushed this to Emacs 28.1.
I tested master today and it works like a charm. Thanks for your
careful reading and improvements!
--
Matthias
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-09 19:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-13 0:05 bug#41225: [PATCH] Show bookmark list in new tab Matthias Meulien
2020-08-08 11:47 ` Lars Ingebrigtsen
2020-08-08 11:49 ` Lars Ingebrigtsen
2020-08-09 14:35 ` Matthias Meulien
2020-08-09 19:51 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.