fix: minimal list-project-bookmarks, no save, just pointer swap

This commit is contained in:
2026-07-17 16:58:26 -04:00
parent 84006b4412
commit bab18715a5
2 changed files with 2 additions and 26 deletions

View File

@@ -3683,7 +3683,7 @@ Project bookmarks go to .bookmarks file in project root."
;; Bindings ;; Bindings
(defun gortium/list-project-bookmarks () (defun gortium/list-project-bookmarks ()
"Show project bookmark menu. Switches to .bookmarks, restores globals on quit." "Show .bookmarks menu. Switches bookmark-default-file, restores ref on quit."
(interactive) (interactive)
(if (not (projectile-project-p)) (if (not (projectile-project-p))
(user-error "Not in a project") (user-error "Not in a project")
@@ -3692,29 +3692,15 @@ Project bookmarks go to .bookmarks file in project root."
(saved-file bookmark-default-file)) (saved-file bookmark-default-file))
(if (not (file-exists-p proj-file)) (if (not (file-exists-p proj-file))
(message "No .bookmarks file in this project.") (message "No .bookmarks file in this project.")
;; Switch to project bookmarks
(setq bookmark-default-file proj-file) (setq bookmark-default-file proj-file)
(bookmark-load proj-file t) (bookmark-load proj-file t)
(bookmark-bmenu-list) (bookmark-bmenu-list)
;; Restore on quit
(with-current-buffer "*Bookmark List*" (with-current-buffer "*Bookmark List*"
(add-hook 'kill-buffer-hook (add-hook 'kill-buffer-hook
(lambda () (lambda ()
(ignore-errors (bookmark-save))
(setq bookmark-default-file saved-file) (setq bookmark-default-file saved-file)
(setq bookmark-alist saved-alist)) (setq bookmark-alist saved-alist))
nil t)))))) nil t))))))
(map! :leader
:desc "Set bookmark (global/project)"
"b m" #'gortium/bookmark-set
:desc "List project bookmarks"
"p RET" #'gortium/list-project-bookmarks)
#+end_src
** Refile task to Roam dailies
#+begin_src emacs-lisp
(defun gortium/refile-to-today-daily () (defun gortium/refile-to-today-daily ()
"Refile the current subtree under the 'Journal' headline in today's daily note. "Refile the current subtree under the 'Journal' headline in today's daily note.
This version uses `org-roam-dailies-capture-today` to ensure the daily note This version uses `org-roam-dailies-capture-today` to ensure the daily note

View File

@@ -2753,7 +2753,7 @@ Project bookmarks go to .bookmarks file in project root."
;; Bindings ;; Bindings
(defun gortium/list-project-bookmarks () (defun gortium/list-project-bookmarks ()
"Show project bookmark menu. Switches to .bookmarks, restores globals on quit." "Show .bookmarks menu. Switches bookmark-default-file, restores ref on quit."
(interactive) (interactive)
(if (not (projectile-project-p)) (if (not (projectile-project-p))
(user-error "Not in a project") (user-error "Not in a project")
@@ -2762,25 +2762,15 @@ Project bookmarks go to .bookmarks file in project root."
(saved-file bookmark-default-file)) (saved-file bookmark-default-file))
(if (not (file-exists-p proj-file)) (if (not (file-exists-p proj-file))
(message "No .bookmarks file in this project.") (message "No .bookmarks file in this project.")
;; Switch to project bookmarks
(setq bookmark-default-file proj-file) (setq bookmark-default-file proj-file)
(bookmark-load proj-file t) (bookmark-load proj-file t)
(bookmark-bmenu-list) (bookmark-bmenu-list)
;; Restore on quit
(with-current-buffer "*Bookmark List*" (with-current-buffer "*Bookmark List*"
(add-hook 'kill-buffer-hook (add-hook 'kill-buffer-hook
(lambda () (lambda ()
(ignore-errors (bookmark-save))
(setq bookmark-default-file saved-file) (setq bookmark-default-file saved-file)
(setq bookmark-alist saved-alist)) (setq bookmark-alist saved-alist))
nil t)))))) nil t))))))
(map! :leader
:desc "Set bookmark (global/project)"
"b m" #'gortium/bookmark-set
:desc "List project bookmarks"
"p RET" #'gortium/list-project-bookmarks)
(defun gortium/refile-to-today-daily () (defun gortium/refile-to-today-daily ()
"Refile the current subtree under the 'Journal' headline in today's daily note. "Refile the current subtree under the 'Journal' headline in today's daily note.
This version uses `org-roam-dailies-capture-today` to ensure the daily note This version uses `org-roam-dailies-capture-today` to ensure the daily note