all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: 61868@debbugs.gnu.org
Cc: "João Távora" <joaotavora@gmail.com>
Subject: bug#61868: 29.0.60; Eglot: setting "workspace" configurations should be easier
Date: Tue, 28 Feb 2023 13:49:55 +0100	[thread overview]
Message-ID: <878rgiar9o.fsf@gmail.com> (raw)

Arranging for Eglot to send the correct configuration via the
`eglot-signal-didChangeConfiguration' command or
`eglot-workspace-configuration' variable is very tricky and error prone.

The following command, which reads a configuration plist from the
minibuffer with history, makes this trial and error process much easier
for me:

  (defvar eglot-edit-workspace-configuration--history nil)
  (defun eglot-edit-workspace-configuration ()
    (interactive)
    (let* ((server (eglot-current-server))
           (config (read-from-minibuffer
                    (format "New configuration for `%s': "
                            (eglot-project-nickname server))
                    (when-let ((old (eglot--workspace-configuration-plist server)))
                      (concat "\n" (pp-to-string old)))
                    minibuffer-local-map t
                    'eglot-edit-workspace-configuration--history)))
      (setq-local eglot-workspace-configuration config)
      (save-window-excursion
        (let ((default-directory (project-root (eglot--current-project))))
          (add-dir-local-variable nil 'eglot-workspace-configuration config)
          (save-buffer)))
      (eglot-signal-didChangeConfiguration server)))

I would suggest adding a refined version of this, using a regular buffer
for input.  Moreover, one could allow editing the configuration as a
JSON (perhaps also retaining the option to edit as a plist).  This would
be a natural extension of the existing
`eglot-show-workspace-configuration' command.





             reply	other threads:[~2023-02-28 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 12:49 Augusto Stoffel [this message]
2023-02-28 19:33 ` bug#61868: 29.0.60; Eglot: setting "workspace" configurations should be easier João Távora
2023-02-28 20:35   ` Augusto Stoffel
2023-02-28 21:16     ` Augusto Stoffel
2023-03-01  2:02     ` João Távora
2023-03-01  7:39       ` Augusto Stoffel
2023-03-01 13:20         ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rgiar9o.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=61868@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.