From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#55323: 29.0.50; Session-compiled interactive form gives (invalid-function #) Date: Wed, 11 May 2022 15:20:04 +0000 Message-ID: References: <25208.6664.823303.406026@orion.rgrjr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17599"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 55323@debbugs.gnu.org To: Bob Rogers Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 11 17:21:17 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noo9N-0004LJ-Ly for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 11 May 2022 17:21:17 +0200 Original-Received: from localhost ([::1]:50558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noo9M-0004H9-K7 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 11 May 2022 11:21:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noo99-0004Gm-CC for bug-gnu-emacs@gnu.org; Wed, 11 May 2022 11:21:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1noo98-0006t7-JJ for bug-gnu-emacs@gnu.org; Wed, 11 May 2022 11:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1noo98-00028I-Fr for bug-gnu-emacs@gnu.org; Wed, 11 May 2022 11:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 May 2022 15:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55323 X-GNU-PR-Package: emacs Original-Received: via spool by 55323-submit@debbugs.gnu.org id=B55323.16522824148094 (code B ref 55323); Wed, 11 May 2022 15:21:02 +0000 Original-Received: (at 55323) by debbugs.gnu.org; 11 May 2022 15:20:14 +0000 Original-Received: from localhost ([127.0.0.1]:38161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1noo8L-00026T-JJ for submit@debbugs.gnu.org; Wed, 11 May 2022 11:20:13 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:20958 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1noo8J-000269-J3 for 55323@debbugs.gnu.org; Wed, 11 May 2022 11:20:12 -0400 Original-Received: (qmail 95251 invoked by uid 3782); 11 May 2022 15:20:04 -0000 Original-Received: from acm.muc.de (p4fe159db.dip0.t-ipconnect.de [79.225.89.219]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 11 May 2022 17:20:04 +0200 Original-Received: (qmail 19294 invoked by uid 1000); 11 May 2022 15:20:04 -0000 Content-Disposition: inline In-Reply-To: <25208.6664.823303.406026@orion.rgrjr.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231952 Archived-At: Hello again, Bob. On Sun, May 08, 2022 at 15:29:12 -0400, Bob Rogers wrote: > In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) > of 2022-05-08 built on orion > Repository revision: 278b18a460caf34e422847d10ac3f0b62bef4996 > Repository branch: master > Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 > System Description: openSUSE Leap 15.3 > The problem occurs with an evaluated "interactive" form in a defun > that is compiled with compile-defun -- and it may have escaped notice > until now because it doesn't seem to happen if the source is part of > Emacs (i.e. is compiled in a file that git knows about). I think what's different is that the source has been copied into a different file, and that file doesn't have a ;; -*- lexical-binding:t -*- at the top. :-) > 1. emacs -Q > 2. Find an elisp file with an interactive form that does not belong > to an Emacs working copy. I used the align-highlight-rule snippet > below, copied from lisp/align.el. > 3. Evaluate the first two forms, and do "M-x compile-defun" to > compile the third. > 4. Attempt to invoke the command via "M-x align-highlight-rule RET". > What you should see then is a backtrace that starts something like this: > Debugger entered--Lisp error: (invalid-function #) > (# (#) ...) > call-interactively(align-highlight-rule record nil) > command-execute(align-highlight-rule record) > Disassembly shows that the interactive form is not compiled, and the > arglist is full of #: > byte code for align-highlight-rule: > doc: Highlight the whitespace which a given rule would have modified. ... > args: (# # # ...) > interactive: (# (#) ...) > 0 constant intern > 1 varref title > 2 call 1 > 3 varref align-mode-exclude-rules-list Yes. For some reason, the interactive form is not compiled when both lexical-binding is nil AND the form looks like (list .....). I don't know why this is, and suspect it's a remnant of a very old bug fix which is no longer relevant. > Disassembling the in-tree version, whether from "M-x compile-defun" or > file compilation, shows neither of these problems (go figure). See above. > And of course "M-x eval-defun" and "M-x byte-compile-file" continue > to DTRT, so I am not in any hurry for a fix. TIA, Would you please try out the following patch, which removes the positions from the symbols with positions in the arglist and the interactive form. Then please let me know how it goes. Thanks! diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 28237d67d2..c282d79446 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3084,7 +3084,8 @@ byte-compile-lambda ;; which may include "calls" to ;; internal-make-closure (Bug#29988). lexical-binding) - (setq int `(,(car int) ,newform))))) + (setq int `(,(car int) ,newform)) + (setq int (byte-run-strip-symbol-positions int))))) ; for compile-defun. ((cdr int) ; Invalid (interactive . something). (byte-compile-warn-x int "malformed interactive spec: %s" int)))) @@ -3099,7 +3100,7 @@ byte-compile-lambda (byte-compile-make-lambda-lexenv arglistvars)) reserved-csts)) - (bare-arglist arglist)) + (bare-arglist (byte-run-strip-symbol-positions arglist))) ; for compile-defun. ;; Build the actual byte-coded function. (cl-assert (eq 'byte-code (car-safe compiled))) (let ((out > -- Bob Rogers > http://www.rgrjr.com/ -- Alan Mackenzie (Nuremberg, Germany).