Skip to content

Instantly share code, notes, and snippets.

@compufox
Last active February 20, 2018 04:24
Show Gist options
  • Select an option

  • Save compufox/ce9ab6abac372f5e9a79e25b7e250042 to your computer and use it in GitHub Desktop.

Select an option

Save compufox/ce9ab6abac372f5e9a79e25b7e250042 to your computer and use it in GitHub Desktop.
(should) move the cursor to the bottom of an eshell buffer on entering
(defvar *eshell-cursor-moved* nil)
(defun move-eshell-cursor ()
(catch 'set-var
(when (and (string-match "eshell" (buffer-name)) (not *eshell-cursor-moved*))
(progn
(setq *eshell-cursor-moved* t)
(goto-char (point-max))
(throw 'set-var nil)))
(when (and (not (string-match "eshell" (buffer-name))) *eshell-cursor-moved*)
(setq *eshell-cursor-moved* nil))))
(add-hook 'post-command-hook #'move-eshell-cursor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment