[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Easy access to `comint-restore-input'

From: Daniel Hackney
Subject: Easy access to `comint-restore-input'
Date: Mon, 20 Aug 2012 19:54:21 -0400

I've been using comint a bunch recently and came up with a little tweak
to make input cycling with `comint-previous/next-input' more convenient.
Right now (24.1), if you scroll or search back a few elements in the
input history, there isn't, AFAICT, a keybinding for
`comint-restore-input'. Using 0 as a prefix argument gets you back to
history item 1, but overwrites `comint-stored-incomplete-input'.

I propose changing `comint-previous-input' so that it calls
`comint-restore-input' when called with 0 as its prefix argument. This
is merely a matter of inserting `(eq arg 0)' into the `or' conditional.
I doubt the current behavior (moving to history index 1 and overwriting
`comint-stored-incomplete-input') is something on which users are
relying. This would obviate the need for the user to create a custom
binding for `comint-restore-input'.

P.S. If anyone wants to use this behavior now, simply put this in your
init.el somewhere:

    (eval-after-load 'comint
      '(defadvice comint-previous-input
         (around restore-comint-input-with-zero-prefix activate)
        "Make `comint-previous-input' restore the input with arg == 0"
        (if (and
             (eq arg 0))

Daniel M. Hackney

reply via email to

[Prev in Thread] Current Thread [Next in Thread]