From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mike Ballard Newsgroups: gmane.emacs.help Subject: Re: elisp question Date: Fri, 22 Aug 2003 05:52:12 GMT Organization: EarthLink Inc. -- http://www.EarthLink.net Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <4ysmnw92h2.fsf@skjellgran.ii.uib.no> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1061556471 5013 80.91.224.253 (22 Aug 2003 12:47:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2003 12:47:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 22 14:47:49 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19qBKX-00006z-00 for ; Fri, 22 Aug 2003 14:47:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19q6dN-0005Zl-Al for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2003 03:46:57 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Newsreader: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-Lines: 71 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-NNTP-Posting-Host: 67.75.7.251 Original-X-Complaints-To: abuse@earthlink.net Original-X-Trace: newsread1.news.atl.earthlink.net 1061531532 67.75.7.251 (Thu, 21 Aug 2003 22:52:12 PDT) Original-NNTP-Posting-Date: Thu, 21 Aug 2003 22:52:12 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:116064 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11981 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11981 On Fri Aug 22, Joakim Hove disturbed my nap when he said: > Mike Ballard writes: > > > Hi - > > > > I don't know much about elisp but was able to piece together a little > > snippet that pretty much does what I want. And that's to determine if a > > post is to Usenet and write a copy to a file. > > > > The problem is if I post again to the same group (w/o restarting Gnus) I > > get the mb msg ' has changed on disk - really edit the buffer?' I'd > > like to eliminate that (I can post to other groups fine so long as I don't > > try more than one post to any group during a single Gnus session). > > > > > > If there was some way to add code which re-reads the disk file before it's > > written to a second time that (apparently) would fix it. > > Look into the function (revert-buffer). However, if this is a > buffer/file entirely managed by gnus/emacs I can not understand how it > changes under your feet - the mb msg ' has changed on disk - > really edit the buffer?' generally comes when some *other* program > has altered a file on disk while you have a buffer mapped to this file > emacs. Actually I suspect that the touch code below works, and by that > modifies the file such that emacs thinks the file is newer than the > buffer (which is in this case formally correct, but not what you > want), and the present with the ' has ...' is displayed. So > altough I think (revert-buffer) is answer to your question, I *think* > you are asking the wrong question, and should rather focus on *why* > the file is modified. > > > I tried using file-exists-p but have sort of been going in circles > > (backwards) without success). > > Why do you have to ensure that the file exists? You can manually set > the file to store a fresh buffer to by (setq buffer-file-name "filename"). > The "touch" is my beginner way of non-interactively creating a var-based filename (the usenet group name). Your "other" program comment got me thinking that the way I used start-process-shell-command:touch in my func definitely was the problem ('really edit?'). The shell proc touch's the file, I post and Emacs writes to disk (and for the first post it didn't matter if I touch'd an existing file or not). After the first write to disk apparently Emacs now knows the state of the file. But the way my beginner-code was written it touch'd the file whether or not it existed. So what I think happens is that the 2d time through (after Emacs wrote first post to disk) my func touch'd it again and when Emacs tried to write my second post to disk it said 'hey, this file's different than I left it.' My problem using file-exists (to use touch conditionally) was a misplaced paren. I had marked off, simplified, (defun* (if test then1 if (then2))). then2 did not belong with the first 'if' so I thought file-exists wasn't working. I got it straightened out and is working acceptably now. Thanks for the help. Mike -- mike.ballard--at--earthlink.net "Roses are red, violets are blue, I'm schizophrenic and so am I"