Function: magit--make-bookmark

magit--make-bookmark is a byte-compiled function defined in magit-section.el.

Signature

(magit--make-bookmark)

Documentation

Create a bookmark for the current Magit buffer.

Input values are the major-mode's magit-bookmark-name method, and the buffer-local values of the variables referenced in its magit-bookmark-variables property.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit--make-bookmark ()
  "Create a bookmark for the current Magit buffer.
Input values are the major-mode's `magit-bookmark-name' method,
and the buffer-local values of the variables referenced in its
`magit-bookmark-variables' property."
  (require 'bookmark)
  (if (plist-member (symbol-plist major-mode) 'magit-bookmark-variables)
      ;; `bookmark-make-record-default's return value does not match
      ;; (NAME . ALIST), even though it is used as the default value
      ;; of `bookmark-make-record-function', which states that such
      ;; functions must do that.  See #4356.
      (let ((bookmark (cons nil (bookmark-make-record-default 'no-file))))
        (bookmark-prop-set bookmark 'handler  #'magit--handle-bookmark)
        (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)))
        (magit-bookmark-get-value bookmark)
        (bookmark-prop-set
         bookmark 'magit-hidden-sections
         (seq-keep (##and (oref % hidden)
                          (cons (oref % type)
                                (magit-bookmark--get-child-value %)))
                   (oref magit-root-section children)))
        bookmark)
    (user-error "Bookmarking is not implemented for %s buffers" major-mode)))