emacs-devel
[Top][All Lists]
Advanced

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

Re: Propagating local variables?


From: Roland Winkler
Subject: Re: Propagating local variables?
Date: Tue, 15 May 2018 22:42:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

On Tue, May 15 2018, John Wiegley wrote:
> I'd like to create a module, propagate.el, which defines a new class
> of buffer local variables: buffer local variables that propagate to
> any buffers or processes (in the case of exec-path and
> process-environment) created on behalf of the parent.

This is an interesting idea.  I am not sure whether the following is
related to your thoughts.  I'll mention it anyway:

In GNU Elpa is djvu.el for editing djvu documents.  These documents come
with multiple layers for text, annotations, bookmarks, etc. (kind of
similar to pdf documents).  So when you visit such a document with
djvu.el it creates a buffer for each of these layers (plus a few extra
ones for "viewing these layers").  Conventional buffer-local variables
do not work in this case because the buffer-local variables need to be
shared across the buffers that refer to the same document, but buffers
for different documents should peacefully coexist.  Hence to make this
work djvu.el uses a conventional buffer-local variable whose value is a
vector which is the same object for all buffers belonging to one djvu
document (one vector for each djvu document).  The elements of this
vector are then the "document-local" variables where setting such an
element in one buffer is seen in all other buffers for the same
document, while buffers for different djvu documents do not interfere
with each other.  Another advantage is that temp buffers can easily
inherit these document-local variables.

I have always considered this a hack.  But I could not think of a better
solution.  Suggestions are welcome.

Roland




reply via email to

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