Function: treemacs-add-bookmark
treemacs-add-bookmark is an autoloaded, interactive and byte-compiled
function defined in treemacs-bookmarks.el.
Signature
(treemacs-add-bookmark)
Documentation
Add the current node to Emacs' list of bookmarks.
For file and directory nodes their absolute path is saved. Tag nodes additionally also save the tag's position. A tag can only be bookmarked if the treemacs node is pointing to a valid buffer position.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-bookmarks.el
;;;###autoload
(defun treemacs-add-bookmark ()
"Add the current node to Emacs' list of bookmarks.
For file and directory nodes their absolute path is saved. Tag nodes
additionally also save the tag's position. A tag can only be bookmarked if the
treemacs node is pointing to a valid buffer position."
(interactive)
(treemacs-with-current-button
"There is nothing to bookmark here."
(pcase (treemacs-button-get current-btn :state)
((or 'file-node-open 'file-node-closed 'dir-node-open 'dir-node-closed)
(-let [name (treemacs--read-string "Bookmark name: ")]
(when name
(bookmark-store name `((filename . ,(treemacs-button-get current-btn :path))) nil))))
('tag-node
(-let [(tag-buffer . tag-pos)
(treemacs--extract-position (treemacs-button-get current-btn :marker) nil)]
(if (buffer-live-p tag-buffer)
(-let [name (treemacs--read-string "Bookmark name: ")]
(when name
(bookmark-store
name
`((filename . ,(buffer-file-name tag-buffer))
(position . ,tag-pos))
nil)))
(treemacs-log-failure "Tag info can not be saved because it is not pointing to a live buffer."))))
((or 'tag-node-open 'tag-node-closed)
(treemacs-pulse-on-failure "There is nothing to bookmark here.")))))