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

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

Re: Multiple M-x shells sharing input ring


From: Michael Heerdegen
Subject: Re: Multiple M-x shells sharing input ring
Date: Thu, 04 Sep 2014 21:46:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Joseph Xu <address@hidden> writes:

> Is there a way to have multiple M-x shell buffers share an input ring? For
> example, if I have two shells running, A and B, and I enter a command into
> A, I would like to be able to find it immediately in the input history of B
> using M-p and M-r.

Not without some dirty hack.

`shell' is based on comint.el that uses a buffer local history variable
(`comint-input-ring') for every buffer.

However, you can try to copy the history from one buffer to the other:

(defun my-use-comint-input-ring-from-buffer (buffer)
  (interactive "b")
  (setq comint-input-ring
        (with-current-buffer buffer comint-input-ring)))

If you do that from shell2 to use the history from shell1, they share
the same structure as history.  That works because the history is
realized as a list, and what you copy is internally a reference to that
same object.

Dunno whether doing that can cause any problems, but it seems to work
here as you want.

Michael.





reply via email to

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