unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Add project-name function
Date: Sat, 06 Mar 2021 15:10:28 +0100	[thread overview]
Message-ID: <87wnuknzjf.fsf@posteo.net> (raw)
In-Reply-To: <877dmltdwn.fsf@ya.ru> (Ivan Sokolov's message of "Sat, 06 Mar 2021 01:48:56 +0300")

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	other threads:[~2021-03-06 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 22:48 Add project-name function Ivan Sokolov
2021-03-06 14:10 ` Philip Kaludercic [this message]
2021-03-06 20:22   ` Dmitry Gutov
2021-03-06 20:51     ` Ivan Sokolov
2021-03-06 20:53     ` Add " Ivan Sokolov

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=87wnuknzjf.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    --cc=ivan-p-sokolov@ya.ru \
    /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).