unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis.
@ 2020-04-01 17:57 Philipp Stephani
  2020-04-02  9:24 ` Robert Pluim
  2020-04-02 13:38 ` Eli Zaretskii
  0 siblings, 2 replies; 24+ messages in thread
From: Philipp Stephani @ 2020-04-01 17:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* lisp/files.el (auto-save-visited-inhibit): New buffer-local
variable.
(auto-save-visited-mode): Use it.

* etc/NEWS: Document new variable.
---
 etc/NEWS      | 4 ++++
 lisp/files.el | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 765a923bf7..659695b40f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,6 +93,10 @@ line numbers that were previously jumped to.
 ** When 'suggest-key-bindings' is non-nil, the completion list of 'M-x'
 shows equivalent key bindings for all commands that have them.
 
++++
+** Autosaving via 'auto-save-visited-mode' can now be inhibited using
+the buffer-local variable 'auto-save-visited-inhibit'.
+
 \f
 * Changes in Specialized Modes and Packages in Emacs 28.1
 
diff --git a/lisp/files.el b/lisp/files.el
index 55a0958f54..f3ea1d083f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -425,12 +425,17 @@ auto-save-visited-interval
          (when auto-save--timer
            (timer-set-idle-time auto-save--timer value :repeat))))
 
+(defvar-local auto-save-visited-inhibit nil
+  "If non-nil, ignore this buffer for `auto-save-visited-mode'.")
+
 (define-minor-mode auto-save-visited-mode
   "Toggle automatic saving to file-visiting buffers on or off.
 
 Unlike `auto-save-mode', this mode will auto-save buffer contents
 to the visited files directly and will also run all save-related
-hooks.  See Info node `Saving' for details of the save process."
+hooks.  See Info node `Saving' for details of the save process.
+Buffers in which the variable `auto-save-visted-mode' is non-nil
+are ignored."
   :group 'auto-save
   :global t
   (when auto-save--timer (cancel-timer auto-save--timer))
@@ -441,6 +446,7 @@ auto-save-visited-mode
            #'save-some-buffers :no-prompt
            (lambda ()
              (and buffer-file-name
+                  (not auto-save-visited-inhibit)
                   (not (and buffer-auto-save-file-name
                             auto-save-visited-file-name))))))))
 
-- 
2.26.0.rc2.310.g2932bb562d-goog




^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-05-25 19:16 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 17:57 [PATCH] Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis Philipp Stephani
2020-04-02  9:24 ` Robert Pluim
2020-04-02  9:40   ` Philipp Stephani
2020-04-02  9:47     ` Robert Pluim
2020-04-02  9:59       ` Štěpán Němec
2020-04-02 11:15         ` Philipp Stephani
2020-04-02 11:27           ` Štěpán Němec
2020-04-02 13:38 ` Eli Zaretskii
2020-04-02 15:22   ` Stefan Monnier
2020-04-05  9:50     ` Philipp Stephani
2020-04-05 14:18       ` Stefan Monnier
2020-04-05 15:51         ` Philipp Stephani
2020-04-05 18:49           ` Stefan Monnier
2020-04-05 19:58             ` Philipp Stephani
2020-04-08 11:43               ` Philipp Stephani
2020-04-08 12:03                 ` Eli Zaretskii
2020-04-08 12:19                   ` Philipp Stephani
2020-04-08 13:07                     ` Eli Zaretskii
2020-04-08 14:58                 ` Stefan Monnier
2020-04-11 16:57                   ` Philipp Stephani
2020-04-11 17:11                     ` Stefan Monnier
2020-05-25 19:16                       ` Philipp Stephani
2020-04-05  9:52   ` Philipp Stephani
2020-04-05 13:11     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).