all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joakim Hove <hove@bccs.no>
Subject: Re: elisp question
Date: Wed, 20 Aug 2003 10:07:21 +0200	[thread overview]
Message-ID: <4ysmnw92h2.fsf@skjellgran.ii.uib.no> (raw)
In-Reply-To: m2smnw6arh.fsf@west_f1.net


Mike Ballard <dont_w@nt_spam.org> 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 '<file> 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 '<file> 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 '<file> 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").

> Can someone tell me how to alter the code below either by re-reading the
> disk file before it's written again or if "touch" is the problem maybe
> someone could tell me how to use file-exists-p?  I think I'd still need
> the "touch" (or something) for the occasions when the file does not yet
> exist.

The touch is probably OK, but simpler:

(shell-command (format "/bin/touch %s" file))


>
>
>     (start-process-shell-command "foo" "bar"
> 	"/bin/touch" (format "/dd/Gnus/posts/%s.posts" group))
>     (if (not (message-news-p))
> 	"nnfolder:../mail/mail_cc"
>    (format "nnfolder:../posts/%s.posts" group)))


HTH - Joakim
-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/

  reply	other threads:[~2003-08-20  8:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-20  7:37 elisp question Mike Ballard
2003-08-20  8:07 ` Joakim Hove [this message]
2003-08-22  5:52   ` Mike Ballard
2003-08-22  6:38     ` Joakim Hove
2003-08-20 15:07 ` Peter Lee
  -- strict thread matches above, loose matches on Subject: below --
2005-11-30 23:13 Tim McNamara
2005-11-30 23:22 ` Lennart Borgman
2005-12-01  5:07 ` Stefan Monnier
2005-12-01 19:29   ` Tim McNamara
2005-12-01 21:00     ` Stefan Monnier
2005-12-02  1:02       ` Tim McNamara
2005-12-02 17:51   ` Kevin Rodgers
2005-12-01  6:24 ` N. Raghavendra
2005-12-01 19:32   ` Tim McNamara
2005-12-01 21:37     ` N. Raghavendra
2005-12-01 23:40       ` Thien-Thi Nguyen
2005-12-02  7:44         ` N. Raghavendra
2005-12-02 14:43           ` Thien-Thi Nguyen
2005-12-02  1:05       ` Tim McNamara
     [not found] ` <mailman.17404.1133392955.20277.help-gnu-emacs@gnu.org>
2005-12-01 19:25   ` Tim McNamara
2008-04-30 21:23 harven
2008-05-01 13:08 ` Kevin Rodgers
     [not found] ` <mailman.11020.1209647315.18990.help-gnu-emacs@gnu.org>
2008-05-01 13:54   ` harven
2008-05-03 15:38 ` Bastien
2008-10-13 17:36 Seweryn Kokot
     [not found] <mailman.941.1223918781.25473.help-gnu-emacs@gnu.org>
2008-10-13 18:11 ` Niels Giesen
2008-10-13 19:09   ` Seweryn Kokot
     [not found]   ` <mailman.948.1223924333.25473.help-gnu-emacs@gnu.org>
2008-10-13 19:40     ` Pascal J. Bourguignon
2008-10-13 20:47       ` Drew Adams
2008-10-13 21:11       ` Seweryn Kokot
2009-09-27 14:32 Elisp Question magicus
2009-09-27 15:26 ` Giorgos Keramidas
2009-09-27 17:10   ` magicus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ysmnw92h2.fsf@skjellgran.ii.uib.no \
    --to=hove@bccs.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.