From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#70068: [PATCH] Don't warn about lexical binding in lisp-interaction-mode Date: Sat, 6 Apr 2024 12:14:02 +0200 Message-ID: <93A70615-823B-4369-BE17-128EEA430ADA@gmail.com> References: <2FB192D4-40E7-4327-BC0E-62674C2C1A03@gmail.com> <8734s2cnv7.fsf@posteo.net> <6246FE18-7962-40F0-807F-1ABE8F9D2A25@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_7F095A87-97AA-4AFE-BBB2-95823E86B1C3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18691"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , 70068@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 06 12:15:13 2024 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 1rt34q-0004jb-Mq for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Apr 2024 12:15:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rt34c-0000LI-AQ; Sat, 06 Apr 2024 06:14:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rt34b-0000KH-1y for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 06:14:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rt34a-0006eb-LC for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 06:14:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rt34g-00029P-K1 for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 06:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Apr 2024 10:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70068-submit@debbugs.gnu.org id=B70068.17123984658060 (code B ref 70068); Sat, 06 Apr 2024 10:15:02 +0000 Original-Received: (at 70068) by debbugs.gnu.org; 6 Apr 2024 10:14:25 +0000 Original-Received: from localhost ([127.0.0.1]:38342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt344-00025n-88 for submit@debbugs.gnu.org; Sat, 06 Apr 2024 06:14:25 -0400 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:57796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt33w-000248-JU for 70068@debbugs.gnu.org; Sat, 06 Apr 2024 06:14:20 -0400 Original-Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-516d3a470d5so2007814e87.3 for <70068@debbugs.gnu.org>; Sat, 06 Apr 2024 03:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712398444; x=1713003244; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=m77id6i/8KSSSTe0sFHB0SHcgr0S+btYWgF4XmXNwKg=; b=eJuPHNsu8Qtqc/YGpv0R1sL5uLYZkeUKbFt5f+lz1xtR6fLm3DnYsPCvF6qkcOqOEp qOU7tBiBuJSLEeHhewO7KxjKyeWhXAOhl3tw3o+kisHfxOVBtr4saUywIVyXx4gvtVxh eOlNcd4jZKP45KdXvPonozqIPFDG8yLFibbf1DPPFxcjL9ym5olxsH4QHyLZZv9rYawI hHxrPD+GSrW5gm2Ma9fPkQPS+l3Uwfh5WPXm+Bm4udmmfYdiIz3mo3AXfbyOrUeizf9A olgDZfErJb/0NYCBynuUHfjreHS1wuC51cmXClXkYRMiGccWT9mT32InXnkqBtDNqT3M ThAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712398444; x=1713003244; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m77id6i/8KSSSTe0sFHB0SHcgr0S+btYWgF4XmXNwKg=; b=vujvzrhwMZyoWDzFsdFYSQGEWCmCiwXN3+jviyiHM1xpjlP57QQwYrQ9T1g4DZyqur 7FEOcyACkCaQ8pkmptAXv/kgXU5VLPOAi+FQD+gm6gcDRTgOHCaTUMEW/fedOqzD5J+H +TdR1mr0yYY/r4xtkqDaghpMzU+cyYxsIAN6b2opgzCujCJ7s1Yt65XnmbMK64h8dxbY bhKZ+KlL0/MHZT6FVONEU0QvVLz9fu6LihxfxdZ4fdibZHxaRsIHjvLMGA8NiWcJkzBn EE9xG/9/WGMN61QuHOFSLer5SslVE/PthStormUIWp9eq0Pxr3ChkLstALxTMnKJbDo5 j2Hg== X-Forwarded-Encrypted: i=1; AJvYcCX6qf7VM3CPi8HcnDeeJECGp20SaVuk5leYqOnChRb/OBjJ9/YB4tQ6h/jy04BJIERK8zerRdfCxB20ZBmLQJNQqgf6Rrg= X-Gm-Message-State: AOJu0YzGZ1iY04qc5bR+eaxunLMmNk2Qn4Z4nufK+NF7LC7n5smx5iR8 isaXF5auw+4wiEITcgHxwLj9MhxLjLTCVs0fgZWD6XOIIm3oo48v X-Google-Smtp-Source: AGHT+IF5zRBdcLTJ1YQo188NcwcOisGegCnY0TlMzwa7TsPsGtB+r+jCbmQLJvi4dhDORIhRU8D0/w== X-Received: by 2002:a19:2d5b:0:b0:515:920e:eedb with SMTP id t27-20020a192d5b000000b00515920eeedbmr2070558lft.39.1712398443676; Sat, 06 Apr 2024 03:14:03 -0700 (PDT) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id m11-20020a056512358b00b00515d32e33a8sm438086lfr.99.2024.04.06.03.14.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Apr 2024 03:14:03 -0700 (PDT) In-Reply-To: <6246FE18-7962-40F0-807F-1ABE8F9D2A25@gmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282774 Archived-At: --Apple-Mail=_7F095A87-97AA-4AFE-BBB2-95823E86B1C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii If we want to do something about this, here are some options. 1. Add -*-lexical-binding:t-*- to initial-scratch-message. 2. It will sort itself out eventually as lexical-binding becomes the = default. Sit and wait (a few years). 3. Something like the attached hack. --Apple-Mail=_7F095A87-97AA-4AFE-BBB2-95823E86B1C3 Content-Disposition: attachment; filename=lexbind-warning-supp.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="lexbind-warning-supp.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5cff86784f0..fb3278c08ab 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2149,6 +2149,8 @@ byte-write-target-file (cons tempfile target-file)) (rename-file tempfile target-file t))))) +(defvar bytecomp--inhibit-lexical-cookie-warning nil) + ;;;###autoload (defun byte-compile-file (filename &optional load) "Compile a file of Lisp code named FILENAME into a file of byte code. @@ -2234,7 +2236,8 @@ byte-compile-file (setq buffer-read-only nil filename buffer-file-name)) ;; Don't inherit lexical-binding from caller (bug#12938). - (unless (local-variable-p 'lexical-binding) + (unless (or (local-variable-p 'lexical-binding) + bytecomp--inhibit-lexical-cookie-warning) (let ((byte-compile-current-buffer (current-buffer))) (displaying-byte-compile-warnings (byte-compile-warn-x diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 8a713bd19a2..6bba1199aec 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -2169,6 +2169,8 @@ elisp-flymake-byte-compile-load-path (dolist (path x t) (unless (stringp path) (throw 'tag nil))))))) +(defvar bytecomp--inhibit-lexical-cookie-warning) + ;;;###autoload (defun elisp-flymake-byte-compile (report-fn &rest _args) "A Flymake backend for elisp byte compilation. @@ -2184,7 +2186,14 @@ elisp-flymake-byte-compile (save-restriction (widen) (write-region (point-min) (point-max) temp-file nil 'nomessage)) - (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*"))) + (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*")) + ;; Hack: suppress warning about missing lexical cookie if the + ;; buffer has `lexical-binding' set, so that we don't + ;; complain about *scratch* buffers. + (warning-suppression-opt + (and lexical-binding + '("--eval" + "(setq bytecomp--inhibit-lexical-cookie-warning t)")))) (setq elisp-flymake--byte-compile-process (make-process @@ -2196,6 +2205,7 @@ elisp-flymake-byte-compile ;; "--eval" "(setq load-prefer-newer t)" ; for testing ,@(mapcan (lambda (path) (list "-L" path)) elisp-flymake-byte-compile-load-path) + ,@warning-suppression-opt "-f" "elisp-flymake--batch-compile-for-flymake" ,temp-file) :connection-type 'pipe --Apple-Mail=_7F095A87-97AA-4AFE-BBB2-95823E86B1C3--