From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#56407: 29.0.50; desktop.el shouldn't be saving/restoring eglot--managed-mode, which is not for interactive use Date: Tue, 05 Jul 2022 20:34:16 +0100 Message-ID: <87y1x7pd53.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12130"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Morten Welinder To: 56407@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 05 21:34:36 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 1o8oJf-00030K-E8 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Jul 2022 21:34:35 +0200 Original-Received: from localhost ([::1]:58874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8oJe-0000lK-9a for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Jul 2022 15:34:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8oJ9-0000l8-IT for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2022 15:34:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8oJ9-0003xl-A6 for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2022 15:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o8oJ8-0006eR-HT; Tue, 05 Jul 2022 15:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: terra@diku.dk, bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Jul 2022 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56407 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Morten Welinder Original-Received: via spool by submit@debbugs.gnu.org id=B.165704958825504 (code B ref -1); Tue, 05 Jul 2022 19:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jul 2022 19:33:08 +0000 Original-Received: from localhost ([127.0.0.1]:51725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8oIG-0006dI-0u for submit@debbugs.gnu.org; Tue, 05 Jul 2022 15:33:08 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8oID-0006d8-KY for submit@debbugs.gnu.org; Tue, 05 Jul 2022 15:33:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8oID-0008L5-E6 for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2022 15:33:05 -0400 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:38479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8oIA-0003rD-Og for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2022 15:33:05 -0400 Original-Received: by mail-wm1-x332.google.com with SMTP id g39-20020a05600c4ca700b003a03ac7d540so10320449wmp.3 for ; Tue, 05 Jul 2022 12:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=CwSCb+GVhKMhbMy8VhDbMSgGglXGf1JI1W70XUp8CaI=; b=DtF8KtrcrwsVIjDfB4djgu24BlTAJBgKsc9pRRpmBe6JG53LCdbOvTZ26ZbV5G3qqd 6srUE5CvR3WGd1jeI1Znd2ULjyTApcN76ocP4ZtfeOd/ctujCo6mDIeTv8T2wD6OUzyZ J/2KNwNUg9R0G20HII9D9fy2Rtz4093WRJ7ZAfpHyHYkBuw7Moy9As1AdL+REBleUewW Az94d3Fgstmisai47pYfPaa4CJbM+k9Si14oJwMmKFsUwZQMIR5GwoC98Mi8/9PUzL0J by2b4/bSD5cBJ8C/ifKBLeGbmW7lkc1CSb4LIjqfY5thPWHWGqX4Wvb2HjTElN93MW6Y ruUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=CwSCb+GVhKMhbMy8VhDbMSgGglXGf1JI1W70XUp8CaI=; b=vnq5oNr/bRFDsrz1KK5rlPvjHF4fz+f+Pl4R/WqhfMTUQZ15Fm3VcAhmn9i8fXaU8U KiYWis3qux3CFZlUAT5oUPecvv4mHImvD0ZPruplw74ai2ttFUjaGNcyHY8IYt9pqL2c wcRhq0Q/nab18JtaU0xiFJnpHO9tJby+Zsm/5a2t8u2R5X4ZyMumRIv6jhiaCFolisGJ Jtv5vyaUSBdEQcCHCwcMtGzHKjmoZ3vuB6ZWUuhksPhUpthwPQ8EhDTKTmDOtDhB29z9 r/XVCitDRAuLzF3VEooYAq4rssqeyqmQH18jLVqxQFTY0mLlik7vYGJGS6V5HSTIZ3Hs XN3Q== X-Gm-Message-State: AJIora8LUTWKJ0Qt+QU3LSkjyhXNdG8mCTPejAUFhKxV8HCyPdRa3ltS DaqEF6VhlXuvSLcC2xsovGbFCVE/zfA= X-Google-Smtp-Source: AGRyM1s7e9m/ih0cqp2+yOAfjbp5V4m4DVxwm5V/TVfmRiVH5ntlxQ6Kkcr7IYd7KkXxly0mMjBbng== X-Received: by 2002:a7b:ce8a:0:b0:3a1:8ead:2ae5 with SMTP id q10-20020a7bce8a000000b003a18ead2ae5mr24654839wmj.100.1657049580448; Tue, 05 Jul 2022 12:33:00 -0700 (PDT) Original-Received: from krug ([87.196.73.211]) by smtp.gmail.com with ESMTPSA id k6-20020a5d6286000000b0021d6e14a9ccsm4510850wru.16.2022.07.05.12.32.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 12:32:59 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:236173 Archived-At: Hi Morten, maintainers, Recently, in https://github.com/joaotavora/eglot/issues/990, we found out that users of both eglot.el and desktop.el were getting errors when restarting Emacs. That's because desktop.el attempts to re-enable the eglot--managed-mode minor mode which was "on" when they saved the session (presumably on exit). I confirmed this with a stack trace requested from the user and came up with this workaround in the user's config: (add-to-list 'desktop-minor-mode-handlers '(eglot--managed-mode . ignore)) This works, but we should come up with something better. In Eglot, the eglot--managed-mode minor mode is an implementation detail, it is NOT meant to be called by the user, since it requires a number of preconditions (like firing up a successful server) to be met. Therefore, I have named the symbol with the "internal symbol" convention. In this very simple patch, I teach desktop.el to watch out for this convention and not restart that mode. diff --git a/lisp/desktop.el b/lisp/desktop.el index 1a4103e209..a93703a77e 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1617,7 +1617,9 @@ desktop-create-buffer (let ((handler (cdr (assq minor-mode desktop-minor-mode-handlers)))) (if handler (funcall handler desktop-buffer-locals) - (when (functionp minor-mode) + (when (or (functionp minor-mode) + (and (symbolp minor-mode) + (not (string-match "^[^-]+--" (symbo= l-name minor-mode))))) (funcall minor-mode 1))))))) ;; Even though point and mark are non-nil when written by ;; `desktop-save', they may be modified by handlers wanting to set This probably works (though I haven't tested), but maybe we could come up with some other way around this, like having eglot.el propertize its 'eglot--managed-mode' symbol so that desktop.el doesn't even write it onto the user's save file. Or something like that. Thanks, Jo=C3=A3o