Marko
Marko

Reputation: 31463

Automatically go to end of buffer after opening a file in Emacs?

Is there a way to tell Emacs to automatically scroll to the end of the file upon opening it?

Note that I don't need this for every file, just for some of them. Ideally, I'd like to be able to set this behavior for all files in certain type/mode. It gets a bit annoying having to type M-x end-of-buffer every time right after opening a file.

Upvotes: 2

Views: 4598

Answers (3)

Matt Kneiser
Matt Kneiser

Reputation: 2156

A crude method for doing so from the command line:

emacs +$(wc -l FILE_NAME)

Upvotes: 3

kindahero
kindahero

Reputation: 5877

Also don't forget help command C-h w which reveals associated key-binding if you know the command name.

C-h w type end-of-buffer (use TAB here for less typing) RET

In the message area you can see the following,

 end-of-buffer is on <C-end>, M->, <menu-bar> <edit> <goto> <end-of-buf> 

Upvotes: 1

polku
polku

Reputation: 1590

First you can use M-> to do that quickly.

To do it automatically with certain files, you can use a hook.

(add-hook 'your-mode-hook 'end-of-buffer)

Upvotes: 8

Related Questions