all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Command to re-read current file?
@ 2003-08-04 14:30 bill
  2003-08-04 14:45 ` Peter Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: bill @ 2003-08-04 14:30 UTC (permalink / raw)




If the file corresponding to the current buffer changes on disk,
and I want the buffer to reflect the new version, I normally do
"C-f [RET] yes".  It bugs me to have to answer 'yes' (or even 'y')
in these cases.  Is there a command to tell Emacs, "re-read the
file from disk and don't ask me about it"?

But this is a relatively trivial issue.  A far more important
question is the following meta-question:  how could I have figured
out the answer to the previous question on my own?  I tried apropos
with various query strings, such as "re-find", "re-open", "re-visit",
and variants thereof, but they yielded nothing.  Is there a better
approach to finding the command for an Emacs functionality?

Thanks!

bill

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 14:30 Command to re-read current file? bill
@ 2003-08-04 14:45 ` Peter Lee
  2003-08-04 14:48 ` lawrence mitchell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Peter Lee @ 2003-08-04 14:45 UTC (permalink / raw)


>>>> bill  writes:

    bill> If the file corresponding to the current buffer changes on
    bill> disk, and I want the buffer to reflect the new version, I
    bill> normally do "C-f [RET] yes".  It bugs me to have to answer
    bill> 'yes' (or even 'y') in these cases.  Is there a command to
    bill> tell Emacs, "re-read the file from disk and don't ask me
    bill> about it"?

,----[ C-h f revert-buffer RET ]
| revert-buffer is an interactive compiled Lisp function in `files'.
| (revert-buffer &optional IGNORE-AUTO NOCONFIRM PRESERVE-MODES)
| 
| Replace current buffer text with the text of the visited file on disk.
| This undoes all changes since the file was visited or saved.
| With a prefix argument, offer to revert from latest auto-save file, if
| that is more recent than the visited file.
| 
| This command also works for special buffers that contain text which
| doesn't come from a file, but reflects some other data base instead:
| for example, Dired buffers and buffer-list buffers.  In these cases,
| it reconstructs the buffer contents from the appropriate data base.
| 
| When called from Lisp, the first argument is IGNORE-AUTO; only offer
| to revert from the auto-save file when this is nil.  Note that the
| sense of this argument is the reverse of the prefix argument, for the
| sake of backward compatibility.  IGNORE-AUTO is optional, defaulting
| to nil.
| 
| Optional second argument NOCONFIRM means don't ask for confirmation at
| all.  (The local variable `revert-without-query', if non-nil, prevents
| confirmation.)
| 
| Optional third argument PRESERVE-MODES non-nil means don't alter
| the files modes.  Normally we reinitialize them using `normal-mode'.
| 
| If the value of `revert-buffer-function' is non-nil, it is called to
| do all the work for this command.  Otherwise, the hooks
| `before-revert-hook' and `after-revert-hook' are run at the beginning
| and the end, and if `revert-buffer-insert-file-contents-function' is
| non-nil, it is called instead of rereading visited file contents.
`----

    bill> But this is a relatively trivial issue.  A far more
    bill> important question is the following meta-question: how could
    bill> I have figured out the answer to the previous question on my
    bill> own?  I tried apropos with various query strings, such as
    bill> "re-find", "re-open", "re-visit", and variants thereof, but
    bill> they yielded nothing.  Is there a better approach to finding
    bill> the command for an Emacs functionality?

You could have done 'M-x apropos-documentation RET reread'.
apropos-documentation is handy when the command name is not intuitive.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 14:30 Command to re-read current file? bill
  2003-08-04 14:45 ` Peter Lee
@ 2003-08-04 14:48 ` lawrence mitchell
  2003-08-04 16:31   ` Eli Zaretskii
  2003-08-04 16:49 ` Kevin Rodgers
  2003-08-04 18:23 ` kgold
  3 siblings, 1 reply; 10+ messages in thread
From: lawrence mitchell @ 2003-08-04 14:48 UTC (permalink / raw)


bill wrote:

[...]

> But this is a relatively trivial issue.  A far more important
> question is the following meta-question:  how could I have figured
> out the answer to the previous question on my own?  I tried apropos
> with various query strings, such as "re-find", "re-open", "re-visit",
> and variants thereof, but they yielded nothing.  Is there a better
> approach to finding the command for an Emacs functionality?

Well, you can try the Emacs manual.  In this case, the relevant
part was under (info "(emacs)Files").  You were going about it
the right way.  Another option you could have used might have
been apropos-documentation, which searches in docstrings too.


In this case, I think you want revert-buffer:

/----[ C-h f revert-buffer RET ]
| revert-buffer is an interactive compiled Lisp function in `files'.
| It is bound to <menu-bar> <files> <revert-buffer>.
| (revert-buffer &optional IGNORE-AUTO NOCONFIRM PRESERVE-MODES)
|
| Replace current buffer text with the text of the visited file on disk.
| This undoes all changes since the file was visited or saved.
| With a prefix argument, offer to revert from latest auto-save file, if
| that is more recent than the visited file.
|
| [...]
|
| Optional second argument NOCONFIRM means don't ask for confirmation at
| all.  (The local variable `revert-without-query', if non-nil, prevents
| confirmation.)
\----

-- 
lawrence mitchell <wence@gmx.li>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 14:48 ` lawrence mitchell
@ 2003-08-04 16:31   ` Eli Zaretskii
  2003-08-05  7:48     ` Adam Hardy
       [not found]     ` <mailman.87.1060069873.29551.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2003-08-04 16:31 UTC (permalink / raw)


> From: lawrence mitchell <wence@gmx.li>
> Newsgroups: gnu.emacs.help
> Date: Mon, 04 Aug 2003 15:48:25 +0100
> 
> > But this is a relatively trivial issue.  A far more important
> > question is the following meta-question:  how could I have figured
> > out the answer to the previous question on my own?  I tried apropos
> > with various query strings, such as "re-find", "re-open", "re-visit",
> > and variants thereof, but they yielded nothing.  Is there a better
> > approach to finding the command for an Emacs functionality?
> 
> Well, you can try the Emacs manual.  In this case, the relevant
> part was under (info "(emacs)Files").  You were going about it
> the right way.  Another option you could have used might have
> been apropos-documentation, which searches in docstrings too.

In fact, the Info's index-search command (bound to `i' in Info mode)
would have been the perfect solution here.  I just typed "i reread
TAB" and was presented with a single possible completion: "reread a
file", which placed me right on the node "Reverting" that describes
the command revert-buffer.

Yet another win for the wonderful Info-index command.  I wish people
used it more than they do now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 14:30 Command to re-read current file? bill
  2003-08-04 14:45 ` Peter Lee
  2003-08-04 14:48 ` lawrence mitchell
@ 2003-08-04 16:49 ` Kevin Rodgers
  2003-08-04 18:11   ` Peter Lee
  2003-08-04 18:23 ` kgold
  3 siblings, 1 reply; 10+ messages in thread
From: Kevin Rodgers @ 2003-08-04 16:49 UTC (permalink / raw)


bill wrote:

> If the file corresponding to the current buffer changes on disk,
> and I want the buffer to reflect the new version, I normally do
> "C-f [RET] yes".  It bugs me to have to answer 'yes' (or even 'y')
> in these cases.  Is there a command to tell Emacs, "re-read the
> file from disk and don't ask me about it"?


I use find-alternate-file for this purpose, since it's bound to a
key that's easy to type (C-x C-v), provides the current visited
file name as the default, and doesn't require any confirmation.


> But this is a relatively trivial issue.  A far more important
> question is the following meta-question:  how could I have figured
> out the answer to the previous question on my own?  I tried apropos
> with various query strings, such as "re-find", "re-open", "re-visit",
> and variants thereof, but they yielded nothing.  Is there a better
> approach to finding the command for an Emacs functionality?

I guess you meant `C-x C-f' above, which is bound to find-file.  `C-h

C-k C-x C-f' or `C-h C-f find-file RET' take you to that section of
the manual, which includes find-alternate-file (C-x C-v).

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 16:49 ` Kevin Rodgers
@ 2003-08-04 18:11   ` Peter Lee
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Lee @ 2003-08-04 18:11 UTC (permalink / raw)


>>>> Kevin Rodgers writes:

    Kevin> I use find-alternate-file for this purpose, since it's
    Kevin> bound to a key that's easy to type (C-x C-v), provides the
    Kevin> current visited file name as the default, and doesn't
    Kevin> require any confirmation.

Great tip!  I've always used revert-buffer, this will come in handy.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 14:30 Command to re-read current file? bill
                   ` (2 preceding siblings ...)
  2003-08-04 16:49 ` Kevin Rodgers
@ 2003-08-04 18:23 ` kgold
  3 siblings, 0 replies; 10+ messages in thread
From: kgold @ 2003-08-04 18:23 UTC (permalink / raw)



Besides the other answers you've received, there is also autorevert
mode, which gets the new version continuously and automatically.  It's
great for viewing log files, debug traces, etc.

; auto revert (update buffer when file changes on disk)

(autoload 'auto-revert-mode "autorevert" nil t)
(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)
(autoload 'global-auto-revert-mode "autorevert" nil t)
(global-auto-revert-mode 1)
(setq auto-revert-interval 2)


bill <bill_knight2@yahoo.com> writes:
> 
> If the file corresponding to the current buffer changes on disk,
> and I want the buffer to reflect the new version, I normally do
> "C-f [RET] yes".  It bugs me to have to answer 'yes' (or even 'y')
> in these cases.  Is there a command to tell Emacs, "re-read the
> file from disk and don't ask me about it"?


-- 
-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-04 16:31   ` Eli Zaretskii
@ 2003-08-05  7:48     ` Adam Hardy
  2003-08-05 12:12       ` Eli Zaretskii
       [not found]     ` <mailman.87.1060069873.29551.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Adam Hardy @ 2003-08-05  7:48 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:
 > In fact, the Info's index-search command (bound to `i' in Info mode)
 > would have been the perfect solution here.  I just typed "i reread
 > TAB" and was presented with a single possible completion: "reread a
 > file", which placed me right on the node "Reverting" that describes
 > the command revert-buffer.

when I use Info's i command, I get 'index-topic' and auto-complete with 
the tab key doesn't work. Are you saying index-search is something else?


Adam




-- 
GNU Emacs 21.2.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
       [not found]     ` <mailman.87.1060069873.29551.help-gnu-emacs@gnu.org>
@ 2003-08-05  9:37       ` Johan Bockgård
  0 siblings, 0 replies; 10+ messages in thread
From: Johan Bockgård @ 2003-08-05  9:37 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> when I use Info's i command, I get 'index-topic' and auto-complete
> with the tab key doesn't work. Are you saying index-search is
> something else?

Index completion is in CVS Emacs.

-- 
Join us on #emacs @ irc.freenode.net.
http://www.emacswiki.org/cgi-bin/wiki.pl/EmacsChannel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Command to re-read current file?
  2003-08-05  7:48     ` Adam Hardy
@ 2003-08-05 12:12       ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2003-08-05 12:12 UTC (permalink / raw)


> Date: Tue, 05 Aug 2003 09:48:47 +0200
> From: Adam Hardy <emacs@cyberspaceroad.com>
> 
> when I use Info's i command, I get 'index-topic' and auto-complete with 
> the tab key doesn't work.

TAB completion in Info-index is available only in CVS Emacs.  Until
that is released, I suggest to use the stand-alone Info reader (from
the GNU Texinfo package), where such completion was available for
years.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-08-05 12:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-04 14:30 Command to re-read current file? bill
2003-08-04 14:45 ` Peter Lee
2003-08-04 14:48 ` lawrence mitchell
2003-08-04 16:31   ` Eli Zaretskii
2003-08-05  7:48     ` Adam Hardy
2003-08-05 12:12       ` Eli Zaretskii
     [not found]     ` <mailman.87.1060069873.29551.help-gnu-emacs@gnu.org>
2003-08-05  9:37       ` Johan Bockgård
2003-08-04 16:49 ` Kevin Rodgers
2003-08-04 18:11   ` Peter Lee
2003-08-04 18:23 ` kgold

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.