* Re: refreshing files quickly
[not found] ` <36303C68.42D@aigf.sncf.fr>
@ 2003-04-26 19:01 ` Ed L Cashin
0 siblings, 0 replies; only message in thread
From: Ed L Cashin @ 2003-04-26 19:01 UTC (permalink / raw)
Cc: Jacques Duthen
Hi. This post is in response to an October 1998 post, but since I
found that one in deja-news a few years ago, I figured what the hey.
Jacques Duthen <Jacques.Duthen@aigf.sncf.fr> writes:
> Alex Schroeder wrote:
>> > >>>>> "jim" == 142805 <142805@my-dejanews.com> writes:
>> > jim> Is there a command that's quicker than C-x C-f filename "yes"
>> jim> to refresh a file in Emacs that has changed on disk? I've
>> jim> searched the documentation, but not found one. If not, is
>> jim> there a quick way to tie this command to a keystroke? Thanks.
There's the "M-x revert-buffer RET yes RET" way, as Eli Zaretskii
pointed out back in the original thread, but Jacques Duthen has a
quicker way ...
> I use M-x revt RET
> (the name "revt" came from the minimum letters I had to type
> with completion to get revert-buffer: "r e v space t RET")
>
> (defun revt ()
> "Replace the buffer text with the text of the visited file on disk.
> This undoes all changes since the file was visited or saved."
> (interactive)
> (revert-buffer 'nil 't))
>
>> If you know it has changed on disk: C-x C-v RET
>> > This works because the default for find-alternate-file is the very
>> file your are visiting.
>
> But you loose the current point! :-(
>
> If the file did not change so much or if the changes occur
> after the current point, I would prefer to stay in place.
I found that I was still losing the point sometimes in GNU Emacs
21.2.1 on debian woody, so I changed revt to look like below, and now
it's more stable.
(defun revt ()
"Replace the buffer text with the text of the visited file on disk.
This undoes all changes since the file was visited or saved."
(interactive)
(save-excursion
(revert-buffer 'nil 't)))
--
--Ed L Cashin PGP public key: http://noserose.net/e/pgp/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-26 19:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <70narm$p77$1@nnrp1.dejanews.com>
[not found] ` <uyaq8ehfb.fsf@bsiag.com>
[not found] ` <36303C68.42D@aigf.sncf.fr>
2003-04-26 19:01 ` refreshing files quickly Ed L Cashin
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).