[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:58:56 -0700 (PDT)

> > Too bad that `comint-input-ring' is "permanent local".
> > Should it be, or is that a bug?
> The variable is made local in the comint code with
> `make-local-variable'.


> Since very different modes are based on comint, making such vars
> permanently local seems ok in this case.  You probably don't want to
> share an input history between a shell and a scheme buffer.  Using a
> global variable is not a good idea here.

There are not only two alternatives: permanent-local and global.
The normal way to handle what you describe is to make the variable
local in each buffer where it should be local.  It can even be made
automatically local everywhere (`make-variable-buffer-local').

And any mode derived from comint mode that happens to want a separate
history can easily obtain that, even if the variable is not declared
automatically local.  Nothing prevents scheme mode or whatever from
doing `make-buffer-local' in its buffers.  That's the usual way these
things are done.

AFAICT, `permanent-local' is for a different purpose.  At least its
doc claims that.  It speaks specifically of "the file".  Again:

 Permanent locals are appropriate for data pertaining to where the
 file came from or how to save it, rather than with how to edit the

I don't see how anything in that description applies here.  Maybe
the description is faulty.  Or maybe this variable should not be
permanent-local.  But so far, the description does not seem (to me)
to fit the `comint-input-history' case.

> > 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).
> It's not that easy, since `comint-mode' does a lot of explicit
> `make-local-variable' calls including for `comint-input-ring'.

Why would it do that, if the variable is already permanent-local?
Doesn't permanent-local imply buffer-local?

And even if it does that, that just makes the variable buffer-local.
What prevents one from then killing that local variable and using
the global one instead?

reply via email to

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