From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70958: 30.0.50; eglot-managed-mode hooks not called on shutdown Date: Sat, 25 May 2024 10:53:08 +0300 Message-ID: <86y17yz5sr.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4293"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70958@debbugs.gnu.org To: Troy Brown , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 25 09:54:16 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 1sAmEJ-0000tk-NG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 May 2024 09:54:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAmE2-0000nS-5J; Sat, 25 May 2024 03:53: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 1sAmDy-0000mm-Ty for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 03:53:55 -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 1sAmDy-0000QN-FI for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 03:53:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sAmE5-000706-QH for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 03:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2024 07:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70958 X-GNU-PR-Package: emacs Original-Received: via spool by 70958-submit@debbugs.gnu.org id=B70958.171662361326895 (code B ref 70958); Sat, 25 May 2024 07:54:01 +0000 Original-Received: (at 70958) by debbugs.gnu.org; 25 May 2024 07:53:33 +0000 Original-Received: from localhost ([127.0.0.1]:41904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAmDc-0006zj-Oj for submit@debbugs.gnu.org; Sat, 25 May 2024 03:53:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAmDT-0006zY-TJ for 70958@debbugs.gnu.org; Sat, 25 May 2024 03:53:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAmDG-0000LY-MD; Sat, 25 May 2024 03:53:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=8lSu7OOwS5JkC9t1p+pzzIwxIb5fjZwfGDx9BLxr9AA=; b=ISH/HBLA6e65idAIcvvM jhvCwisyk1zVDjHr7ZjsvqkNPErBE6Q4wqzwPB0OTvSxBHQsLHAlF+Dk9Tspim/fvee1H/x0oXrm/ tu001IGui5zWzv117OY0Ns6Hlu9hS8VUZbJLWO2AsnPIrPFaB0LjsEfANVH1hRRLZx6PI6Ll8O+V6 ypGySVh3IDo0cSCpQ5rl9gUqbXqZAw6iD0JFQ1YTWMG51uIQ3toCIQzX0wGDWWfBWjqXZZu+MH+hM bVHWHyQorOjrutjOkG2HS7tuiqsp445gdpACa78SosZBuqyE7pw5oW5nQ0sBH/Hi6UjD7MazAIOG0 LNLDpjMDYpwTEw==; In-Reply-To: (message from Troy Brown on Wed, 15 May 2024 08:38:28 -0400) 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:285833 Archived-At: > From: Troy Brown > Date: Wed, 15 May 2024 08:38:28 -0400 > > The documentation for eglot-managed-mode-hook indicates that the hook > is run after Eglot has started/stopped managing a buffer. I was > trying to use this to perform setup/teardown of functionality when > this happened, but it appears the registered hooks are never called on > shutdown. The following is a little test that can be run in a buffer > which has LSP support, to demonstrate the problem. My expectation is > that "Buffer not managed" is output and the my-eglot-hook-var is > changed to 'not-managed when a shutdown occurs. > > --8<---------------cut here---------------start------------->8--- > (defun my-eglot-test () > (defun my-eglot-hook () > (message "my-eglot-hook invoked") > (if (eglot-managed-p) > (progn > (message "Buffer is managed") > (setq-local my-eglot-hook-var 'managed)) > (message "Buffer not managed") > (setq-local my-eglot-hook-var 'not-managed))) > (add-hook 'eglot-managed-mode-hook #'my-eglot-hook) > (setq-local my-eglot-hook-var 'initial) > (cl-assert (not (eglot-managed-p))) > (cl-assert (eq my-eglot-hook-var 'initial)) > (call-interactively #'eglot) > (cl-assert (eglot-managed-p)) > (cl-assert (eq my-eglot-hook-var 'managed)) > (sleep-for 3) ; wait for server connection > (call-interactively #'eglot-shutdown) > (cl-assert (not (eglot-managed-p))) > (cl-assert (eq my-eglot-hook-var 'not-managed))) > --8<---------------cut here---------------end--------------->8--- João, any comments or suggestions?