emacs-devel
[Top][All Lists]
Advanced

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

Re: Add project-name function


From: Philip Kaludercic
Subject: Re: Add project-name function
Date: Sat, 06 Mar 2021 15:10:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

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.

> +  (file-name-nondirectory
> +   (directory-file-name
> +    (project-root project))))

-- 
        Philip K.



reply via email to

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