help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Comint Newbie


From: Kevin Rodgers
Subject: Re: Comint Newbie
Date: Fri, 07 Apr 2006 09:37:27 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Suttles, Andrew wrote:
I've found that managing emacs *shell* buffers to be tremendously more
useful than having many different CDE xwin terminals open, when working
on several projects.  I'd like to customize the emacs shell environment
to be more useful, but I'm having some trouble.

I've added the following hook:

(add-hook 'shell-mode-hook
  '(lambda ()
    ...snip...
    (setq comint-input-ring-file-name "~/.sh_history")
    (setq comint-input-ring-size 100)
    (setq comint-input-ring-separator "\n")
    (comint-read-input-ring)))

This works to load my shell history when I enter a new *shell* buffer,
however, there are many ^@, ^A, and ^B characters in the .sh_history
file that are useful to the Korn shell history mechanism, but just get
quoted at the prompt in emacs when I scroll through the history. Is
there a way (a hook, or something) I can get rid of these.  I've played
with the comint-input-ring-separator to no avail.

Looking at my ~/.sh_history file it seems the right setting would be:

(setq comint-input-ring-separator "\n\000")

because each line begins with a ^@.  Actually, some lines begin with
more than 1 ^@, and since comint-read-input-ring treats the separator
as a regexp (passing it to re-search-backward) you should be able to
handle that and the control characters you see like this:

(setq comint-input-ring-separator "\n[\000-\002]+") ; ^@, ^A, ^B

However, comint-write-input-ring does not treat the separator as a
regexp (passing it directly to insert), so that would break...

--
Kevin Rodgers





reply via email to

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