all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 30852@debbugs.gnu.org
Subject: bug#30852: 27.0.50; infinite loop in internal-get-lisp-face-attribute
Date: Mon, 19 Mar 2018 07:56:10 -0700	[thread overview]
Message-ID: <CAHyO48yYd2i==hDnjbKJ6erFs+JnWH3VGVe1iB1Z2j0X-JLnfg@mail.gmail.com> (raw)
In-Reply-To: <83sh8wo8qu.fsf@gnu.org>

On Sun, Mar 18, 2018 at 11:54 PM, Eli Zaretskii <eliz@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)))))





      reply	other threads:[~2018-03-19 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  3:39 bug#30852: 27.0.50; infinite loop in internal-get-lisp-face-attribute Aaron Jensen
2018-03-19  3:50 ` bug#30852: (27.0.50; infinite loop in internal-get-lisp-face-attribute) Aaron Jensen
2018-03-19  4:59   ` Aaron Jensen
2018-03-19  6:54 ` bug#30852: 27.0.50; infinite loop in internal-get-lisp-face-attribute Eli Zaretskii
2018-03-19 14:56   ` Aaron Jensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHyO48yYd2i==hDnjbKJ6erFs+JnWH3VGVe1iB1Z2j0X-JLnfg@mail.gmail.com' \
    --to=aaronjensen@gmail.com \
    --cc=30852@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.