-
I am using pyvenv and am trying to get eglot to reconnect after activating a virtual environment. I have tried the following: (use-package pyvenv
:straight t
:hook (pyvenv-post-activate-hooks . eglot-reconnect)) However I get an error saying Anyone have an idea on how I can get eglot to reconnect after switching environments? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
two arguments, not three. And the second one is optional. Try to pass it the result of I don't know how to craft this suggestion into |
Beta Was this translation helpful? Give feedback.
-
On Fri, May 12, 2023 at 11:42 AM fast-90 ***@***.***> wrote:
Could you elaborate your thoughts?
OK, I guess.
Use-package is a macro that expands to other forms. It doesn't
do any "work" by itself. Unless one knows heart what use-package
is doing, it's harder to communicate the intent or the effect
of a user configuration, for example in a bug report or a
conversation such as this.
That's the main problem: it's opaque. It's a DSL for where no
DSL was needed. Lisp macros shouldn't be used for this IMHO
(I guess IMNSHO).
Can you guess the expansion of that form? It should be something
like.
(straight-install 'pyenv) ;; or whatever
(add-hook 'pyvenv-post-activate-hooks (lambda () ...))
But is it? No, u-p actually adds a "hook" suffix, so
the variable affected is pyvenv-post-activate-hooks-hook.
Is that what you meant? And should you use a dot there or
not? And will it work if want to edebug your function
(I don't think so).
Of course you could learn all this by reading the manual on
use-package, but why should you fill your brain with this
redundant second language? Why should you fill other
people's brains with it?
If you had chosen not to use use-package and used standard
elisp forms and function calls we would know exactly when
and how they are executed. And you could even step through
your function with edebug.
And if you had those two lines instead of u-p, are they any
worse than what you have now? I don't think so, IMO it's
better. You want nice sectioning in your config file?
Just use a comment. You want delayed execution? Use
with-eval-after-load. You want to save up on some typing?
Use a local variable.
If you're interested, bring me examples of where you think
use-package is saving you time/typing and I can probably
rewrite them to be just as economical and more readable.
If you're not, don't worry. This ship has sailed. Everyone,
especially newcomers are using use-package, some thinking
that it is _the_ way to configure Emacs packages/libraries.
It's not.
João
|
Beta Was this translation helpful? Give feedback.
Actually, after a few extra hours of trying different things I found the following solution working:
Although I am intrigued by your comment regarding
use-package
. Could you elaborate your thoughts?