all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Easy access to `comint-restore-input'
@ 2012-08-20 23:54 Daniel Hackney
  0 siblings, 0 replies; only message in thread
From: Daniel Hackney @ 2012-08-20 23:54 UTC (permalink / raw)
  To: emacs-devel

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
             comint-input-ring-index
             comint-stored-incomplete-input
             (eq arg 0))
            (comint-restore-input)
          ad-do-it)))

--
Daniel M. Hackney



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-20 23:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 23:54 Easy access to `comint-restore-input' Daniel Hackney

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.