Is there a build-in in emacs to open a file at the end? So without using a wc first, and then using the output to do
emacs +nboflines filename
Silly (but working) answwer:
emacs +10000000 filename
Adjust the 10000000 if you have files with more lines than that.
Another way of doing it:
emacs filename --eval "(goto-char (point-max))"
Note that the --eval ... is after the filename, as order matters here.
You can execute the following command to move the pointer to the end of the buffer:
M-x end-of-buffer
And you can also create the following function in your .emacs file, adding a hook on find-file-hook which will execute our function for every file opened. That will always open a file in emacs with the pointer at the bottom of the buffer:
;; Bottom-line function:
(defun bottom-line ()
"Opens a file with the pointer at the bottom line."
(interactive)
(end-of-buffer))
;; Hook for every file opened, execute the bottom-line function:
(add-hook 'find-file-hook 'bottom-line)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With