From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: auto-save-include-big-deletions Date: Tue, 21 Jul 2009 13:49:19 -0400 Message-ID: <87ws620vvk.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248198592 19489 80.91.229.12 (21 Jul 2009 17:49:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 17:49:52 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 21 19:49:45 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTJTD-0004m1-Pi for ged-emacs-devel@m.gmane.org; Tue, 21 Jul 2009 19:49:44 +0200 Original-Received: from localhost ([127.0.0.1]:47431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTJTD-0003dF-8r for ged-emacs-devel@m.gmane.org; Tue, 21 Jul 2009 13:49:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTJT6-0003c4-Sa for emacs-devel@gnu.org; Tue, 21 Jul 2009 13:49:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTJT2-0003Xu-CL for emacs-devel@gnu.org; Tue, 21 Jul 2009 13:49:36 -0400 Original-Received: from [199.232.76.173] (port=57928 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTJT2-0003Xm-5T for emacs-devel@gnu.org; Tue, 21 Jul 2009 13:49:32 -0400 Original-Received: from pantheon-po38.its.yale.edu ([130.132.50.97]:55979) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MTJT1-0003Yv-PR for emacs-devel@gnu.org; Tue, 21 Jul 2009 13:49:31 -0400 Original-Received: from furry (dhcp128036014244.central.yale.edu [128.36.14.244]) (authenticated bits=0) by pantheon-po38.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id n6LHnNwu012453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Jul 2009 13:49:30 -0400 Original-Received: by furry (Postfix, from userid 1000) id 7357CC056; Tue, 21 Jul 2009 13:49:19 -0400 (EDT) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:112938 Archived-At: 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