From: Chong Yidong <cyd@stupidchicken.com>
To: emacs-devel@gnu.org
Subject: auto-save-include-big-deletions
Date: Tue, 21 Jul 2009 13:49:19 -0400 [thread overview]
Message-ID: <87ws620vvk.fsf@stupidchicken.com> (raw)
To handle the rmail auto-save problem in a cleaner way, I propose the
following change to fileio.c, adding auto-save-include-big-deletions.
If this variable is non-nil, that disables the turning off of auto-save
after big deletions. (Rmail can then bind this locally to t.)
Any objections?
*** emacs/src/fileio.c.~1.654.2.2.~ 2009-07-07 18:45:24.000000000 -0400
--- emacs/src/fileio.c 2009-07-21 12:17:36.000000000 -0400
***************
*** 193,198 ****
--- 193,201 ----
/* Whether or not files are auto-saved into themselves. */
Lisp_Object Vauto_save_visited_file_name;
+ /* Whether or not to continue auto-saving after a large deletion. */
+ Lisp_Object Vauto_save_include_big_deletions;
+
/* On NT, specifies the directory separator character, used (eg.) when
expanding file names. This can be bound to / or \. */
Lisp_Object Vdirectory_sep_char;
***************
*** 5321,5328 ****
&& EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
continue;
! if ((XFASTINT (b->save_length) * 10
! > (BUF_Z (b) - BUF_BEG (b)) * 13)
/* A short file is likely to change a large fraction;
spare the user annoying messages. */
&& XFASTINT (b->save_length) > 5000
--- 5324,5333 ----
&& EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
continue;
! set_buffer_internal (b);
! if (NILP (Vauto_save_include_big_deletions)
! && (XFASTINT (b->save_length) * 10
! > (BUF_Z (b) - BUF_BEG (b)) * 13)
/* A short file is likely to change a large fraction;
spare the user annoying messages. */
&& XFASTINT (b->save_length) > 5000
***************
*** 5341,5347 ****
Fsleep_for (make_number (1), Qnil);
continue;
}
- set_buffer_internal (b);
if (!auto_saved && NILP (no_message))
message1 ("Auto-saving...");
internal_condition_case (auto_save_1, Qt, auto_save_error);
--- 5346,5351 ----
***************
*** 5704,5709 ****
--- 5708,5720 ----
Normally auto-save files are written under other names. */);
Vauto_save_visited_file_name = Qnil;
+ DEFVAR_LISP ("auto-save-include-big-deletions", &Vauto_save_include_big_deletions,
+ doc: /* Non-nil says to auto-save even if a large part of the text is deleted.
+ If nil, auto-save is disabled in the buffer if a substantial part of
+ the text is deleted; this is the default, because the auto-save file
+ is usually more useful if it contains the deleted text. */);
+ Vauto_save_include_big_deletions = Qnil;
+
#ifdef HAVE_FSYNC
DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync,
doc: /* *Non-nil means don't call fsync in `write-region'.
Diff finished. Tue Jul 21 13:45:55 2009
next reply other threads:[~2009-07-21 17:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 17:49 Chong Yidong [this message]
2009-07-21 18:28 ` auto-save-include-big-deletions Eli Zaretskii
2009-07-22 22:21 ` auto-save-include-big-deletions Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ws620vvk.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
/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 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).