diff options
author | JSDurand <mmemmew@gmail.com> | 2023-06-18 16:45:25 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-06-18 16:45:25 +0800 |
commit | 3d8fffd03f44e5734e96cb76ea5b29b544955697 (patch) | |
tree | 2b3c592da1e49fc273fade71c919a06fc621cbd3 | |
parent | 7129d2947b11dc5104e5ae21d6fadd1bc42c1103 (diff) |
desktop: Do not save bookmarks in the hook
* desktop-conf.el (durand-bookmark-save): I do not want to save
bookmarks as a consequence of saving the desktop file now.
(desktop-save-hook): Remove the previous function from the hook.
(ctl-x-r-map): And remove the binding to save desktop files.
Basically my plan is to have a keybinding that saves the bookmarks
only, by default. When I want to save the desktop file as well, I
pass an interactive universal prefix argument to the responsible
function. I think this works better than to save both by default: it
is kind of a waste of computing power, from my point of view.
But of course I still want to save bookmarks if Emacs accidentally
crashes and it saves the desktop file because of that. Thus we shall
use a variable to control this behaviour, in order not to cause
infinite recursion.
-rw-r--r-- | desktop-conf.el | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/desktop-conf.el b/desktop-conf.el index 3485b38..462c549 100644 --- a/desktop-conf.el +++ b/desktop-conf.el @@ -38,15 +38,6 @@ (setq desktop-restore-frames nil) (setq desktop-save 'ask-if-new) -;;; Also save bookmarks before - -(defun durand-bookmark-save () - "Silently save bookmarks." - (let ((inhibit-message t)) - (cond ((featurep 'bookmark) (bookmark-save nil nil nil))))) - -(add-hook 'desktop-save-hook #'durand-bookmark-save) - ;;; Overwrite the saving function ;; Modify to hard-code the directory to save the desktop file. @@ -207,15 +198,5 @@ no questions asked." (desktop-save-mode 1) -;;; Add a binding for saving desktop files - -;; This was used for `copy-to-register', but we can also use `C-x r -;; x'. - -;; This was used to save bookmarks, but I also save bookmarks after -;; saving the desktop file, so I just bind it to save desktop instead. - -(define-key ctl-x-r-map (vector ?s) #'desktop-save) - (provide 'desktop-conf) ;;; desktop-conf.el ends here |