all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: Ergus <spacibba@aol.com>
Cc: Emacs-Devel List <emacs-devel@gnu.org>
Subject: Re: Project local variables.
Date: Thu, 05 Nov 2020 09:37:34 -0800	[thread overview]
Message-ID: <86k0uzvh5t.fsf@stephe-leake.org> (raw)
In-Reply-To: <20201103194140.cyjy56zgx7757pxx@Ergus> (Ergus's message of "Tue,  3 Nov 2020 20:41:40 +0100")

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.



  reply	other threads:[~2020-11-05 17:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201103194140.cyjy56zgx7757pxx.ref@Ergus>
2020-11-03 19:41 ` Project local variables Ergus
2020-11-05 17:37   ` Stephen Leake [this message]
2020-11-08  1:48   ` Dmitry Gutov
2020-11-08 15:21     ` Ergus
2020-11-22  3:10       ` Dmitry Gutov

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=86k0uzvh5t.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.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.