Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In older emacs versions I used to type:

C-x C-f RET

And it would re-open the file currently visited in the buffer. Now (emacs 23.1.1) it opens Dired of the directory.

share|improve this question

4 Answers 4

up vote 10 down vote accepted

I use M-x find-alternate-file which is by default bound to C-x C-v.

This command allows to reload a file onto the current buffer, reloading the same file include - which is shown in the mini-buffer by default. This is however not as convenient if you have ido-mode enabled for buffer-switching as it will not display the current file name by default.

share|improve this answer
    
Other answers were excellent, too, but this answer has the fewest keystrokes. –  Eyal Jan 12 '11 at 12:51

Are you sure you don't want to just revert the buffer?

M-x revert-buffer RET
share|improve this answer

You can do C-x C-f M-n RET. The behavior was changed because C-x C-f RET to reopen a file wasn't nearly as common as C-x C-f DEL RET to invoke Dired on the directory.

You can also use M-x revert-buffer to reload a file from disk, and Emacs will tell you (on most operating systems) if you try to edit a file whose copy on disk has been modified externally.

C-x C-f M-n is also useful to obtain the full path to the file in the minibuffer, so you can open a file with a similar name or copy it to the kill ring or clipboard.

share|improve this answer

I found a useful suggestion to go back to the previous behaviour of C-x C-f RET on http://lists.gnu.org/archive/html/help-gnu-emacs/2009-02/msg00241.html:

"This hack was posted by Ted Stern: (defun find-file-read-args (prompt mustmatch) (list (let ((find-file-default (and buffer-file-name (abbreviate-file-name buffer-file-name)))) (read-file-name prompt nil find-file-default mustmatch)) t)) "

I tried it out and it works well for me on emacs 23.1.1.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.