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

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

bug#51577: [External] : Re: bug#51577: 27.2; Regression: reproducible ha


From: Drew Adams
Subject: bug#51577: [External] : Re: bug#51577: 27.2; Regression: reproducible hang with face functions
Date: Wed, 3 Nov 2021 18:58:23 +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?

Yes.  I expected Emacs to act as it has in the past,
and ignore such an :inherit as a no-op.

> 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.

Only if the implementation doesn't recognize the
inheritance loop.

> IOW, it's a cockpit error.

You can look at it that way.  But I'd expect that
inheritance of a face from itself would be a no-op.
That makes :inherit more flexible/usable.

And that's exactly what the case was in Emacs 26.
The `region' face spec with `:inherit region' is
innocuous in Emacs 26.

Why should the code now chase its tail down an
infinite rabbit hole?  Is this really by design?
Was something gained by this code change?  Or is
this just accidental collateral damage?

Not rhetorical questions.  It seems like a design
change has been made, but with no announcement.
I see nothing in NEWS, when searching for "face"
or "inherit".





reply via email to

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