aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-05 03:50:46 +0000
committerRichard M. Stallman1994-04-05 03:50:46 +0000
commit82c2d8392ef24cf0e4bb24546fb0810f0a68901b (patch)
tree075cc7911700afcb01bfc211a70f8fdd7517fc07 /src
parent0b7f1ef2c91ea54611ceb73899ad488b8dddba0b (diff)
downloademacs-82c2d8392ef24cf0e4bb24546fb0810f0a68901b.tar.gz
emacs-82c2d8392ef24cf0e4bb24546fb0810f0a68901b.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c
index a6232e14e43..487cb1184d3 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -125,6 +125,8 @@ int insert_default_directory;
125 Zero means use var format. */ 125 Zero means use var format. */
126int vms_stmlf_recfm; 126int vms_stmlf_recfm;
127 127
128static Lisp_Object Vinhibit_file_name_handlers;
129
128Lisp_Object Qfile_error, Qfile_already_exists; 130Lisp_Object Qfile_error, Qfile_already_exists;
129 131
130Lisp_Object Qfile_name_history; 132Lisp_Object Qfile_name_history;
@@ -196,7 +198,10 @@ DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handle
196 "Return FILENAME's handler function, if its syntax is handled specially.\n\ 198 "Return FILENAME's handler function, if its syntax is handled specially.\n\
197Otherwise, return nil.\n\ 199Otherwise, return nil.\n\
198A file name is handled if one of the regular expressions in\n\ 200A file name is handled if one of the regular expressions in\n\
199`file-name-handler-alist' matches it.") 201`file-name-handler-alist' matches it.\n\n\
202If FILENAME is a member of `inhibit-file-name-handlers',\n\
203then its handler is not run. This is lets handlers\n\
204use the standard functions without calling themselves recursively.")
200 (filename) 205 (filename)
201 Lisp_Object filename; 206 Lisp_Object filename;
202{ 207{
@@ -205,6 +210,19 @@ A file name is handled if one of the regular expressions in\n\
205 210
206 CHECK_STRING (filename, 0); 211 CHECK_STRING (filename, 0);
207 212
213 if (! NILP (Vinhibit_file_name_handlers))
214 {
215 Lisp_Object tail;
216 for (tail = Vinhibit_file_name_handlers; CONSP (tail);
217 tail = XCONS (tail)->cdr)
218 {
219 Lisp_Object tem;
220 tem = Fstring_equal (tail, filename);
221 if (!NILP (tem))
222 return Qnil;
223 }
224 }
225
208 for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons; 226 for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons;
209 chain = XCONS (chain)->cdr) 227 chain = XCONS (chain)->cdr)
210 { 228 {
@@ -3486,6 +3504,8 @@ Non-nil second argument means save only current buffer.")
3486 if (XTYPE (b->auto_save_file_name) == Lisp_String 3504 if (XTYPE (b->auto_save_file_name) == Lisp_String
3487 && b->save_modified < BUF_MODIFF (b) 3505 && b->save_modified < BUF_MODIFF (b)
3488 && b->auto_save_modified < BUF_MODIFF (b) 3506 && b->auto_save_modified < BUF_MODIFF (b)
3507 /* -1 means we've turned off autosaving for a while--see below. */
3508 && XINT (b->save_length) >= 0
3489 && (do_handled_files 3509 && (do_handled_files
3490 || NILP (Ffind_file_name_handler (b->auto_save_file_name)))) 3510 || NILP (Ffind_file_name_handler (b->auto_save_file_name))))
3491 { 3511 {
@@ -3510,10 +3530,9 @@ Non-nil second argument means save only current buffer.")
3510 /* It has shrunk too much; turn off auto-saving here. */ 3530 /* It has shrunk too much; turn off auto-saving here. */
3511 message ("Buffer %s has shrunk a lot; auto save turned off there", 3531 message ("Buffer %s has shrunk a lot; auto save turned off there",
3512 XSTRING (b->name)->data); 3532 XSTRING (b->name)->data);
3513 /* User can reenable saving with M-x auto-save. */ 3533 /* Turn off auto-saving until there's a real save,
3514 b->auto_save_file_name = Qnil; 3534 and prevent any more warnings. */
3515 /* Prevent warning from repeating if user does so. */ 3535 XSET (b->save_length, Lisp_Int, -1);
3516 XFASTINT (b->save_length) = 0;
3517 Fsleep_for (make_number (1), Qnil); 3536 Fsleep_for (make_number (1), Qnil);
3518 continue; 3537 continue;
3519 } 3538 }
@@ -3966,6 +3985,10 @@ increasing order. If there are several functions in the list, the several\n\
3966lists are merged destructively."); 3985lists are merged destructively.");
3967 Vwrite_region_annotate_functions = Qnil; 3986 Vwrite_region_annotate_functions = Qnil;
3968 3987
3988 DEFVAR_LISP ("inhibit-file-name-handlers", &Vinhibit_file_name_handlers,
3989 "A list of file names for which handlers should not be used.");
3990 Vinhibit_file_name_handlers = Qnil;
3991
3969 defsubr (&Sfind_file_name_handler); 3992 defsubr (&Sfind_file_name_handler);
3970 defsubr (&Sfile_name_directory); 3993 defsubr (&Sfile_name_directory);
3971 defsubr (&Sfile_name_nondirectory); 3994 defsubr (&Sfile_name_nondirectory);