emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add cl-defgeneric project-name; first use case eglot


From: Stephen Leake
Subject: Add cl-defgeneric project-name; first use case eglot
Date: Sun, 20 Nov 2022 14:09:49 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

eglot builds a name for a server using the root directory of the
project - in effect:

(file-name-base (directory-file-name (project-root (project-current))))

That name shows up in the elgot mode line, to tell the user which server
the buffer is connected to, in progress report messages, and in the name
of the EGLOT log buffer, which is useful for debugging things.

If the project root directory happens to have a meaningful name, that's
fine. In my use cases, it's usually not meaningful. For example, I have
two worktrees of my wisitoken project, one for the main branch, one for
a work branch. The eglot names, and the ones I'd like to see, are:

    default     desired
    "build"     "wisitoken main"
    "build"     "wisitoken work"

Similarly, the name for the ada_language_server worktree is:

    "gnat"      "als main"

There are probably other situations where providing a more meaningful
name for a project would be useful.

So I'd like to add a new cl-defgeneric to project.el:

(cl-defgeneric project-name (project)
  "A human-readable name for the project."
  (file-name-base (directory-file-name (project-root project))))

Then I can override that in my projects, and eglot will use my desired
name.

-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]