unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Hackney <dan@haxney.org>
To: emacs-devel@gnu.org
Subject: Easy access to `comint-restore-input'
Date: Mon, 20 Aug 2012 19:54:21 -0400	[thread overview]
Message-ID: <CAMqXDZuF-9eLjk59jPP1OB596OXV802wceN0O8TYfAOBOApssQ@mail.gmail.com> (raw)

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



                 reply	other threads:[~2012-08-20 23:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMqXDZuF-9eLjk59jPP1OB596OXV802wceN0O8TYfAOBOApssQ@mail.gmail.com \
    --to=dan@haxney.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).