[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Project local variables.
From: |
Stephen Leake |
Subject: |
Re: Project local variables. |
Date: |
Thu, 05 Nov 2020 09:37:34 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) |
Ergus <spacibba@aol.com> writes:
> Looking at the evolution of project.el I want to know if there is any
> sort of project local environment/namespace/scope. The idea is to
> provide some variables that could be shared by all the files in the same
> project but that could be modified by external-packages at the elisp
> level. something like "setq-project"??
You can derive a new project type:
(cl-defstruct my-prj
name ;; A user-friendly string, used in menus and messages.
variable-1
variable-2
...
)
add a project-find-functions for it:
(defun my-prj-find (dir)
...
)
(add-hook 'project-find-functions #'my-prj-find 90)
and then define new project ops that use the variable for it:
(cl-defgeneric my-method-1 ((_project wisi-prj))
...
)
The GNU ELPA wisi package takes this approach.
But I suspect you are asking for something more lightweight.
> A use case is for example when working in tramp some operations are
> expensive like looking for an executable in the remote system. The
> search could be made only once; but then if a local file is open the
> cached value will be wrong.
For this specific case, adding an optional cache to tramp seems like a
better approach. Perhaps that just means creating a new file handler
that wraps the tramp one with a cache?
You could use the above approach to define a project whose files are in
a remote directory accessed via tramp, but that doesn't work if you want
all the normal emacs functions that access files via file handlers to
use the cache. So I don't see how a project-local variable would help.
--
-- Stephe
Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax
(https://sogoreate-landtrust.com/shuumi-land-tax) as an inadequate token
of reparation.