bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41572: 28.0.50; [PATCH] Support plain project marked with file .emac


From: Theodor Thornhill
Subject: bug#41572: 28.0.50; [PATCH] Support plain project marked with file .emacs-project
Date: Fri, 05 Jun 2020 19:22:21 +0000

       
Hello,       
       
"Dmitry Gutov" <dgutov@yandex.ru> writes:

> I like this suggestion better (no "special" files), but would we be able
> to avoid scope creep? Wouldn't users then expect being able to specify
> ignored directories in such projects? And then faster indexing (e.g.
> using caching), compared to the VC backend?

Isn't this already supported?
In a major mode I'm making right now I believe I have covered both options:

(defcustom elm-root-file "elm.json"
  "...")   
   
(defun elm-project-root (dir)
  "Create the cons cell `project-root' needs to discover root."
  (let ((root (locate-dominating-file dir elm-root-file)))
    (when root
      (cons 'elm root))))
  
(cl-defmethod project-root ((project (head elm)))
  (cdr project))

(cl-defmethod project-ignores ((project (head elm)) dir)
  (append vc-directory-exclusion-list
          ;; This could also be a defcustom ofc
          (list "./elm-stuff/")))

(add-hook 'project-find-functions #'elm-project-root)

- This will add both the option to not execute git init, but still find root.
- Also grepping will ignore the "node-modulesy" "elm-stuff".
- In addition, the vc-directory-exclusion-list can be edited to support 
arbitrary patterns, at least with my limited testing.
- It should be no problem to add a ".emacs-project" there in your own config?
  
Am I missing something, or is this already available? This of course depends on 
major modes supporting this integration?
  
Theodor  
  
>
> Projectile uses the "special file" for the former, and I'm not really
> fond of its solution for the latter.






reply via email to

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