From 3d8fffd03f44e5734e96cb76ea5b29b544955697 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 18 Jun 2023 16:45:25 +0800 Subject: 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. --- desktop-conf.el | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'desktop-conf.el') 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 -- cgit v1.2.3-18-g5258