fix: restore globals after RET jump too, not just q
This commit is contained in:
@@ -3684,9 +3684,8 @@ Project bookmarks go to .bookmarks file in project root."
|
|||||||
(message "Transferred '%s' to global" name)))
|
(message "Transferred '%s' to global" name)))
|
||||||
(message "No project bookmarks to transfer."))))
|
(message "No project bookmarks to transfer."))))
|
||||||
|
|
||||||
;; Bindings
|
|
||||||
(defun gortium/list-project-bookmarks ()
|
(defun gortium/list-project-bookmarks ()
|
||||||
"Show .bookmarks menu. Switches bookmark-default-file, restores ref on quit."
|
"Show project bookmarks menu — restores globals after RET jump and on q."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (not (projectile-project-p))
|
(if (not (projectile-project-p))
|
||||||
(user-error "Not in a project")
|
(user-error "Not in a project")
|
||||||
@@ -3695,25 +3694,25 @@ 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.")
|
||||||
(setq bookmark-default-file proj-file)
|
;; Read project bookmarks directly (read, not bookmark-load)
|
||||||
(bookmark-load proj-file t)
|
(setq bookmark-alist
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents proj-file)
|
||||||
|
(read (current-buffer))))
|
||||||
(bookmark-bmenu-list)
|
(bookmark-bmenu-list)
|
||||||
|
;; Restore globals after each RET jump AND on q
|
||||||
(with-current-buffer "*Bookmark List*"
|
(with-current-buffer "*Bookmark List*"
|
||||||
|
(local-set-key (kbd "RET")
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(bookmark-bmenu-this-window)
|
||||||
|
(setq bookmark-alist saved-alist)
|
||||||
|
(setq bookmark-default-file saved-file)))
|
||||||
(add-hook 'kill-buffer-hook
|
(add-hook 'kill-buffer-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(setq bookmark-default-file saved-file)
|
(setq bookmark-alist saved-alist)
|
||||||
(setq bookmark-alist saved-alist))
|
(setq bookmark-default-file saved-file))
|
||||||
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 done task
|
|
||||||
#+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
|
||||||
|
|||||||
@@ -2751,9 +2751,8 @@ Project bookmarks go to .bookmarks file in project root."
|
|||||||
(message "Transferred '%s' to global" name)))
|
(message "Transferred '%s' to global" name)))
|
||||||
(message "No project bookmarks to transfer."))))
|
(message "No project bookmarks to transfer."))))
|
||||||
|
|
||||||
;; Bindings
|
|
||||||
(defun gortium/list-project-bookmarks ()
|
(defun gortium/list-project-bookmarks ()
|
||||||
"Show .bookmarks menu. Switches bookmark-default-file, restores ref on quit."
|
"Show project bookmarks menu — restores globals after RET jump and on q."
|
||||||
(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,22 +2761,25 @@ 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.")
|
||||||
(setq bookmark-default-file proj-file)
|
;; Read project bookmarks directly (read, not bookmark-load)
|
||||||
(bookmark-load proj-file t)
|
(setq bookmark-alist
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents proj-file)
|
||||||
|
(read (current-buffer))))
|
||||||
(bookmark-bmenu-list)
|
(bookmark-bmenu-list)
|
||||||
|
;; Restore globals after each RET jump AND on q
|
||||||
(with-current-buffer "*Bookmark List*"
|
(with-current-buffer "*Bookmark List*"
|
||||||
|
(local-set-key (kbd "RET")
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(bookmark-bmenu-this-window)
|
||||||
|
(setq bookmark-alist saved-alist)
|
||||||
|
(setq bookmark-default-file saved-file)))
|
||||||
(add-hook 'kill-buffer-hook
|
(add-hook 'kill-buffer-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(setq bookmark-default-file saved-file)
|
(setq bookmark-alist saved-alist)
|
||||||
(setq bookmark-alist saved-alist))
|
(setq bookmark-default-file saved-file))
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user