GNU bug report logs -
#30852
27.0.50; infinite loop in internal-get-lisp-face-attribute
Previous Next
Reported by: Aaron Jensen <aaronjensen <at> gmail.com>
Date: Mon, 19 Mar 2018 03:40:02 UTC
Severity: normal
Found in version 27.0.50
Done: Aaron Jensen <aaronjensen <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Sun, Mar 18, 2018 at 11:54 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Are you that saying eterm-256color causes Emacs to create a face alist
> that is a circular list?
No, the problem, which I do not fully understand, is here:
https://github.com/dieggsy/eterm-256color/blob/a43f38a7d78364c34efde10dfce0d518f9f4df62/eterm-256color.el#L126-L156
(defun eterm-256color-handle-ansi-escape (handle-fun &rest args)
(pcase-let
(((or ;; Parameters from Emacs 27.
`(,proc ,params ,char)
;; Parameters up to Emacs 26.
(and
`(,proc ,char)
(let params
;; Hack the dynamic vars into a list.
(delq nil
(delq -1
(list
(bound-and-true-p term-terminal-previous-parameter-4)
(bound-and-true-p term-terminal-previous-parameter-3)
(bound-and-true-p term-terminal-previous-parameter-2)
(bound-and-true-p term-terminal-previous-parameter)
(bound-and-true-p term-terminal-parameter)))))))
args))
(if (eq char '?m)
(while params
(pcase params
(`(38 5 ,color256 . ,_)
(eterm-256color-handle-colors color256 'fg)
(setq params (nthcdr 3 params)))
(`(48 5 ,color256 . ,_)
(eterm-256color-handle-colors color256 'bg)
(setq params (nthcdr 3 params)))
(`(,x . ,_)
(eterm-256color-handle-colors x)
(setq params (cdr params)))))
(apply handle-fun args))))
Specifically, what happens is that the `(setq params ...)` are
ineffective. `params` is always bound to what it is bound to via the
pcase-let. This only happens the first time this function is run--I'm
guessing if `params` is already bound as a variable (as it would be
the second time) then the `setq` and the `let` affect the same thing.
Changing the while loop to this fixes the bug:
(setq my-params params)
(while my-params
(pcase my-params
(`(38 5 ,color256 . ,_)
(eterm-256color-handle-colors color256 'fg)
(setq my-params (nthcdr 3 my-params)))
(`(48 5 ,color256 . ,_)
(eterm-256color-handle-colors color256 'bg)
(setq my-params (nthcdr 3 my-params)))
(`(,x . ,_)
(eterm-256color-handle-colors x)
(setq my-params (cdr my-params)))))
This bug report was last modified 7 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.