branch: elpa/magit
commit 4067c7bfcb5360b1726ee1015ca077889ef96cf7
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-bookmark-get-value: New generic function
This makes it possible to use Magit's bookmark support in Forge.
---
lisp/magit-bookmark.el | 5 +++++
lisp/magit-section.el | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/magit-bookmark.el b/lisp/magit-bookmark.el
index 963b7e1caf8..bbb12151562 100644
--- a/lisp/magit-bookmark.el
+++ b/lisp/magit-bookmark.el
@@ -37,6 +37,11 @@
(cl-defmethod magit-bookmark-get-filename (&context (major-mode magit-mode))
(magit-toplevel))
+(cl-defmethod magit-bookmark-get-value
+ (bookmark &context (major-mode magit-mode))
+ (dolist (var (get major-mode 'magit-bookmark-variables))
+ (bookmark-prop-set bookmark var (symbol-value var))))
+
(cl-defmethod magit-bookmark-get-buffer-create
(bookmark (mode (derived-mode magit-mode)))
(let ((default-directory (bookmark-get-filename bookmark))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index c6b6c971876..847ec7e9ec0 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -2496,6 +2496,8 @@ necessary. For use as `imenu-default-goto-function' in
(cl-defgeneric magit-bookmark-get-filename ()
(or (buffer-file-name) (buffer-name)))
+(cl-defgeneric magit-bookmark-get-value (bookmark mode))
+
(cl-defgeneric magit-bookmark--get-child-value (section)
(oref section value))
@@ -2517,8 +2519,7 @@ and the buffer-local values of the variables referenced
in its
(bookmark-prop-set bookmark 'mode major-mode)
(bookmark-prop-set bookmark 'filename (magit-bookmark-get-filename))
(bookmark-prop-set bookmark 'defaults (list (magit-bookmark-name)))
- (dolist (var (get major-mode 'magit-bookmark-variables))
- (bookmark-prop-set bookmark var (symbol-value var)))
+ (magit-bookmark-get-value bookmark)
(bookmark-prop-set
bookmark 'magit-hidden-sections
(seq-keep (##and (oref % hidden)