Last active
May 30, 2024 21:31
-
-
Save jamescherti/095812fefed49894cde5e5945ce5d63a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Gits URL: https://gist.github.com/jamescherti/095812fefed49894cde5e5945ce5d63a | |
;; License: MIT | |
;; Author: James Cherti | |
;; | |
;; Description: | |
;; ------------ | |
;; Make the built-in (save-some-buffers) function automatically save | |
;; buffers that are visiting existing files, without prompting the | |
;; user for confirmation. | |
(defun my-buffer-save-without-query-when-file-exists () | |
"Set buffers visiting existing files to save without querying the user." | |
(let ((file-name (buffer-file-name))) | |
(when (and file-name (file-exists-p file-name)) | |
(setq buffer-save-without-query t)))) | |
(add-hook 'find-file-hook #'my-buffer-save-without-query-when-file-exists) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment