3

Is it possible to force an Emacs buffer to place any new text it receives at the end of the buffer, instead of at the mouse point? I mean all of: keystrokes, yanks, mouse paste. I'm thinking in particular of buffers such as *IPython*, where the moment you press enter, the line is actually echoed and executed at the end of the buffer. But in general, the issue applies to all terminal-like buffers, where it doesn't make sense to paste text anywhere but at the end.

  • 2
    For an example, see comint-preinput-scroll-to-bottom which is added to pre-input-hook in comint-mode – nispio May 11 '16 at 18:25
  • 1
    correction to my above comment: it is added to pre-command-hook – nispio May 11 '16 at 21:12
2

You could hook into before-change-functions:

(add-to-list 'before-change-functions #'(lambda (_b _e) (goto-char (point-max))))
  • 1
    C-h f end-of-buffer: "This function is for interactive use only; in Lisp code use `(goto-char (point-max))' instead." – Drew May 11 '16 at 21:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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