> Matt can you confirm this as well (both the error and the non-setting)? Confirmed both! (Sorry, I hadn't noticed the relevant message before.) On Sat, Mar 11, 2023 at 7:00 AM João Távora wrote: > João Távora writes: > > > Eli Zaretskii writes: > > > > No, not yet. I haven't tried to reproduce it yet, nor do I understand > > what is going on. > > I've now reproduced the problem, but Emacs is not silent about it, I see > an error in *Messages* > > Directory-local variables error: (error Command attempted to use > minibuffer while in minibuffer) > > > But the main question to ask is: is the '(setq foo 42)' getting > > evaluated without the user's consent? > > I've confirmed it does _not_. > > Matt can you confirm this as well (both the error and the non-setting)? > > Anyway, this is the implementation of 'eglot-ensure'. It's pretty > simple. The idea is to wait until the very last moment to do the > connection, hence the user of post-command-hook. Maybe some assumption > here is wrong. I will debug later. > > (defun eglot-ensure () > "Start Eglot session for current buffer if there isn't one." > (let ((buffer (current-buffer))) > (cl-labels > ((maybe-connect > () > (remove-hook 'post-command-hook #'maybe-connect nil) > (eglot--when-live-buffer buffer > (unless eglot--managed-mode > (apply #'eglot--connect (eglot--guess-contact)))))) > (when buffer-file-name > (add-hook 'post-command-hook #'maybe-connect 'append nil))))) > > João >