* auto-save-visited-file-name @ 2003-10-15 18:59 Stefan Monnier 2003-10-15 21:20 ` auto-save-visited-file-name Kim F. Storm ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Stefan Monnier @ 2003-10-15 18:59 UTC (permalink / raw) Has anyone ever tried to use this variable ? It has some really nasty effects. Let's see a session: % emacs -q --no-site-file M-: (setq auto-save-visited-file-name t) C-x C-f ~/tmp/foo.txt RET type in some text with é or à C-x C-s # Now foo.txt has size 30, for instance, using latin-1. SPC DEL # Wait until the buffer is auto-saved. # BUG-1: Now foo.txt has size 32, using emacs-mule encoding. C-x C-s # BUG-2: Emacs prompts because the file was "changed since saved". # let's not save, but kill the buffer instead. C-g C-x k RET # BUG-3: foo.txt does not exist any more because Emacs thought it # was the auto-save file and should thus be removed. I think we need to do something. Maybe fix the above bugs, which might uglify a good bit of the code. Or maybe remove the option instead. Or at least make it into a `defvar' rather than `defcustom'. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-15 18:59 auto-save-visited-file-name Stefan Monnier @ 2003-10-15 21:20 ` Kim F. Storm 2003-10-16 17:10 ` auto-save-visited-file-name Stefan Monnier 2003-10-16 7:19 ` auto-save-visited-file-name Eli Zaretskii 2003-10-17 20:46 ` auto-save-visited-file-name Richard Stallman 2 siblings, 1 reply; 9+ messages in thread From: Kim F. Storm @ 2003-10-15 21:20 UTC (permalink / raw) Cc: emacs-devel Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > Has anyone ever tried to use this variable ? Not me. Is this a new option? > > It has some really nasty effects. Let's see a session: > > % emacs -q --no-site-file > M-: (setq auto-save-visited-file-name t) > C-x C-f ~/tmp/foo.txt RET > type in some text with é or à > C-x C-s > # Now foo.txt has size 30, for instance, using latin-1. > SPC DEL > # Wait until the buffer is auto-saved. > # BUG-1: Now foo.txt has size 32, using emacs-mule encoding. > C-x C-s > # BUG-2: Emacs prompts because the file was "changed since saved". > # let's not save, but kill the buffer instead. > C-g > C-x k RET > # BUG-3: foo.txt does not exist any more because Emacs thought it > # was the auto-save file and should thus be removed. > > I think we need to do something. > Maybe fix the above bugs, which might uglify a good bit of the code. Re. bug 1, I haven't a clue. .. but doesn't that mean that auto-save files are always saved in emacs-mule rather than the current coding of the buffer? That sounds like a more generic error that needs fixing anyway. Re. bug 2, checking the varibale in basic-save-buffer seems to be trivial. Re. bug 3, checking the variable in delete-auto-save-file-if-necessary seems to be trivial too. > Or maybe remove the option instead. > Or at least make it into a `defvar' rather than `defcustom'. I think we should try to fix it... -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-15 21:20 ` auto-save-visited-file-name Kim F. Storm @ 2003-10-16 17:10 ` Stefan Monnier 2003-10-16 19:52 ` auto-save-visited-file-name Kim F. Storm 0 siblings, 1 reply; 9+ messages in thread From: Stefan Monnier @ 2003-10-16 17:10 UTC (permalink / raw) Cc: emacs-devel > .. but doesn't that mean that auto-save files are always saved > in emacs-mule rather than the current coding of the buffer? > That sounds like a more generic error that needs fixing anyway. No, I think it's a very reasonable choice (and I know it's been discussed here and more recently on XEmacs's lists). This is the only encoding that we know for sure will not lose any information, will succeed without needing to prompt the user for more details, and it is also more efficient which I still consider relevant in the context of auto-saving. It's not perfect, but the other options aren't much more attractive. IIUC, the internal format in emacs-unicode is utf-8, so the auto-save format will naturally use utf-8 at that point. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-16 17:10 ` auto-save-visited-file-name Stefan Monnier @ 2003-10-16 19:52 ` Kim F. Storm 0 siblings, 0 replies; 9+ messages in thread From: Kim F. Storm @ 2003-10-16 19:52 UTC (permalink / raw) Cc: emacs-devel Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > > .. but doesn't that mean that auto-save files are always saved > > in emacs-mule rather than the current coding of the buffer? > > That sounds like a more generic error that needs fixing anyway. > > No, I think it's a very reasonable choice (and I know it's been discussed > here and more recently on XEmacs's lists). > This is the only encoding that we know for sure will not lose any > information, will succeed without needing to prompt the user for more > details, and it is also more efficient which I still consider relevant in > the context of auto-saving. It's not perfect, but the other options aren't > much more attractive. Well, we could use the buffer's coding if it suffices -- and only revert to emacs-mule if it doesn't. That would not require any prompting... I assume that the original buffer's coding is used if the auto-save file is restored. But I have no strong opinions, so let's not discuss it further. -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-15 18:59 auto-save-visited-file-name Stefan Monnier 2003-10-15 21:20 ` auto-save-visited-file-name Kim F. Storm @ 2003-10-16 7:19 ` Eli Zaretskii 2003-10-17 20:46 ` auto-save-visited-file-name Richard Stallman 2 siblings, 0 replies; 9+ messages in thread From: Eli Zaretskii @ 2003-10-16 7:19 UTC (permalink / raw) Cc: emacs-devel > From: Stefan Monnier <monnier@IRO.UMontreal.CA> > Date: 15 Oct 2003 14:59:33 -0400 > > SPC DEL > # Wait until the buffer is auto-saved. > # BUG-1: Now foo.txt has size 32, using emacs-mule encoding. A real bug, IMHO: we write auto-save files in emacs-mule, but should use the buffer's file encoding when auto-save-visited-file-name is set. That might mean dealing with characters that cannot be encoded in the buffer-file-coding-system. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-15 18:59 auto-save-visited-file-name Stefan Monnier 2003-10-15 21:20 ` auto-save-visited-file-name Kim F. Storm 2003-10-16 7:19 ` auto-save-visited-file-name Eli Zaretskii @ 2003-10-17 20:46 ` Richard Stallman 2003-10-17 21:14 ` auto-save-visited-file-name Stefan Monnier 2003-10-23 15:55 ` auto-save-visited-file-name Kevin Rodgers 2 siblings, 2 replies; 9+ messages in thread From: Richard Stallman @ 2003-10-17 20:46 UTC (permalink / raw) Cc: emacs-devel Does this solve the problems you found with auto-save-visited-file-name? *** buffer.c.~1.438.~ Thu Sep 11 09:51:05 2003 --- buffer.c Fri Oct 17 11:37:36 2003 *************** *** 1429,1435 **** if (STRINGP (b->auto_save_file_name) && b->auto_save_modified != 0 && BUF_SAVE_MODIFF (b) < b->auto_save_modified ! && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) { Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); --- 1429,1436 ---- if (STRINGP (b->auto_save_file_name) && b->auto_save_modified != 0 && BUF_SAVE_MODIFF (b) < b->auto_save_modified ! && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) ! && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) { Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); *** fileio.c.~1.494.~ Thu Sep 11 09:51:19 2003 --- fileio.c Fri Oct 17 11:35:48 2003 *************** *** 4684,4690 **** { Lisp_Object val; ! if (auto_saving) { /* We use emacs-mule for auto saving... */ setup_coding_system (Qemacs_mule, coding); --- 4684,4691 ---- { Lisp_Object val; ! if (auto_saving ! && ! NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) { /* We use emacs-mule for auto saving... */ setup_coding_system (Qemacs_mule, coding); *************** *** 5212,5218 **** error ("IO error writing %s: %s", SDATA (filename), emacs_strerror (save_errno)); ! if (visiting) { SAVE_MODIFF = MODIFF; XSETFASTINT (current_buffer->save_length, Z - BEG); --- 5213,5222 ---- error ("IO error writing %s: %s", SDATA (filename), emacs_strerror (save_errno)); ! if (visiting ! || (auto_saving ! && ! NILP (Fsymbol_value (intern ("auto-save-visited-file-name"))))) ! { SAVE_MODIFF = MODIFF; XSETFASTINT (current_buffer->save_length, Z - BEG); *************** *** 5775,5785 **** minibuffer_auto_raise = 0; auto_saving = 1; ! /* First, save all files which don't have handlers. If Emacs is ! crashing, the handlers may tweak what is causing Emacs to crash ! in the first place, and it would be a shame if Emacs failed to ! autosave perfectly ordinary files because it couldn't handle some ! ange-ftp'd file. */ for (do_handled_files = 0; do_handled_files < 2; do_handled_files++) for (tail = Vbuffer_alist; GC_CONSP (tail); tail = XCDR (tail)) { --- 5779,5792 ---- minibuffer_auto_raise = 0; auto_saving = 1; ! /* On first pass, save all files that don't have handlers. ! On second pass, save all files that do have handlers. ! ! If Emacs is crashing, the handlers may tweak what is causing ! Emacs to crash in the first place, and it would be a shame if ! Emacs failed to autosave perfectly ordinary files because it ! couldn't handle some ange-ftp'd file. */ ! for (do_handled_files = 0; do_handled_files < 2; do_handled_files++) for (tail = Vbuffer_alist; GC_CONSP (tail); tail = XCDR (tail)) { ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-17 20:46 ` auto-save-visited-file-name Richard Stallman @ 2003-10-17 21:14 ` Stefan Monnier 2003-10-23 15:55 ` auto-save-visited-file-name Kevin Rodgers 1 sibling, 0 replies; 9+ messages in thread From: Stefan Monnier @ 2003-10-17 21:14 UTC (permalink / raw) Cc: emacs-devel > Does this solve the problems you found with auto-save-visited-file-name? It helps, but see below. > *** buffer.c.~1.438.~ Thu Sep 11 09:51:05 2003 > --- buffer.c Fri Oct 17 11:37:36 2003 > *************** > *** 1429,1435 **** > if (STRINGP (b->auto_save_file_name) > && b->auto_save_modified != 0 > && BUF_SAVE_MODIFF (b) < b->auto_save_modified > ! && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) > { > Lisp_Object tem; > tem = Fsymbol_value (intern ("delete-auto-save-files")); > --- 1429,1436 ---- > if (STRINGP (b->auto_save_file_name) > && b->auto_save_modified != 0 > && BUF_SAVE_MODIFF (b) < b->auto_save_modified > ! && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) > ! && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) > { > Lisp_Object tem; > tem = Fsymbol_value (intern ("delete-auto-save-files")); I think the above has a problem: auto-save-visited-file-name is only consulted when setting up buffer-auto-save-file-name, so it can have a value inconsistent with the actual situation. Better check whether buffer-auto-save-file-name is equal to buffer-file-name. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-17 20:46 ` auto-save-visited-file-name Richard Stallman 2003-10-17 21:14 ` auto-save-visited-file-name Stefan Monnier @ 2003-10-23 15:55 ` Kevin Rodgers 2003-10-24 5:16 ` auto-save-visited-file-name Richard Stallman 1 sibling, 1 reply; 9+ messages in thread From: Kevin Rodgers @ 2003-10-23 15:55 UTC (permalink / raw) Richard Stallman wrote: > Does this solve the problems you found with auto-save-visited-file-name? That patch checks the vaule of auto-save-visited-file-name. But what if the user instead explicitly sets buffer-auto-save-file-name to buffer-file-name (or to any name with the same true name as buffer-file-name)? -- Kevin Rodgers ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: auto-save-visited-file-name 2003-10-23 15:55 ` auto-save-visited-file-name Kevin Rodgers @ 2003-10-24 5:16 ` Richard Stallman 0 siblings, 0 replies; 9+ messages in thread From: Richard Stallman @ 2003-10-24 5:16 UTC (permalink / raw) Cc: emacs-devel That patch checks the vaule of auto-save-visited-file-name. But what if the user instead explicitly sets buffer-auto-save-file-name to buffer-file-name (or to any name with the same true name as buffer-file-name)? the code as actually installed compares the file names. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-10-24 5:16 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-10-15 18:59 auto-save-visited-file-name Stefan Monnier 2003-10-15 21:20 ` auto-save-visited-file-name Kim F. Storm 2003-10-16 17:10 ` auto-save-visited-file-name Stefan Monnier 2003-10-16 19:52 ` auto-save-visited-file-name Kim F. Storm 2003-10-16 7:19 ` auto-save-visited-file-name Eli Zaretskii 2003-10-17 20:46 ` auto-save-visited-file-name Richard Stallman 2003-10-17 21:14 ` auto-save-visited-file-name Stefan Monnier 2003-10-23 15:55 ` auto-save-visited-file-name Kevin Rodgers 2003-10-24 5:16 ` auto-save-visited-file-name Richard Stallman
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).