Doing M-x eglot in a buffer for which buffer-file-name is nil, prompts
the user for a major mode to manage by invoking completing-read. The
way completing-read was called would end up with the string "nil" as
the initial minibuffer input, which is not very useful nor is it a
valid input.
* lisp/progmodes/eglot.el (eglot--guess-contact): Tweak prompt for
major mode. (Bug#60379)
Copyright-paperwork-exempt: yes
non-nil, maybe prompt user, else error as soon as something can't
be guessed."
(let* ((guessed-mode (if buffer-file-name major-mode))
+ (guessed-mode-name (and guessed-mode (symbol-name guessed-mode)))
(main-mode
(cond
((and interactive
(completing-read
"[eglot] Start a server to manage buffers of what major mode? "
(mapcar #'symbol-name (eglot--all-major-modes)) nil t
- (symbol-name guessed-mode) nil (symbol-name guessed-mode) nil)))
+ guessed-mode-name nil guessed-mode-name nil)))
((not guessed-mode)
(eglot--error "Can't guess mode to manage for `%s'" (current-buffer)))
(t guessed-mode)))