From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Add project-name function Date: Sat, 6 Mar 2021 22:22:22 +0200 Message-ID: <3a860f4f-2325-9bea-991d-75d2831a7372@yandex.ru> References: <877dmltdwn.fsf@ya.ru> <87wnuknzjf.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15032"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: emacs-devel@gnu.org To: Philip Kaludercic , Ivan Sokolov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 06 21:23:03 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIdS3-0003p2-0G for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 21:23:03 +0100 Original-Received: from localhost ([::1]:56906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIdS2-0003Ae-36 for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 15:23:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIdRW-0002lh-9E for emacs-devel@gnu.org; Sat, 06 Mar 2021 15:22:30 -0500 Original-Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:47023) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIdRT-0003l6-GT for emacs-devel@gnu.org; Sat, 06 Mar 2021 15:22:29 -0500 Original-Received: by mail-ej1-x62c.google.com with SMTP id r17so11434683ejy.13 for ; Sat, 06 Mar 2021 12:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=G1bQS381BYkV4ausBcDJEWESVaI556FmqcXhgMM2llg=; b=Vjs4t/xwRluXXgX3daCAtRM9ei8VmDCKSBCVHBlZfMk7VDk2GovZF1xANezZnqlvm2 kwML1MvRQGDmxkGbnV30JPXoAjd3dGePrqYl4bNCbwKYu2bybFa0a66zgnJaqs2i4Hjb j4jWUxWkHW58uBJkG+/CS6QQsvn0zD4NPZ+/MKqF2RPO2vL0MubJclKqDajD3dPwSaSM lbqSF7K+BC62FiKBwtrGCqvtaeQaxGtV4VQeQ1FWJ1yLsED1kQ2Q6MVjuxdBB8K+joob JzGiR0J2EFVr7iG4nVfc/qKvFvSAbIq7N7f8FXo+dUF+nUVLFb42id081R1pLdWCDynt 1mFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=G1bQS381BYkV4ausBcDJEWESVaI556FmqcXhgMM2llg=; b=ZVoY1AWVqoGPJVLQMxtCocxsYRI+LgXhmM2qabnN8C99uAjV5mJcwdg+cqIOzYFyhW PJc933KrfJd9QyDtL6LWX5roXivP1YRix6wr919lyIWfJGW88sNj1SpvaBFEJf9AHwp7 UqDPkyt7oBwXnQCsHxsV2PFXMNxKPuzf43e7Be7y+ElMNZVV3IB9GA9cCqT4I2xbVjGR PXCUxWZlLaKDe5LYPpdeupDDxN3/JoyM/yo7AB/6rnVEUIXB4aZtPni6S23/KFlJeMW9 2WD1+vovs1EP7Ze82DB1T3etuuFKq0104t5Gccrk10P3GBd6O9i3KmGHTrOPMEEJsKwb 7MuQ== X-Gm-Message-State: AOAM530y3bE8jhQtZwmH/3uxq+2bDiKW7IUO70/4+bzqbLtKDWEZlci2 akwIXOX5vfy4+WJ84YeSX6gJoQecMjg= X-Google-Smtp-Source: ABdhPJw2UgO62QxOi1Bnw8qfqGSVlE8Yy3DotPNjBwE8bGLZH9liUdjceukdnCwV6eFwkNYhZBckfw== X-Received: by 2002:a17:906:86c1:: with SMTP id j1mr8405088ejy.373.1615062146023; Sat, 06 Mar 2021 12:22:26 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id ld19sm3790583ejb.102.2021.03.06.12.22.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Mar 2021 12:22:25 -0800 (PST) In-Reply-To: <87wnuknzjf.fsf@posteo.net> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=raaahh@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266101 Archived-At: Hi Ivan and Philip, On 06.03.2021 16:10, Philip Kaludercic wrote: > Ivan Sokolov 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 >> 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?