* How can I change a buffer-local glyphless char table?
@ 2018-06-06 2:27 Nick Helm
2018-06-06 14:50 ` Eli Zaretskii
2018-06-06 17:45 ` Stefan Monnier
0 siblings, 2 replies; 5+ messages in thread
From: Nick Helm @ 2018-06-06 2:27 UTC (permalink / raw)
To: help-gnu-emacs
Occasionally, I find it useful to use
glyphless-char-display-control to visualise normally invisible
characters. I do this with something like:
(update-glyphless-char-display 'glyphless-char-display-control
'((c0-control . empty-box)
(c1-control . empty-box)
(format-control . empty-box)
(no-font . hex-code)))
and turn it off again with:
(update-glyphless-char-display 'glyphless-char-display-control
(eval (car (get 'glyphless-char-display-control
'standard-value))))
However this has a global effect. I would like it to only act on the
current buffer. I've tried creating a buffer-local char table with:
(make-local-variable 'glyphless-char-display)
and repeating the call to update-glyphless-char-display, but it
affects both local and global values regardless.
If I make glyphless-char-display buffer-local and tweak its value
directly, it works fine.
Any ideas how I can do this more easily?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I change a buffer-local glyphless char table?
2018-06-06 2:27 How can I change a buffer-local glyphless char table? Nick Helm
@ 2018-06-06 14:50 ` Eli Zaretskii
2018-06-06 22:13 ` Nick Helm
2018-06-06 17:45 ` Stefan Monnier
1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-06-06 14:50 UTC (permalink / raw)
To: help-gnu-emacs
> From: Nick Helm <nick@tenpoint.co.nz>
> Date: Wed, 06 Jun 2018 14:27:59 +1200
>
> (update-glyphless-char-display 'glyphless-char-display-control
> (eval (car (get 'glyphless-char-display-control
> 'standard-value))))
>
> However this has a global effect. I would like it to only act on the
> current buffer. I've tried creating a buffer-local char table with:
>
> (make-local-variable 'glyphless-char-display)
>
> and repeating the call to update-glyphless-char-display, but it
> affects both local and global values regardless.
>
> If I make glyphless-char-display buffer-local and tweak its value
> directly, it works fine.
What do you mean by "tweak its value directly", and how does that
differ from the above tweaking?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I change a buffer-local glyphless char table?
2018-06-06 14:50 ` Eli Zaretskii
@ 2018-06-06 22:13 ` Nick Helm
0 siblings, 0 replies; 5+ messages in thread
From: Nick Helm @ 2018-06-06 22:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Thu, 07 Jun 2018 at 02:50:32 +1200, Eli Zaretskii wrote:
>> From: Nick Helm <nick@tenpoint.co.nz>
>> Date: Wed, 06 Jun 2018 14:27:59 +1200
>>
>> (update-glyphless-char-display 'glyphless-char-display-control
>> (eval (car (get 'glyphless-char-display-control
>> 'standard-value))))
>>
>> However this has a global effect.
>>
>> If I make glyphless-char-display buffer-local and tweak its value
>> directly, it works fine.
>
> What do you mean by "tweak its value directly", and how does that
> differ from the above tweaking?
As an experiment, I changed the value of glyphless-char-display as
described above, copied the new value from C-h v, restored the default,
then did setq-local with the copied value in the target buffer.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I change a buffer-local glyphless char table?
2018-06-06 2:27 How can I change a buffer-local glyphless char table? Nick Helm
2018-06-06 14:50 ` Eli Zaretskii
@ 2018-06-06 17:45 ` Stefan Monnier
2018-06-06 22:34 ` Nick Helm
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2018-06-06 17:45 UTC (permalink / raw)
To: help-gnu-emacs
> (make-local-variable 'glyphless-char-display)
This makes the variable buffer-local but its value is still the same
array object, so update-glyphless-char-display will still update the
same object shared by all buffers.
> Any ideas how I can do this more easily?
You might try
(set (make-local-variable 'glyphless-char-display)
(copy-sequence glyphless-char-display))
-- Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I change a buffer-local glyphless char table?
2018-06-06 17:45 ` Stefan Monnier
@ 2018-06-06 22:34 ` Nick Helm
0 siblings, 0 replies; 5+ messages in thread
From: Nick Helm @ 2018-06-06 22:34 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
On Thu, 07 Jun 2018 at 05:45:29 +1200, Stefan Monnier wrote:
>> (make-local-variable 'glyphless-char-display)
>
> This makes the variable buffer-local but its value is still the same
> array object, so update-glyphless-char-display will still update the
> same object shared by all buffers.
Yes of course, I see now. Thanks.
>> Any ideas how I can do this more easily?
>
> You might try
>
> (set (make-local-variable 'glyphless-char-display)
> (copy-sequence glyphless-char-display))
Yes, this works well.
Thanks again.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-06 22:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-06 2:27 How can I change a buffer-local glyphless char table? Nick Helm
2018-06-06 14:50 ` Eli Zaretskii
2018-06-06 22:13 ` Nick Helm
2018-06-06 17:45 ` Stefan Monnier
2018-06-06 22:34 ` Nick Helm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).