[gnu.emacs.bug] A minor patch to emacs

tower@WHEATIES.AI.MIT.EDU (Leonard H. Tower Jr.) (01/10/89)

Return-Path: <mcvax!diku.dk!seindal@uunet.uu.net>
From: mcvax!diku.dk!seindal@uunet.uu.net
To: The GNU hackers <gnu@prep.ai.mit.edu>
Slyrf: Heck, Yes!
Subject: A minor patch to emacs
Date: Thu, 05 Jan 89 14:56:32 +0100

Hi,

All these silly messages about "buffer has shrunk a lot; not auto-saving" has
been annoying me a lot, so I made this little change to fileio.c, so the
messages are controlled by a lisp variable.  If auto-save-no-complaints is set
to non-nil, buffers will be auto-saved no matter how much they have shrunk.

Unfortunately, it doesn't quite work if auto-save-no-complaints is made
buffer-local.  In that case all buffers are tested against the current buffers
value.  I don't really know how to fix this, so if any of you can help, I
would appreciate it.  I can live with it as it is now, but the ability to make
it buffer-local would be a nice feature.

Rene' Seindal, University of Copenhagen, Denmark. (seindal@diku.dk)

------------------------------------------------------------------------
*** /tmp/,RCSt1a04625	Thu Jan  5 14:37:01 1989
--- src/fileio.c	Tue Jan  3 16:53:06 1989
***************
*** 75,80 ****
--- 75,85 ----
   start out by inserting the default directory into the minibuffer. */
  int insert_default_directory;
  
+ /* Rene' Seindal (seindal@sleipner) Sat Dec 10 22:06:42 1988 */
+ /* Nonzero means we do not want ANY complaints about shrunk buffers
+  from do-auto-save. */
+ int auto_save_no_complaints;
+ 
  /* On VMS, nonzero means write new files with record format stmlf.
     Zero means use var format.  */
  int vms_stmlf_recfm;
***************
*** 1922,1929 ****
  	  && b->save_modified < b->text.modified
  	  && b->auto_save_modified < b->text.modified)
  	{
! 	  if ((XFASTINT (b->save_length) * 10
! 	       > (b->text.size1 + b->text.size2) * 13)
  	      /* These messages are frequent and annoying for `*mail*'.  */
  	      && !EQ (b->filename, Qnil))
  	    {
--- 1927,1936 ----
  	  && b->save_modified < b->text.modified
  	  && b->auto_save_modified < b->text.modified)
  	{
! 	  if (auto_save_no_complaints == 0
! 	      /* These messages are frequent and annoying.  */
! 	      && (XFASTINT (b->save_length) * 10
! 		  > (b->text.size1 + b->text.size2) * 13)
  	      /* These messages are frequent and annoying for `*mail*'.  */
  	      && !EQ (b->filename, Qnil))
  	    {
***************
*** 2132,2137 ****
--- 2139,2148 ----
    DEFVAR_BOOL ("insert-default-directory", &insert_default_directory,
      "*Non-nil means when reading a filename start with default dir in minibuffer.");
    insert_default_directory = 1;
+ 
+   DEFVAR_BOOL ("auto-save-no-complaints", &auto_save_no_complaints,
+     "*Non-nil means do-auto-save will never complain about shrunk buffers.");
+   auto_save_no_complaints = 0;
  
    DEFVAR_BOOL ("vms-stmlf-recfm", &vms_stmlf_recfm,
      "*Non-nil means write new files with record format `stmlf'.\n\

julian@uhccux.uhcc.hawaii.edu (Julian Cowley) (01/11/89)

In article <8901100150.AA02627@wheat-chex.ai.mit.edu> mcvax!diku.dk!seindal@uunet.uu.net writes:
>All these silly messages about "buffer has shrunk a lot; not auto-saving" has
>been annoying me a lot, so I made this little change to fileio.c, so the
>messages are controlled by a lisp variable.  If auto-save-no-complaints is set
>to non-nil, buffers will be auto-saved no matter how much they have shrunk.

The message is annoying, I agree, but it does serve a purpose.
Its main function is to guard against auto-saving an
unintentionally large kill, in case the system crashes before
the change can be corrected.  I like having that extra
insurance.

However, in more cases than not, the change *is* intentional,
and results in Emacs failing to auto-save legitmate changes.
There has to be some way to tell Emacs that that is what is
wanted.  Having a Lisp variable control whether the feature is
on or off is not enough -- I would rather just tell Emacs to
turn auto-saving back on each time it gives me the message (I am
not debating the usefulness of the Lisp variable, but rather
Emacs behaviour without it).  To my mind, toggling auto-save
ought to work, but it doesn't; the only way that I know of is to
fully save the whole buffer to disk, and this may not be totally
desirable, either.

I propose that the message be changed to read something like:
"Buffer has shrunk a lot; not auto-saving.  M-x auto-save to
resume."

julian@uhccux.uhcc.hawaii.edu
uunet!ucsd!nosc!uhccux!julian
julian@uhccux.bitnet
"People who aren't amused don't talk."