all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#56407: 29.0.50; desktop.el shouldn't be saving/restoring eglot--managed-mode, which is not for interactive use
@ 2022-07-05 19:34 João Távora
  2022-07-05 19:40 ` Eli Zaretskii
  2022-07-05 19:41 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 23+ messages in thread
From: João Távora @ 2022-07-05 19:34 UTC (permalink / raw)
  To: 56407; +Cc: Morten Welinder

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 "^[^-]+--" (symbol-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ão





^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-07-06 13:59 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-05 19:34 bug#56407: 29.0.50; desktop.el shouldn't be saving/restoring eglot--managed-mode, which is not for interactive use João Távora
2022-07-05 19:40 ` Eli Zaretskii
2022-07-05 19:53   ` João Távora
2022-07-06  2:29     ` Eli Zaretskii
2022-07-06  8:12       ` João Távora
2022-07-06 11:09         ` Eli Zaretskii
2022-07-06 11:30           ` João Távora
2022-07-06 11:37             ` Lars Ingebrigtsen
2022-07-06 12:48             ` Eli Zaretskii
2022-07-06 12:59               ` João Távora
2022-07-06 13:12                 ` Eli Zaretskii
2022-07-06 13:19                   ` João Távora
2022-07-06 13:23                     ` João Távora
2022-07-06 13:39                       ` Stefan Kangas
2022-07-06 13:47                         ` João Távora
2022-07-06 13:52                           ` Stefan Kangas
2022-07-06 13:52                           ` Lars Ingebrigtsen
2022-07-06 13:59                             ` João Távora
2022-07-05 22:52   ` João Távora
2022-07-06  2:34     ` Eli Zaretskii
2022-07-06  8:27       ` João Távora
2022-07-05 19:41 ` Lars Ingebrigtsen
2022-07-05 19:56   ` João Távora

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.