GNU bug report logs - #67480
30.0.50; Cannot start eglot

Previous Next

Package: emacs;

Reported by: Mou Tong <mou.tong <at> outlook.com>

Date: Mon, 27 Nov 2023 08:19:01 UTC

Severity: normal

Merged with 67518, 67522

Found in version 30.0.50

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 67480 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67480 <at> debbugs.gnu.org,
 Mou Tong <mou.tong <at> outlook.com>
Subject: Re: bug#67480: 30.0.50; Cannot start eglot
Date: Sat, 02 Dec 2023 13:54:39 -0500
> I suspect this should be fixed the same way I proposed to fix these
> kinds of problems in Org, i.e. with something like:
>
>     (defun require-with-check (feature &optional filename noerror)
>       "If FEATURE is not already loaded, load it from FILENAME.
>     This is like `require' except if FEATURE is already a member of the list
>     `features’, then we check if this was provided by a different file than the
>     one that we would load now (presumably because `load-path' has been
>     changed since the file was loaded)."
>       (let ((lh load-history)
>             (res (require feature filename noerror)))
>         ;; If the `feature' was not yet provided, `require' just loaded the right
>         ;; file, so we're done.
>         (if (not (eq lh load-history)) res
>           ;; If `require' did nothing, we need to make sure that was warranted.
>           (let ((fn (locate-file (or filename (symbol-name feature))
>                                  load-path (get-load-suffixes))))
>             ;; If the right file was indeed loaded already, we're done.
>             (if (assoc fn load-history) res
>               (funcall (if noerror #'warn #'error)
>                        "Feature provided by other file: %S" feature)
>               res)))))
>
> This sample code doesn't try to handle preloaded packages, so it
> would/will need some tweak for that.

Actually, it seems it does work with preloaded files as well because the
`load-history` is adjusted at startup to make it look right for
preloaded packages.

So maybe we should add the above function to `subr.el` and then install
the patch below, WDYT?


        Stefan


diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index d410367f902..468606086ec 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -116,13 +116,8 @@
 ;; having installed them, didn't correctly re-load them over the
 ;; built-in versions.
 (eval-and-compile
-  (load "project")
-  (load "eldoc")
-  (load "seq")
-  (load "flymake")
-  (load "xref")
-  (load "jsonrpc")
-  (load "external-completion"))
+  (mapc #'require-with-check
+        '(project eldoc seq flymake xref jsonrpc external-completion)))
 
 ;; forward-declare, but don't require (Emacs 28 doesn't seem to care)
 (defvar markdown-fontify-code-blocks-natively)





This bug report was last modified 1 year and 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.