unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59756: [PATCH] Use file-name-nondirectory to determine project-name
@ 2022-12-02  3:34 Randy Taylor
  2022-12-02  8:08 ` Eli Zaretskii
  2022-12-02 15:24 ` Dmitry Gutov
  0 siblings, 2 replies; 5+ messages in thread
From: Randy Taylor @ 2022-12-02  3:34 UTC (permalink / raw)
  To: 59756; +Cc: dgutov


[-- Attachment #1.1: Type: text/plain, Size: 231 bytes --]

X-Debbugs-CC: dgutov@yandex.ru

If a project is named something like ".emacs.d", file-name-base will return ".emacs" instead of ".emacs.d" as expected (or at least as I expect it).

Therefore, we use file-name-nondirectory instead.

[-- Attachment #1.2: Type: text/html, Size: 1053 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-file-name-nondirectory-to-determine-project-name.patch --]
[-- Type: text/x-patch; name=0001-Use-file-name-nondirectory-to-determine-project-name.patch, Size: 989 bytes --]

From 046b1726e17e07d4800e2d3458c60942a579b67e Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Thu, 1 Dec 2022 22:12:07 -0500
Subject: [PATCH] Use file-name-nondirectory to determine project-name

* lisp/progmodes/project.el (project-name): Use file-name-nondirectory
instead of file-name-base.
---
 lisp/progmodes/project.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 3f4a5fb04bc..4eed599d86c 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -278,7 +278,7 @@ project-external-roots
 (cl-defgeneric project-name (project)
   "A human-readable name for the project.
 Nominally unique, but not enforced."
-  (file-name-base (directory-file-name (project-root project))))
+  (file-name-nondirectory (directory-file-name (project-root project))))
 
 (cl-defgeneric project-ignores (_project _dir)
   "Return the list of glob patterns to ignore inside DIR.
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-02 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02  3:34 bug#59756: [PATCH] Use file-name-nondirectory to determine project-name Randy Taylor
2022-12-02  8:08 ` Eli Zaretskii
2022-12-02 12:47   ` Stefan Kangas
2022-12-02 14:37   ` Dmitry Gutov
2022-12-02 15:24 ` Dmitry Gutov

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).