In order to reload a file, you can use the macro M-x revert-buffer (if you want you can bind it to a key), or use a more practice trick: use C-x C-v RET. This tell to find an alternate file and by default emacs suggests you the current file.
In order to reload a file, you can use the macro M-x revert-buffer (if you want you can bind it to a key), or use a more practice trick: use C-x C-v RET. This tell to find an alternate file and by default emacs suggests you the current file.
Nice tip, thanks (I was looking for it). The manual doesn’t explicitly mention that C-x C-v can be used that way…
Thanks for this post. It was what I was looking for…
thanks ^^
thanks a lot, I was looking for that a long time ago,
my thanks too for the tip.
Thanks. I knew about the c-x c-v command but it never occured to me to use it for that purpose!
cool! thanks!
Very useful, thanks for the tip!
Very nice! Thanks
I wrote a revert buffer function and bound it to a key that avoids a confirmation:
(defun my-revert-buffer()
“revert buffer without asking for confirmation”
(interactive “”)
(revert-buffer t t)
)
Useful I also find the following kill-buffer function that does not ask for confirmation.
I bind it to a F3 say, and Shift-F3 to reload the buffer:
(global-set-key [f3] ‘my-kill-buffer)
(global-set-key [S-f3] ‘my-unkill-buffer)
(defvar my-latest-killed-buffer)
(defun my-kill-buffer()
”
Kill current buffer without confirmation.
To undo latest kill call ‘my-unkill-buffer’
”
(interactive)
(setq my-latest-killed-buffer (buffer-file-name) )
(kill-buffer (buffer-name))
)
(defun my-unkill-buffer()
”
Undo the latest buffer kill
”
(interactive)
(find-file my-latest-killed-buffer )
)
Thanks for sharing 🙂
Nice!!! Thanks!!!
Thanks, very helpful!
Thank you for this, exactly what I was looking for 🙂
great! thx!
Cool! Thanks!
Nice, thx.
Thanks! exactly looking for this emacs refresh cmd.
Thank you so much for that! Concise and to the point, awesome!
Or to have emacs periodically reload external changes in all buffers:
M-x customize-variable
global-auto-revert-mode
Toggle
Save for future
Most of the time exactly the behaviour you want.
Sometimes not, of course if you have edited the buffer the usual revert buffer question which changes to keep is applied.
thanks! very helpful (:
Muchas Gracias!!!
thx you!
thanks
谢谢您!
Thanks, was looking for this.
I use Eclipse for Android programming, but prefer Emacs for long stretches of entering code into files. When I change a file in Eclipse (import a package, for example), it’s nice to have the same file already loaded in emacs automatically refresh. To do this, add “global-auto-revert-mode 1)” in your emacs start up file. Magic!