[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 23:21:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Drew Adams <drew.adams@oracle.com> writes:
> 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.
Yes, but if you want to have a shared input history for all shell
buffers, and another shared history for all interactive scheme buffers,
using a global var is not good enough either.
> 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
> contents.
>
> I don't see how anything in that description applies here.
It doesn't say that it's inappropriate for all other cases ;-)
> > 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?
I think no:
(put 'foo 'permanent-local t)
(setq foo 1)
(local-variable-p 'foo)
==> nil
(make-local-variable 'foo)
(setq foo 2)
(local-variable-p 'foo)
==> t
(kill-all-local-variables)
(local-variable-p 'foo)
==> t
> 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?
Nothing, but I just think a per-mode input history could be more useful.
Michael.