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

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

bug#51577: 27.2; Regression: reproducible hang with face functions


From: Eli Zaretskii
Subject: bug#51577: 27.2; Regression: reproducible hang with face functions
Date: Wed, 03 Nov 2021 19:10:28 +0200

> From: Drew Adams <drew.adams@oracle.com>
> Date: Wed, 3 Nov 2021 02:44:22 +0000
> 
> (defface alt-region '((t :background "gray70" :inherit region))
>   "..." :group 'faces)
> 
> ;; `selected-frame' here could be anything, so this is dicey.
> ;; But that's not important for the bug.
>  (defvar orig-region-atts (face-all-attributes 'region (selected-frame)))
> 
> (defun foo (&optional arg)
>   (interactive "P")
>   (let* ((frame  (selected-frame))
>          (alist  (if arg
>                      (face-all-attributes 'alt-region frame)
>                    orig-region-atts))
>          (alist  (cons (cons :font 'unspecified) alist))
>          (plist  ()))
>     (message "BEFORE LOOP, ALIST: %S" alist)
>     (while alist
>       (push (caar alist) plist)
>       (push (cdar alist) plist)
>       (setq alist  (cdr alist)))
>     (setq plist  (nreverse plist))
>     (message "> LOOP. PLIST: %S" plist)
>     (apply #'set-face-attribute 'region frame plist)))

You set the region face to inherit from itself, and you expect that to
work without causing an infloop when Emacs tries to resolve some face
attribute?  If FACE1 has some attribute 'unspecified', but inherits
from FACE2, Emacs will try to go up the inheritance chain to see if
some of the parent faces specifies that attribute.  If FACE1 inherits
from itself, going up the inheritance chain will never end.

IOW, it's a cockpit error.





reply via email to

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