bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#39812: 26.1; face-remapping-alist is sometimes set to an unexpected


From: Noam Postavsky
Subject: bug#39812: 26.1; face-remapping-alist is sometimes set to an unexpected value
Date: Thu, 27 Feb 2020 14:57:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt)

Markus Triska <triska@metalevel.at> writes:

> To reproduce this issue, please start Emacs with "emacs -Q", then place
> the following forms in the appearing *scratch* buffer:
>
>     (defun a ()
>       (set (make-local-variable 'face-remapping-alist)
>            '((default bold))))
>
>     (a)
>     (face-remap-add-relative 'default 'italic)
>     (a)

face-remap-add-relative destructively modifies the list value, so
setting face-remapping-alist to a quoted literal gives unexpected
results like this.  Similar to the example at the bottom of (info
"(elisp) Rearrangement")

> Is this still a recommended way to set this variable, should the above
> example work? Is there a reliable way to set face-remapping-alist to
> '((default bold)) in the function `a' so that the first example works?

   (defun a ()
      (set (make-local-variable 'face-remapping-alist)
           (copy-tree '((default bold)))))

Or

   (defun a ()
      (set (make-local-variable 'face-remapping-alist)
           (list (list 'default 'bold))))





reply via email to

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