all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Federico <federicotedin@gmail.com>
To: aaronjensen@gmail.com
Cc: 31039@debbugs.gnu.org
Subject: bug#31039: 27.0.50; allow silencing auto-save
Date: Fri, 3 Aug 2018 21:51:53 -0300	[thread overview]
Message-ID: <CAA8GjPn_ZAosFke6MwKxcfv0Lanu5eKau8KVEF=Qy-T5h=KsVA@mail.gmail.com> (raw)
In-Reply-To: <m2k1to7j75.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

I've prepared a patch to add this feature (see attached file). Since
this is my first contribution to this project (and also my first time
sending a patch via email), it's possible I've made some mistakes
along the way. Any feedback is appreciated.

[-- Attachment #2: auto-save-quiet.patch --]
[-- Type: text/x-diff, Size: 3476 bytes --]

From 7a310b047720a244478a9991f96a86901cf897de Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@gmail.com>
Date: Fri, 3 Aug 2018 21:26:58 -0300
Subject: [PATCH] Add variable auto-save-quiet

* src/keyboarc.c (auto_save_quiet): New variable, allows suppressing
  auto-saving message.
* lisp/cus-start.el (standard): Add auto-save-quiet variable.
* doc/emacs/files.texi: Update manual.
---
 doc/emacs/files.texi | 11 ++++++-----
 lisp/cus-start.el    |  1 +
 src/keyboard.c       |  8 ++++++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index a7cc57e4e9..0635aeba71 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1023,11 +1023,12 @@ Auto Save
 
   When Emacs determines that it is time for auto-saving, it considers
 each buffer, and each is auto-saved if auto-saving is enabled for it
-and it has been changed since the last time it was auto-saved.  The
-message @samp{Auto-saving...} is displayed in the echo area during
-auto-saving, if any files are actually auto-saved.  Errors occurring
-during auto-saving are caught so that they do not interfere with the
-execution of commands you have been typing.
+and it has been changed since the last time it was auto-saved.  When
+the @code{auto-save-quiet} variable is set to @code{nil}, the message
+@samp{Auto-saving...} is displayed in the echo area during auto-saving,
+if any files are actually auto-saved.  Errors occurring during auto-saving
+are caught so that they do not interfere with the execution of commands
+you have been typing.
 
 @menu
 * Files: Auto Save Files.       The file where auto-saved changes are
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index f31d1df309..53c051a4c0 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -345,6 +345,7 @@ minibuffer-prompt-properties--setter
 	     ;; keyboard.c
 	     (meta-prefix-char keyboard character)
 	     (auto-save-interval auto-save integer)
+             (auto-save-quiet auto-save boolean)
 	     (auto-save-timeout auto-save (choice (const :tag "off" nil)
 						  (integer :format "%v")))
 	     (echo-keystrokes minibuffer number)
diff --git a/src/keyboard.c b/src/keyboard.c
index 7ab9a6069a..0eb74c6dc7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2626,7 +2626,7 @@ read_char (int commandflag, Lisp_Object map,
       && num_nonmacro_input_events - last_auto_save > max (auto_save_interval, 20)
       && !detect_input_pending_run_timers (0))
     {
-      Fdo_auto_save (Qnil, Qnil);
+      Fdo_auto_save (auto_save_quiet, Qnil);
       /* Hooks can actually change some buffers in auto save.  */
       redisplay ();
     }
@@ -2691,7 +2691,7 @@ read_char (int commandflag, Lisp_Object map,
 	  if (EQ (tem0, Qt)
 	      && ! CONSP (Vunread_command_events))
 	    {
-	      Fdo_auto_save (Qnil, Qnil);
+	      Fdo_auto_save (auto_save_quiet, Qnil);
 	      redisplay ();
 	    }
 	}
@@ -11391,6 +11391,10 @@ result of looking up the original command in the active keymaps.  */);
 Zero means disable autosaving due to number of characters typed.  */);
   auto_save_interval = 300;
 
+  DEFVAR_LISP ("auto-save-quiet", auto_save_quiet,
+	       doc: /* Non-nil means do not print any message when auto-saving. */);
+  auto_save_quiet = Qnil;
+
   DEFVAR_LISP ("auto-save-timeout", Vauto_save_timeout,
 	       doc: /* Number of seconds idle time before auto-save.
 Zero or nil means disable auto-saving due to idleness.
-- 
2.17.1


  reply	other threads:[~2018-08-04  0:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03  9:06 bug#31039: 27.0.50; allow silencing auto-save Aaron Jensen
2018-08-04  0:51 ` Federico [this message]
2018-08-06  2:43   ` Noam Postavsky
2018-08-06 14:56     ` Eli Zaretskii
2018-08-06 15:05     ` Eli Zaretskii
2018-08-06 23:02       ` Federico
2018-08-07 14:54         ` Eli Zaretskii
2018-08-07 18:36           ` Federico
2018-08-11 16:10             ` Aaron Jensen
2018-08-11  9:31         ` Eli Zaretskii
2018-08-11 10:11           ` Eli Zaretskii
2018-08-11 18:20             ` Federico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA8GjPn_ZAosFke6MwKxcfv0Lanu5eKau8KVEF=Qy-T5h=KsVA@mail.gmail.com' \
    --to=federicotedin@gmail.com \
    --cc=31039@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.