Received: (at submit) by debbugs.gnu.org; 9 Feb 2021 20:00:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 09 15:00:15 2021 Received: from localhost ([127.0.0.1]:54713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1l9ZBD-0005rr-SS for submit <at> debbugs.gnu.org; Tue, 09 Feb 2021 15:00:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:35162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jakanakaevangeli@HIDDEN>) id 1l9Ye8-0002wo-IB for submit <at> debbugs.gnu.org; Tue, 09 Feb 2021 14:26:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <jakanakaevangeli@HIDDEN>) id 1l9Ye8-0005aY-Ag for bug-gnu-emacs@HIDDEN; Tue, 09 Feb 2021 14:26:00 -0500 Received: from chiru.no ([142.4.209.132]:58904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from <jakanakaevangeli@HIDDEN>) id 1l9Ye6-0008Mc-LB for bug-gnu-emacs@HIDDEN; Tue, 09 Feb 2021 14:26:00 -0500 Received: from localhost (BSN-77-156-43.static.siol.net [193.77.156.43]) by chiru.no (Postfix) with ESMTPSA id 733D4128001C for <bug-gnu-emacs@HIDDEN>; Tue, 9 Feb 2021 19:25:56 +0000 (UTC) From: jakanakaevangeli <jakanakaevangeli@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 27.1; Hooks with permanent-local-hook are not cleared of lambdas Date: Tue, 09 Feb 2021 20:29:48 +0100 Message-ID: <87im7182fn.fsf@miha-pc> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: none client-ip=142.4.209.132; envelope-from=jakanakaevangeli@HIDDEN; helo=chiru.no X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 09 Feb 2021 15:00:10 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) When kill-all-local-variables encounters a hook variable with its 'permanent-local property set to 'permanent-local-hook, it removes from its value every element except for t, functions with 'permanent-local-hook property and anything that isn't a symbol (see the comment at src/buffer.c:1072). This means that, for the following code (defvar 'some-hook nil) (add-hook 'some-hook #'some-fun nil t) (add-hook 'some-hook (lambda () (test)) nil t) whether some-fun is removed depends on some-fun's permanent-local-hook property, which is expected. As for the anonymous lambda function, it is not predictable, whether it will be kept or removed. In fact, it depends on some-fun's permanent-local-hook property. Perhaps it would make things more predictable to also remove non-symbol functions such as lambda expressions. See also info node (elisp) Creating Buffer-Local: > -- Function: kill-all-local-variables > This function eliminates all the buffer-local variable bindings > except for [...] and local hook functions that have a non-=E2=80=98n= il=E2=80=99 > =E2=80=98permanent-local-hook=E2=80=99 property. Which suggests that functions with a permanent-local-hook property should be the only exception.
jakanakaevangeli <jakanakaevangeli@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#46407
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.