GNU bug report logs - #62065
30.0.50; No prompt to confirm unsafe local variables when eglot-ensure used in major mode hook

Previous Next

Package: emacs;

Reported by: Matt Wittmann <mcwitt <at> gmail.com>

Date: Thu, 9 Mar 2023 04:46:05 UTC

Severity: normal

Found in version 30.0.50

Full log


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

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62065 <at> debbugs.gnu.org, Matt Wittmann <mcwitt <at> gmail.com>
Subject: Re: bug#62065: 30.0.50; No prompt to confirm unsafe local variables
 when eglot-ensure used in major mode hook
Date: Sat, 11 Mar 2023 15:01:58 +0000
João Távora <joaotavora <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> 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




This bug report was last modified 2 years and 92 days ago.

Previous Next


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