unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Uberti via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 54228@debbugs.gnu.org
Subject: bug#54228: 29.0.50; project.el: Support local projects
Date: Thu, 3 Mar 2022 08:15:06 +0100	[thread overview]
Message-ID: <c6b7c2f4-28a2-400e-04a8-dc30e5cbd84e@inventati.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

Hi,

I attached a small patch which simply adds to project.el some code I
have been using for a while for projects that I do not intend to handle with Git.

The gist of it is that adding a `.project` (empty) file to the root
directory of your project make it possible for commands such as 'C-x p f' to 
work on it.

Is this of any interest?

-- 
Manuel Uberti
www.manueluberti.eu

[-- Attachment #2: 0001-Support-local-projects.patch --]
[-- Type: text/x-patch, Size: 1245 bytes --]

From 63b29ff98c4914ab55d828146e44d318cc8c0b62 Mon Sep 17 00:00:00 2001
From: Manuel Uberti <manuel.uberti@inventati.org>
Date: Thu, 3 Mar 2022 08:08:16 +0100
Subject: [PATCH] Support local projects

* lisp/progmodes/project.el (project-try-local):
New function.
(project-find-functions):
Use it.
---
 lisp/progmodes/project.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b44f4618be..4f19e2aaf4 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -165,7 +165,8 @@ project
   :version "28.1"
   :group 'tools)
 
-(defvar project-find-functions (list #'project-try-vc)
+(defvar project-find-functions (list #'project-try-vc
+                                     #'project-try-local)
   "Special hook to find the project containing a given directory.
 Each functions on this hook is called in turn with one
 argument, the directory in which to look, and should return
@@ -680,6 +681,12 @@ project-buffers
         (push buf bufs)))
     (nreverse bufs)))
 
+(cl-defmethod project-root ((project string))
+  project)
+
+(defun project-try-local (dir)
+  (locate-dominating-file dir ".project"))
+
 \f
 ;;; Project commands
 
-- 
2.25.1


             reply	other threads:[~2022-03-03  7:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  7:15 Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-03-03 12:36 ` bug#54228: 29.0.50; project.el: Support local projects Rudolf Schlatte
2022-03-04 17:48 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-04 18:15   ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05  1:31     ` Dmitry Gutov
2022-03-05  7:42       ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05 16:15   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=c6b7c2f4-28a2-400e-04a8-dc30e5cbd84e@inventati.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=54228@debbugs.gnu.org \
    --cc=manuel.uberti@inventati.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).