GNU bug report logs - #39812
26.1; face-remapping-alist is sometimes set to an unexpected value

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Thu, 27 Feb 2020 19:21:02 UTC

Severity: minor

Found in version 26.1

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Markus Triska <triska <at> metalevel.at>
Cc: 39812 <at> debbugs.gnu.org
Subject: bug#39812: 26.1; face-remapping-alist is sometimes set to an unexpected value
Date: Thu, 27 Feb 2020 14:57:56 -0500
Markus Triska <triska <at> 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))))




This bug report was last modified 5 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.