changeset 6678:e29adbacde1d

(Fdo_auto_save): Don't turn off auto save mode. Instead, store -1 in b->save_length. And don't auto save if there is -1 there. (Vinhibit_file_name_handlers): New var. (syms_of_fileio): Set up Lisp var. (Ffind_file_name_handler): Obey the variable.
author Richard M. Stallman <rms@gnu.org>
date Tue, 05 Apr 1994 03:50:46 +0000
parents 3c7e3d1cc3ad
children 490b7e2db978
files src/fileio.c
diffstat 1 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Tue Apr 05 03:49:42 1994 +0000
+++ b/src/fileio.c	Tue Apr 05 03:50:46 1994 +0000
@@ -125,6 +125,8 @@
    Zero means use var format.  */
 int vms_stmlf_recfm;
 
+static Lisp_Object Vinhibit_file_name_handlers;
+
 Lisp_Object Qfile_error, Qfile_already_exists;
 
 Lisp_Object Qfile_name_history;
@@ -196,7 +198,10 @@
   "Return FILENAME's handler function, if its syntax is handled specially.\n\
 Otherwise, return nil.\n\
 A file name is handled if one of the regular expressions in\n\
-`file-name-handler-alist' matches it.")
+`file-name-handler-alist' matches it.\n\n\
+If FILENAME is a member of `inhibit-file-name-handlers',\n\
+then its handler is not run.  This is lets handlers\n\
+use the standard functions without calling themselves recursively.")
   (filename)
     Lisp_Object filename;
 {
@@ -205,6 +210,19 @@
 
   CHECK_STRING (filename, 0);
 
+  if (! NILP (Vinhibit_file_name_handlers))
+    {
+      Lisp_Object tail;
+      for (tail = Vinhibit_file_name_handlers; CONSP (tail);
+	   tail = XCONS (tail)->cdr)
+	{
+	  Lisp_Object tem;
+	  tem = Fstring_equal (tail, filename);
+	  if (!NILP (tem))
+	    return Qnil;
+	}
+    }
+
   for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons;
        chain = XCONS (chain)->cdr)
     {
@@ -3486,6 +3504,8 @@
 	if (XTYPE (b->auto_save_file_name) == Lisp_String
 	    && b->save_modified < BUF_MODIFF (b)
 	    && b->auto_save_modified < BUF_MODIFF (b)
+	    /* -1 means we've turned off autosaving for a while--see below.  */
+	    && XINT (b->save_length) >= 0
 	    && (do_handled_files
 		|| NILP (Ffind_file_name_handler (b->auto_save_file_name))))
 	  {
@@ -3510,10 +3530,9 @@
 		/* It has shrunk too much; turn off auto-saving here.  */
 		message ("Buffer %s has shrunk a lot; auto save turned off there",
 			 XSTRING (b->name)->data);
-		/* User can reenable saving with M-x auto-save.  */
-		b->auto_save_file_name = Qnil;
-		/* Prevent warning from repeating if user does so.  */
-		XFASTINT (b->save_length) = 0;
+		/* Turn off auto-saving until there's a real save,
+		   and prevent any more warnings.  */
+		XSET (b->save_length, Lisp_Int, -1);
 		Fsleep_for (make_number (1), Qnil);
 		continue;
 	      }
@@ -3966,6 +3985,10 @@
 lists are merged destructively.");
   Vwrite_region_annotate_functions = Qnil;
 
+  DEFVAR_LISP ("inhibit-file-name-handlers", &Vinhibit_file_name_handlers,
+    "A list of file names for which handlers should not be used.");
+  Vinhibit_file_name_handlers = Qnil;
+
   defsubr (&Sfind_file_name_handler);
   defsubr (&Sfile_name_directory);
   defsubr (&Sfile_name_nondirectory);