I'd like to make my up-arrow key from within eshell be eshell-previous-matching-input-from-input, as it is, when point is at point-max, but be previous-line otherwise. I've written
(defun my-up-arrow-in-eshell() (interactive)
(if (= (point) (point-max))
(eshell-previous-matching-input-from-input)
; else
(previous-line)
)
)
(add-hook 'eshell-mode-hook
(lambda ()
(define-key eshell-mode-map (kbd "<up>") 'my-up-arrow-in-eshell)))
but that's not right, as eshell-previous-matching-input-from-input requires an argument. I can hardcode that to a 0, but that works for a single press of the up-arrow key (when at point-max). I want it to work just like out of the box, when at point-max. What do I give for the argument?