From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Shahid Newsgroups: gmane.emacs.bugs Subject: bug#31793: 26.1; (error "Lisp nesting exceeds =?UTF-8?Q?=E2=80=98max-lisp-eval-depth=E2=80=99?=") Date: Thu, 05 Jul 2018 16:33:29 +0000 Message-ID: <87lgaplk12.fsf@gmail.com> References: <99D8E495-B396-4266-8BF1-BA0B609DEC3D@gnu.org> <87k1qpsdxc.fsf@gmail.com> <87in5wxoat.fsf@gmail.com> <87h8lelj7z.fsf@gmail.com> <83tvpdn5qy.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1530809115 2835 195.159.176.226 (5 Jul 2018 16:45:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 5 Jul 2018 16:45:15 +0000 (UTC) User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: 31793@debbugs.gnu.org, Noam Postavsky , sdl.web@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 05 18:45:11 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fb7NW-0000bc-Er for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Jul 2018 18:45:10 +0200 Original-Received: from localhost ([::1]:53809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb7Pd-0000YQ-Mn for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Jul 2018 12:47:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb7Co-0007W0-TM for bug-gnu-emacs@gnu.org; Thu, 05 Jul 2018 12:34:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fb7Ck-0004z5-SZ for bug-gnu-emacs@gnu.org; Thu, 05 Jul 2018 12:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40053) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fb7Ck-0004yQ-Mq for bug-gnu-emacs@gnu.org; Thu, 05 Jul 2018 12:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fb7Ck-0008SB-6D for bug-gnu-emacs@gnu.org; Thu, 05 Jul 2018 12:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Shahid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Jul 2018 16:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31793 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31793-submit@debbugs.gnu.org id=B31793.153080842832477 (code B ref 31793); Thu, 05 Jul 2018 16:34:02 +0000 Original-Received: (at 31793) by debbugs.gnu.org; 5 Jul 2018 16:33:48 +0000 Original-Received: from localhost ([127.0.0.1]:47950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fb7CU-0008Ri-CD for submit@debbugs.gnu.org; Thu, 05 Jul 2018 12:33:48 -0400 Original-Received: from mail-qt0-f181.google.com ([209.85.216.181]:46493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fb7CT-0008RU-5g for 31793@debbugs.gnu.org; Thu, 05 Jul 2018 12:33:45 -0400 Original-Received: by mail-qt0-f181.google.com with SMTP id h5-v6so7595685qtm.13 for <31793@debbugs.gnu.org>; Thu, 05 Jul 2018 09:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=PCQAUyWmM/W/vWYh3OqYI7uxmCbt1dJgxDNYCcP84JM=; b=avNMaaMreCskO94Q4afJCUFnl1iW8szSzxtSxY9uE2tEsGtVbRZO9Tv6LjZTxqFT9+ aNiq7YhirtrVz/SNgvb5jAsRZeOk6+4Fjme/qC5sOnqosIwhr8fJznmH1jIgyU/rKr7E yrcK9karkm8dMW70GIUOtleWRWjBDeaoHpqeRCQJQ9NMOF1B5499pbWLqYkkBOVb6l1D Ib/7FPY2b+Lbdf9QJCDq9srcJnNJFD99oGSOweWmY8yZqtic2gc5L/Mn1Dz0UsQAh3I/ ldVy8+kCUxG9RTY4+n+kHFztVBd90B4nHNbZvdrLNL/jjuQXmiP9pyoBELA81NlaG3pR lA0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=PCQAUyWmM/W/vWYh3OqYI7uxmCbt1dJgxDNYCcP84JM=; b=dvMDeF6KuWYQrC1EZyntz0QCToAOg/DiXjMOrjG8JDALjboQioJevlTUoL4ma2SZ98 2/5McGoiyDI7SWv2RDpzq9WCh2JKOCfyzFyHGYOntdbZ0n7SrxQhRDOZFPBuV/pOoLzA drqOYQnul9UBbcANWncYlikiJY0T3CyEtDV7Yd51JMY2AOk0NKxv1IMpmYZxjL+W9zPY UCxOtnNAboA/lBP4nKdkwqniVDa8pKZuK97XzrWLlvdSblXLZzwZGhej+jyUYYQz41Na xfxa9RieKfGVo5n3M9xfxcTCc6/yz4u9Ilc6u1G0bPXD9+GnUjSXlobVVBMA9PXWnPSt lO3Q== X-Gm-Message-State: APt69E3UIooRva5YJvV0tWbfBH05cQSPgw52htfUUrXxqpnP/IUad/7M MmG80ao56wyqkGCWuvUcngeuZOX+ X-Google-Smtp-Source: AAOMgpednGoSgvnWsdtv9qqpYIqnU6zuaFWAG6xMJMtC13mquyET+8NsuPyFyEl8foMDUjnkwnl7BQ== X-Received: by 2002:a0c:a991:: with SMTP id a17-v6mr5699772qvb.83.1530808419127; Thu, 05 Jul 2018 09:33:39 -0700 (PDT) Original-Received: from 88a2f9d11b18 (cpe-184-152-55-93.nyc.res.rr.com. [184.152.55.93]) by smtp.gmail.com with ESMTPSA id q83-v6sm2596624qki.67.2018.07.05.09.33.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 09:33:38 -0700 (PDT) In-reply-to: <83tvpdn5qy.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148228 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Noam Postavsky >> Cc: Leo Liu , 31793@debbugs.gnu.org, Eli Zaretskii >> Date: Wed, 04 Jul 2018 18:38:40 -0400 >> >> >> The problem is in step 4. The eldoc-global-mode buffer list isn't reset >> >> in step 2. Step 4 will try to enabe the mode for the same buffer and >> >> start a sequence of calls at 2. I was able to fix this problem by >> >> setting the buffer-list to nil inside ,MODE-enable-in-buffers. I >> >> attached a patch below. >> >> Looks good to me. I guess there is some risk since we are modifying a >> macro which affects a lot of modes, but when balanced against the "risk" >> that we actually fix similar problems in those modes I think this should >> go to emacs-26. > > OK, but please add a comment there explaining why we set the > MODE-buffers to nil. > >> > Added the bug number to the changelog entry and attached a new patch. >> > >> >>From 893e62ee7e3630c981adb3efa39ef409500d7657 Mon Sep 17 00:00:00 2001 >> > From: John Shahid >> > Date: Sat, 23 Jun 2018 11:12:44 -0400 >> > Subject: [PATCH] Avoid turning on the global-minor-mode recursively >> > (Bug#31793) > > It is better to add the bug number to the body of the log message, > not to the header, because the latter has only limited space. > >> > * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Reset >> > the buffer-list inside ,MODE-enable-in-buffers to avoid enabling the >> > mode recursively >> >> I would drop that comma from the commit message though, it's not really >> part of the variable name, it's only meaningful in the context of a >> backquote (and you forgot the period at the end of the sentence). > > Agreed. Thanks for taking a look and reviewing the patch. Attached a new patch with the suggested changes. Cheers, --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-turning-on-the-global-minor-mode-recursively.patch >From b8de8143d74777f25c9ec6f867c040332de810c4 Mon Sep 17 00:00:00 2001 From: John Shahid Date: Sat, 23 Jun 2018 11:12:44 -0400 Subject: [PATCH] Avoid turning on the global-minor-mode recursively * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Clear the buffer-list inside MODE-enable-in-buffers to avoid enabling the mode recursively. (Bug#31793) --- lisp/emacs-lisp/easy-mmode.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index b83b53a8e5..6bf657848c 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -474,7 +474,12 @@ define-globalized-minor-mode ;; The function that calls TURN-ON in each buffer. (defun ,MODE-enable-in-buffers () - (dolist (buf ,MODE-buffers) + (let ((buffers ,MODE-buffers)) + ;; Clear MODE-buffers to avoid scanning the same list of + ;; buffers in recursive calls to MODE-enable-in-buffers. + ;; Otherwise it could lead to infinite recursion. + (setq ,MODE-buffers nil) + (dolist (buf buffers) (when (buffer-live-p buf) (with-current-buffer buf (unless ,MODE-set-explicitly @@ -484,12 +489,11 @@ define-globalized-minor-mode (,mode -1) (funcall #',turn-on)) (funcall #',turn-on)))) - (setq ,MODE-major-mode major-mode))))) + (setq ,MODE-major-mode major-mode)))))) (put ',MODE-enable-in-buffers 'definition-name ',global-mode) (defun ,MODE-check-buffers () (,MODE-enable-in-buffers) - (setq ,MODE-buffers nil) (remove-hook 'post-command-hook ',MODE-check-buffers)) (put ',MODE-check-buffers 'definition-name ',global-mode) -- 2.18.0 --=-=-=--