Function: vc-jj-log-view-bookmark-rename

vc-jj-log-view-bookmark-rename is an interactive and natively compiled function defined in vc-jj.el.

Signature

(vc-jj-log-view-bookmark-rename)

Documentation

Rename a bookmark pointing to the revision at point.

When called in a vc-jj-log-view-mode buffer, rename the bookmark pointing to the revision at point. If there are multiple bookmarks pointing to the revision, prompt the user to one of these bookmarks to rename.

Key Bindings

vc-jj-log-view-mode-map b r

Source Code

;; Defined in /nix/store/j1ql1qsv99iszr5pqf5fk9yfcl5pq4nv-emacs-packages-deps/share/emacs/site-lisp/elpa/vc-jj-0.5/vc-jj.el
(defun vc-jj-log-view-bookmark-rename ()
  "Rename a bookmark pointing to the revision at point.
When called in a `vc-jj-log-view-mode' buffer, rename the bookmark
pointing to the revision at point.  If there are multiple bookmarks
pointing to the revision, prompt the user to one of these bookmarks to
rename."
  (interactive nil vc-jj-log-view-mode)
  (when (derived-mode-p 'vc-jj-log-view-mode)
    (let* ((target-rev (log-view-current-tag))
           (bookmarks-at-rev
            (or (vc-jj--process-lines "bookmark" "list" "-r" target-rev
                                      "-T" "if(!self.remote(), self.name() ++ \"\n\")")
                ;; FIXME(KrisB 2025-12-09): Is there a more
                ;; idiomatic/cleaner way to exit with a message than a
                ;; `user-error' in the middle of a let binding?
                (user-error "No bookmarks at %s"
                            (propertize
                             (vc-jj--command-parseable "show" "--no-patch"
                                                       "-r" target-rev
                                                       "-T" "change_id.shortest()")
                             'face 'log-view-message))))
           (bookmark-old
            (if (= 1 (length bookmarks-at-rev))
                (car bookmarks-at-rev)
              (completing-read "Which bookmark to rename? " bookmarks-at-rev)))
           (bookmark-new
            (read-string (format-prompt "Rename %s to" nil bookmark-old))))
      (vc-jj--command-dispatched nil 0 nil "bookmark" "rename" bookmark-old bookmark-new
                                 "--quiet")
      (revert-buffer))))