all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: unfrostedpoptart <david@therogoffs.com>
To: help-gnu-emacs@gnu.org
Subject: Re: comint history question
Date: Sun, 26 Apr 2009 19:44:01 -0700 (PDT)	[thread overview]
Message-ID: <ba41ba00-d967-4eb8-9a1b-0b19cb61a53e@a5g2000pre.googlegroups.com> (raw)
In-Reply-To: b9067c65-5f95-427b-878c-89884d22f72f@v35g2000pro.googlegroups.com

On Apr 26, 6:33 pm, unfrostedpoptart <da...@therogoffs.com> wrote:
> Hi.
>
> I use shell-mode for almost all my command shells. I don't understand
> why the comint history (e.g. comint-previous-matching-input) doesn't
> keep one and two-character commands. I frequently mess myself up by
> hitting ctl-up ret to rerun the last command and instead run a
> different command because the last one was only two characters (e.g.
> ls).
>
> I'm actually running xemacs, but I don't that's an issue here.  How to
> I get comint history to use all commands?


I think I found it. Appears to be comint-input-filter.  I added the
following to my startup file:

(defun two-char-history ()
  (interactive)
  (defvar comint-input-filter
    #'(lambda (str)
	(and (not (string-match "\\`\\s *\\'" str))
	     ;; Ignore '!!' and kin
	     (> (length str) 1)))
    "Predicate for filtering additions to input history.
Takes one argument, the input.  If non-nil, the input may be saved on
the input
history list.  Save two character or more that isn't all
whitespace."))

(add-hook 'comint-mode-hook 'two-char-history)

This works, but I'm wondering if there's a way to make this cleaner.
I'm not very good at elisp!

 David


  reply	other threads:[~2009-04-27  2:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27  1:33 comint history question unfrostedpoptart
2009-04-27  2:44 ` unfrostedpoptart [this message]
2009-04-27 12:09 ` tyler
     [not found] ` <mailman.6104.1240834189.31690.help-gnu-emacs@gnu.org>
2009-04-29 16:47   ` unfrostedpoptart

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

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

  git send-email \
    --in-reply-to=ba41ba00-d967-4eb8-9a1b-0b19cb61a53e@a5g2000pre.googlegroups.com \
    --to=david@therogoffs.com \
    --cc=help-gnu-emacs@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 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.