From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29334: 25.3; compiled commands don't respect special interactive expressions Date: Thu, 23 Nov 2017 22:11:23 -0500 Message-ID: <87efooz7z8.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1511493146 27165 195.159.176.226 (24 Nov 2017 03:12:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2017 03:12:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29334@debbugs.gnu.org, Allen Li To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 24 04:12:19 2017 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 1eI4PW-0005za-4i for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Nov 2017 04:12:14 +0100 Original-Received: from localhost ([::1]:47057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI4Pa-0004m8-AV for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Nov 2017 22:12:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI4PQ-0004lg-9P for bug-gnu-emacs@gnu.org; Thu, 23 Nov 2017 22:12:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eI4PK-0005Cj-CU for bug-gnu-emacs@gnu.org; Thu, 23 Nov 2017 22:12:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eI4PJ-0005Bd-UE for bug-gnu-emacs@gnu.org; Thu, 23 Nov 2017 22:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eI4PJ-0001tl-PD for bug-gnu-emacs@gnu.org; Thu, 23 Nov 2017 22:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2017 03:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29334 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29334-submit@debbugs.gnu.org id=B29334.15114930957261 (code B ref 29334); Fri, 24 Nov 2017 03:12:01 +0000 Original-Received: (at 29334) by debbugs.gnu.org; 24 Nov 2017 03:11:35 +0000 Original-Received: from localhost ([127.0.0.1]:54523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eI4Os-0001sy-U1 for submit@debbugs.gnu.org; Thu, 23 Nov 2017 22:11:35 -0500 Original-Received: from mail-io0-f177.google.com ([209.85.223.177]:33267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eI4Oq-0001se-7n; Thu, 23 Nov 2017 22:11:33 -0500 Original-Received: by mail-io0-f177.google.com with SMTP id i184so20853999ioa.0; Thu, 23 Nov 2017 19:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=3G6RTXJJ51PecuVaAyeePlO6xsqJWhNeaBKB9eFmVKc=; b=IHcx8jGOJ2fZFSg/KNw07kV61h5YJiVSG/LCX7QiBepNyQNfdcR34RZl/kQfJxCkn7 YKoLgdKq4QJ3NimPFs1n3Eevqqg8UtEWJd55tdZxVbelufLqVGBmfyuCTag+kef8QHeK 3qyEULPxS2xuqsVLcKk6DpwY/aAOvN9Dk8QRkmA5jX9EsI54wRknwCQKJsi9EJOcPCWt Lj8E6Efrbcyuwe02kcoiqlkxeOV+eIy918jMd/c4Xx7LDeTT6VjOc1RL4vEyDWwmM7O1 In8pAgFC6hv100otJ4Dx4NAQ80H1P2LFegBymK/JUkGz6bvcK3VTBi+4PIL7ZYryaln4 HWuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=3G6RTXJJ51PecuVaAyeePlO6xsqJWhNeaBKB9eFmVKc=; b=J/Ar/kJPDYHVJuNC2OWPD7Ie6DM98pFaO0ByTG+W/GrPlQMp2Dnm9nK3bUO3xKPXNa RFVE3o14EZMfO98Q10+F4jNMKkoq1GZt7rVUsnRYfwyBAt1vQRY92Lx10xENWFGSIEZu xMuhYK1EED+z/T8KWgzWnfUJc5HuyJePkJXpzhoOmXOB0ZMgdqHZOQg6rg+wz7PwvffN bbgOxYGpcHKpPozrR4J7PgtjwZIxrtMddhX12A4CJYogn2g0RQTmZAFcbvAAq3S56OGX dLkUYo4YxZE/a4y7kl2SVBozh99H+VKBVrWaxIQpmfreUlvT1w4CEZhIwSTNaho5FBus BQ9Q== X-Gm-Message-State: AJaThX4Xhq1o3F2I92LQrrzZY1IZ16jCPxRPFEHeByqoeh7WiYQdDruZ XmBL7xLgZTGxeo+m7ZQg+unj5g== X-Google-Smtp-Source: AGs4zMYR9MN0Suz0OvgGyG+d1oJUiigvXr1skhJ2MmzX1MgYcpIsdH+ZVmRfeaYQ48Va4vDiVRgDDA== X-Received: by 10.107.104.5 with SMTP id d5mr29297203ioc.84.1511493086383; Thu, 23 Nov 2017 19:11:26 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id o207sm3810908itc.27.2017.11.23.19.11.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Nov 2017 19:11:25 -0800 (PST) In-Reply-To: (Glenn Morris's message of "Tue, 21 Nov 2017 14:45:31 -0500") 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:140288 Archived-At: --=-=-= Content-Type: text/plain tags 29334 + patch quit Glenn Morris writes: > Bisected to a46481370, our old friend "Use lexical-binding". How about this: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-command-repetition-with-lexical-binding-Bug-2933.patch Content-Description: patch >From a8b43e98c592c84957ea304a0dc2d6423af9c5c5 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 23 Nov 2017 21:57:09 -0500 Subject: [PATCH] Fix command repetition with lexical-binding (Bug#29334) `call-interactively' relies on analyzing the source of `interactive' forms in order to preserve arguments like (region-end) in the command history, rather than just storing the resulting position. However, the byte-compiler does not preserve the source of the interactive form when lexical-binding is in effect, because `call-interactively' would evaluate the form with dynamic binding in that case. To fix this, change `call-interactively' so that it checks compiled functions for lexical-binding as well. Then the byte-compiler can preserve the source of interactive forms regardless of the value of lexical-binding. * src/callint.c (Fcall_interactively): Functions compiled with lexical-binding have their arglist encoded as an integer, use this to choose the right kind of binding for compiled functions too. * lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Preserve the uncompiled form of the interactive form when lexical-binding is enabled too. --- lisp/emacs-lisp/bytecomp.el | 6 +----- src/callint.c | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 590db570c5..e16405f09b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2823,11 +2823,7 @@ byte-compile-lambda (while (consp (cdr form)) (setq form (cdr form))) (setq form (car form))) - (if (and (eq (car-safe form) 'list) - ;; The spec is evalled in callint.c in dynamic-scoping - ;; mode, so just leaving the form unchanged would mean - ;; it won't be eval'd in the right mode. - (not lexical-binding)) + (if (eq (car-safe form) 'list) nil (setq int `(interactive ,newform))))) ((cdr int) diff --git a/src/callint.c b/src/callint.c index 5d88082e38..48ea9ba7a3 100644 --- a/src/callint.c +++ b/src/callint.c @@ -356,7 +356,9 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, /* Compute the arg values using the user's expression. */ specs = Feval (specs, CONSP (funval) && EQ (Qclosure, XCAR (funval)) - ? CAR_SAFE (XCDR (funval)) : Qnil); + ? CAR_SAFE (XCDR (funval)) + : COMPILEDP (funval) && INTEGERP (AREF (funval, COMPILED_ARGLIST)) + ? Qt : Qnil); if (events != num_input_events || !NILP (record_flag)) { /* We should record this command on the command history. */ -- 2.11.0 --=-=-=--