emacs-devel
[Top][All Lists]
Advanced

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

Re: Add project-name function


From: Dmitry Gutov
Subject: Re: Add project-name function
Date: Sat, 6 Mar 2021 22:22:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Ivan and Philip,

On 06.03.2021 16:10, Philip Kaludercic wrote:
Ivan Sokolov<ivan-p-sokolov@ya.ru>  writes:

I hope I am doing everything right, this is my first patch for Emacs.

 From 0aa1b0417f2fd4f8fdef24194c55304611711cfa Mon Sep 17 00:00:00 2001
From: Ivan Sokolov<ivan-p-sokolov@ya.ru>
Date: Sat, 6 Mar 2021 01:43:30 +0300
Subject: [PATCH] lisp/progmodes/project.el: Add 'project-name'

---
  lisp/progmodes/project.el | 23 +++++++++++++----------
  1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index abe563bec0..3abae8606f 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -888,6 +888,13 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in
    (interactive)
    (vc-dir (project-root (project-current t))))
+;;;###autoload
+(defun project-name (project)
+  "Return PROJECT's name."
Without reading the rest of the code, I wasn't sure what a project's
name is. I think the docstring should explain that it just takes the
basename of the root directory.

It might be worth considering turning this into a method, in case a
project knows a better name.

The patch submission is fine (even though using the bug tracker next time would be preferable), and the point about the generic method is a good one too.

But I generally prefer to add new features to the API together with some accompanying usages inside the core. While the patch does that, we're currently discussing how to change both of the affected functions in a different way, and that change seems to be incompatible with the use of 'project-name' in them.

Check this thread out: https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00083.html

What do you think about the behavior proposed there?



reply via email to

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