all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* comint history question
@ 2009-04-27  1:33 unfrostedpoptart
  2009-04-27  2:44 ` unfrostedpoptart
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: unfrostedpoptart @ 2009-04-27  1:33 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Thanks,

 David


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: comint history question
  2009-04-27  1:33 comint history question unfrostedpoptart
@ 2009-04-27  2:44 ` unfrostedpoptart
  2009-04-27 12:09 ` tyler
       [not found] ` <mailman.6104.1240834189.31690.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: unfrostedpoptart @ 2009-04-27  2:44 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: comint history question
  2009-04-27  1:33 comint history question unfrostedpoptart
  2009-04-27  2:44 ` unfrostedpoptart
@ 2009-04-27 12:09 ` tyler
       [not found] ` <mailman.6104.1240834189.31690.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: tyler @ 2009-04-27 12:09 UTC (permalink / raw)
  To: help-gnu-emacs

unfrostedpoptart <david@therogoffs.com> writes:

> 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'm running Gnu Emacs, 23.0.60.1, and my comint history does include two
letter commands, so I think it is a Xemacs issue.

Tyler

-- 
There is no theory of evolution. 
Just a list of animals Chuck Norris allows to live.

http://www.chucknorrisfacts.com/





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: comint history question
       [not found] ` <mailman.6104.1240834189.31690.help-gnu-emacs@gnu.org>
@ 2009-04-29 16:47   ` unfrostedpoptart
  0 siblings, 0 replies; 4+ messages in thread
From: unfrostedpoptart @ 2009-04-29 16:47 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 27, 5:09 am, tyler <tyler.sm...@mail.mcgill.ca> wrote:
> unfrostedpoptart <da...@therogoffs.com> writes:
> > 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'm running Gnu Emacs, 23.0.60.1, and my comint history does include two
> letter commands, so I think it is a Xemacs issue.
>

Interesting. I tried emacs (21.3.1) also and see that comint-input-
filter doesn't have the string length part. I'm trying to figure out
who, in the xemacs camp, added this.  Anyone know (adding
comp.emacs.xemacs)?

 David


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-29 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27  1:33 comint history question unfrostedpoptart
2009-04-27  2:44 ` unfrostedpoptart
2009-04-27 12:09 ` tyler
     [not found] ` <mailman.6104.1240834189.31690.help-gnu-emacs@gnu.org>
2009-04-29 16:47   ` unfrostedpoptart

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.