0

There's a bug in eglot.el where initialisation options aren't handled, so I can't set the initialisation parameters for a given server; that is causing me problems because the language server I'm using is running out of memory because I have too many files open.

While I wait for a fix, I would like to be able to around hack the problem by advising eglot-initialization-options, which is defined as (body elided), such that I return a fixed string if some predicate holds on the server.

(cl-defgeneric eglot-initialization-options (server)
  "JSON object to send under `initializationOptions'."
  (:method (s)
...
Drew
  • 75,699
  • 9
  • 109
  • 225
  • I don't know the answer (I imagine you need to identify the function object that is dispatched to in those circumstances); but if it's a temporary fix then you could alternatively just redefine the method (either in your own config, or in your copy of eglot). – phils May 26 '22 at 21:49
  • https://emacs.stackexchange.com/tags/elisp/info – Drew May 26 '22 at 23:02
  • @Drew : Surely this *is* a question about the language itself, in the context of a specific use case definitely, but nevertheless, the question is well stated in the title. I think the `elisp` tag *is* apposite; please correct me if I'm wrong. I for one want to know the (ahem) generically applicable answer. I suspect phils may have given us the best hack, which is to do the generic dispatcher's work for ourselves and advise an individual method. – Phil Hudson May 27 '22 at 07:32
  • @PhilHudson: No, it's a *"How do/can I"* question. The tag is for Elisp "as a language, compared to other languages, in particular, compared to other Lisp dialects. That is, it is for questions *about the language* itself. *DO NOT USE IT* for questions about *using* Emacs Lisp." – Drew May 27 '22 at 14:03
  • Seems like an impossibly high bar. Try this: in the Elisp manual, navigate to "Generic Functions". From there, search forward for "advi" (sic). You will find nothing about advising generic functions, nor methods on them. Instead, you will soon come to "Advising Emacs Lisp Functions". From there, search forward for "method". The first hit is past the end of the advice section. AFAICT this thread is the world's only discussion of how to advise methods on generic functions in Elisp. The fact that nobody has compare CL's or Scheme's or Clojure's or Autolisp's approach (if any) seems irrelevant. – Phil Hudson May 27 '22 at 14:25

0 Answers0