From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael@cadilhac.name (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: Re: Creating an empty file Date: Tue, 23 Jan 2007 18:57:33 +0100 Organization: Epita/LRDE Message-ID: <87r6tlpqwi.fsf@lrde.org> References: <86bqkphiyj.fsf@lola.quinscape.zz> <87odopr8ga.fsf@lrde.org> <87veixu2ep.fsf@vh213602.truman.edu> <861wllheo9.fsf@lola.quinscape.zz> <87y7ntd5jq.fsf@vh213602.truman.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0398572043==" X-Trace: sea.gmane.org 1169575084 24560 80.91.229.12 (23 Jan 2007 17:58:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Jan 2007 17:58:04 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 23 18:57:57 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H9Pu8-0005X1-ME for ged-emacs-devel@m.gmane.org; Tue, 23 Jan 2007 18:57:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9Pu8-0001Ak-Ag for ged-emacs-devel@m.gmane.org; Tue, 23 Jan 2007 12:57:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H9Ptt-00019x-RE for emacs-devel@gnu.org; Tue, 23 Jan 2007 12:57:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H9Pts-00017I-9F for emacs-devel@gnu.org; Tue, 23 Jan 2007 12:57:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9Pts-000173-36 for emacs-devel@gnu.org; Tue, 23 Jan 2007 12:57:40 -0500 Original-Received: from [212.27.42.64] (helo=smtp7-g19.free.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H9Ptr-0005PU-Hh for emacs-devel@gnu.org; Tue, 23 Jan 2007 12:57:39 -0500 Original-Received: from localhost (ivr94-6-82-230-255-91.fbx.proxad.net [82.230.255.91]) by smtp7-g19.free.fr (Postfix) with ESMTP id 311C85660; Tue, 23 Jan 2007 18:57:38 +0100 (CET) Original-To: belanger@truman.edu Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVWPh+Tai+5r5YKBAEU CQQzGAtiq7gjAAACR0lEQVQ4jW2UzW7lIAyFzVW8BzTZX5DmCZLuU2H2pMXv/ypzbK7aSh2kRCRf /HNsE0q7Sg+RQ7JFKaqtrRNAl5AIIKe6D5DBqgbmUAe5hBI1wIRFAHjeM0RKtZi7XVVEpb0BSNfA IddChChT5DildSLWOWhY5IEItMnncZgFcUAc/5jjwCMsDosRNdfKPDTFEdVBW8C+RebDb4N5Orio RhM1+11IJyx0ng2+LryFHBMPDQDYHrY6IfGuU3ouiXTQNE8LIJDKOWpNxERTFrggQwRPd7USUsTW fJ0XbR3bdj5KgBYy4SACpxDeUYEUAzLmtJ1iIrD2gczPq8Qomjhsh/RjGIgKIO8p7NITjwlx7WID nsnQe5NeuTvoBpi8LX6vLLOh5icjOHqBypgnuSp7M+RE1agbQKHQr5E2z1WObhYW4gMqeGQL7joM jCf2DxSk5ApADSYHfFF4igNfJZL1z0GKP0FN02s4XiDXr7V5P94W6I9v8MfBOQDmfwAaVYt+x8Da v4DJvX8BAdin3Knm5yMZYAO4ABDkDniZLLfi4P40gP1F0TPGZOu0CGwA1lcowxwlGy6A9705mD0V jHCxwVZT/hYdRJVUGZNlx6l7ScQBTluof6Wj6bsPYlvpwoTvXFD9gHPn2TZPF3ntI2ecxVrW5MrV XiCie5EeNa7BlWu/HNSkprDUva163PHxAv5jyGV7gVzyAghSKOTnat85UIYFICXbD2NV9rRiv0BS tKQsg6OHH4A15F1WW+UHKHHa32h6aPnAm3/pUcWp+WYnTQAAAABJRU5ErkJggg== In-Reply-To: <87y7ntd5jq.fsf@vh213602.truman.edu> (Jay Belanger's message of "Tue\, 23 Jan 2007 11\:19\:37 -0600") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:65420 Archived-At: --===============0398572043== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Jay Belanger writes: > David Kastrup writes: > ... >> This would probably also apply for an existing file that has been >> changed on disk, but not in the Emacs buffer. In this case it might >> possibly make sense to ask the "revert buffer" question before saving. >> In the case of a non-existing file, there is nothing to revert to, >> however. > > So are you suggesting that when saving a file whose buffer has not > been changed, that Emacs should compare it to the disk file anyhow? > I had always (always=for the last 10 seconds) thought that it didn't > for efficiency reasons. Well, the modification flag has a certain use that should be preserved. What may be done is to add a var `new-files-are-already-modified'. Maybe the (untested) following could help? --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename=files.patch Content-Transfer-Encoding: quoted-printable Index: lisp/files.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/files.el,v retrieving revision 1.879 diff -c -r1.879 files.el *** lisp/files.el 21 Jan 2007 03:53:11 -0000 1.879 =2D-- lisp/files.el 23 Jan 2007 17:56:38 -0000 *************** *** 1751,1756 **** =2D-- 1751,1764 ---- (defvar after-find-file-from-revert-buffer nil) =20=20 + (defcustom new-files-are-already-modified nil + "Non-nil means that new files are set to be modified. + This can be useful if you want to create empty files without actually + modify the buffer." + :group 'files + :version "22.1" + :type 'boolean) +=20 (defun after-find-file (&optional error warn noauto after-find-file-from-revert-buffer nomodes) *************** *** 1787,1793 **** (format "%s has auto save data; consider M-x recover-this-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") =2D-- 1795,1804 ---- (format "%s has auto save data; consider M-x recover-this-file" (file-name-nondirectory buffer-file-name)) (setq not-serious t) ! (when error ! (when new-files-are-already-modified ! (set-buffer-modified-p 'set)) ! "(New file)"))) ((not error) (setq not-serious t) "Note: file is write protected") Index: lisp/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.10592 diff -C0 -r1.10592 ChangeLog *** lisp/ChangeLog 23 Jan 2007 07:18:50 -0000 1.10592 =2D-- lisp/ChangeLog 23 Jan 2007 17:56:56 -0000 *************** *** 0 **** =2D-- 1,6 ---- + 2007-01-23 Micha=EBl Cadilhac +=20 + * files.el (new-files-are-already-modified): New. This customizable + variable tells if new files are to be considered as modified. + (after-find-file): Handle it. +=20 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =2D-=20 | Micha=EBl `Micha' Cadilhac | Isn't vi that text editor with = | | Epita/LRDE Promo 2007 | two modes... One that beeps and = | | http://michael.cadilhac.name | one that corrupts your file? = | `--JID: michael.cadilhac@gmail.com--' -- Dan Jacobson - = --' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFtkyOUJhDmOfFA3URArHIAKCHao5gBkAl3opyn4oVg3Jc4UyvjQCg0k2t MZEZnCP4xAMq0pEwFclJldM= =bBS1 -----END PGP SIGNATURE----- --==-=-=-- --===============0398572043== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============0398572043==--