all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Multiple M-x shells sharing input ring
Date: Thu, 04 Sep 2014 21:46:26 +0200	[thread overview]
Message-ID: <87ppfbkw31.fsf@web.de> (raw)
In-Reply-To: CAGvvAh3CmH7Ltgz=HP6jQVoea06vLKfN6AOWSq+g==ZGD97B1g@mail.gmail.com

Joseph Xu <josephzxu@gmail.com> 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.





  parent reply	other threads:[~2014-09-04 19:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04  8:54 Multiple M-x shells sharing input ring Joseph Xu
2014-09-04 14:58 ` Subhan Michael Tindall
2014-09-04 15:55   ` Joseph Xu
2014-09-04 19:46 ` Michael Heerdegen [this message]
2014-09-04 20:09   ` Drew Adams
2014-09-04 20:40     ` Michael Heerdegen
2014-09-04 20:58       ` Drew Adams
2014-09-04 21:21         ` Michael Heerdegen
2014-09-04 21:33           ` Drew Adams
2014-09-05  7:33             ` Joseph Xu
     [not found]       ` <mailman.8284.1409864361.1147.help-gnu-emacs@gnu.org>
2014-09-04 21:09         ` Stefan Monnier
2014-09-04 21:20           ` Drew Adams

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=87ppfbkw31.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --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.