bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating empty file


From: Ehud Karni
Subject: Re: creating empty file
Date: Tue, 17 Oct 2000 17:13:15 +0200

On Tue, 17 Oct 2000 08:54:31 -0400, Dr. Mirko Luedde 
<Mirko.Luedde@Computer.Org> wrote:
> 
> 1) Let's visit a new buffer via "C-x f myfile".  Don't type anything
> into the buffer. Instead, immediately save the file via "C-x s".  Then
> no file will be created in the filesystem.
> 
> 2) Let's visit a new buffer via "C-x f myfile".  Type something and
> then erase it completely such that the buffer does not contain
> anything at all. Then save the file via "C-x s". Then an empty file
> "myfile" will be created in the filesystem.

The difference in the 2 situation is that in the 1st the file is not 
modified and therefor does not need saving (also killing it will be 
without warning).

> The state of the filesystem should be the same regardless of whether
> we performed the actions described in 1) or those described in 2).
> The state of the filesystem should depend only on the buffer's state
> when doing "C-x s", not on the buffer's history.

That is debatable. If you want this behavior (I'm not sure how many of
emacs users want it) you can change the function `after-find-file' in 
"files.el" (see the diff below). The new code was tested with Emacs
20.7 but it should work with earlier versions too.

Ehud.


diff -c ~/files.el /usr/local/share/emacs/20.7/lisp/files.el
*** ~/files.el                                  Tue Oct 17 16:57:50 2000
--- /usr/local/share/emacs/20.7/lisp/files.el   Tue May 23 14:17:39 2000
***************
*** 1175,1183 ****
                       (format "%s has auto save data; consider M-x 
recover-file"
                               (file-name-nondirectory buffer-file-name))
                     (setq not-serious t)
!                    (if error (progn
!                                  (set-buffer-modified-p t)
!                                  "(New file)") nil)))
                  ((not error)
                   (setq not-serious t)
                   "Note: file is write protected")
--- 1175,1181 ----
                       (format "%s has auto save data; consider M-x 
recover-file"
                               (file-name-nondirectory buffer-file-name))
                     (setq not-serious t)
!                    (if error "(New file)" nil)))
                  ((not error)
                   (setq not-serious t)
                   "Note: file is write protected")

Diff finished at Tue Oct 17 16:58:51



-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il



reply via email to

[Prev in Thread] Current Thread [Next in Thread]