[Top][All Lists]

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

RE: Multiple M-x shells sharing input ring

From: Drew Adams
Subject: RE: Multiple M-x shells sharing input ring
Date: Thu, 4 Sep 2014 13:09:42 -0700 (PDT)

> > Is there a way to have multiple M-x shell buffers share an input
> > ring?
> 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:...

Too bad that `comint-input-ring' is "permanent local".
Should it be, or is that a bug?

(elisp) `' says that a permanent-local variable is one that is

  "appropriate for data pertaining to where the file came
   from or how to save it, rather than with how to edit the contents."

It does not sound to me like `comint-input-ring' fits that description
at all.

Anyway, presumably you could remove its permanent-local status, by
removing property `permanent-local' from symbol `comint-input-ring'.

Then you should be able to use `kill-local-variable', to have all
comint buffers share the same variable (value).  (Dunno whether that
is what is what Joseph wants.)

>From (emacs) `Locals':

  `M-x kill-local-variable' makes a specified variable cease to be
  local to the current buffer.  The global value of the variable
  henceforth is in effect in this buffer.  Setting the major mode
  kills all the local variables of the buffer except for a few
  variables specially marked as "permanent locals".

Presumably, any buffer where you do that would then use the
global value of `comint-input-ring'.  (And of course that would 
then be the ring that gets updated from any such buffer.)

I haven't tried any of this, but you might want to give it a try:

(put 'comint-input-ring 'permanent-local nil) ; Do once
(kill-local-variable 'comint-input-ring) ; Do in each shell buffer

reply via email to

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