Subject: bug#47287: closed (Re: bug#47287: 28.0.50; [PATCH] Add command project-remove-known-project)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 24 Mar 2021 23:18:02 +0000

Your bug report

#47287: 28.0.50; [PATCH] Add command project-remove-known-project

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
47287: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47287
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#47287: 28.0.50; [PATCH] Add command project-remove-known-project
From: Dmitry Gutov <[email-masked]>
To: Theodor Thornhill <[email-masked]>, Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Thu, 25 Mar 2021 01:17:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On 23.03.2021 14:50, Theodor Thornhill via Bug reports for GNU Emacs, 
the Swiss army knife of text editors wrote:
> 
>>
>> One last nit from me: since you now include the changes to the manual,
>> this NEWS entry should be marked by "+++" before it, per the note at
>> the beginning of NEWS.
> 
> Of course - added. Thanks for patience :)

Thank you for following up.

Installed and closing.

Subject: 28.0.50; [PATCH] Add command project-remove-known-project
From: Theodor Thornhill <[email-masked]>
To: [email-masked]
Date: Sun, 21 Mar 2021 00:28:24 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello!

This patch adds an interactive command 'project-remove-known-project',
that lets the user interactively remove a project from the project
list.  My usecase is that sometimes when a directory is moved, the
project isn't deleted from the list.

This command is modelled after the already present
'project--remove-from-project-list', but that function isn't
interactive, and also has a specific purpose.

I did not add a binding, nor add it to the
project-switch-commands. Unsure if deserves a spot there :).

--
Theodor Thornhill

>From 60992f4f6c4a7e9bc876f5546e7316f3fea0bf59 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <[email-masked]>
Date: Sun, 21 Mar 2021 00:23:28 +0100
Subject: [PATCH] Add command project-remove-known-project

* etc/NEWS: Add information about new command.
* lisp/progmodes/project.el (project-remove-known-project): New
command that allows deleting of known projects from the project list.
---
 etc/NEWS                  |  5 +++++
 lisp/progmodes/project.el | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index c602166397..20017ea30b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1573,6 +1573,11 @@ project's root directory, respectively.
 +++
 *** New user option 'project-list-file'.
 
++++
+*** New command 'project-remove-known-project'.  
+This command lets you interactively remove an entry from the list of projects
+in 'project-list-file'
+
 ** xref
 
 ---
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index bd552c917a..a9db511b46 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1228,6 +1228,17 @@ from the list."
     (message "Project `%s' not found; removed from list" pr-dir)
     (project--write-project-list)))
 
+;;;###autoload
+(defun project-remove-known-project (dir)
+  "Remove directory DIR, a known project from the project list. 
+Announce the projects removal from the `project-list-file'."
+  (interactive (list (project-prompt-project-dir)))
+  (project--ensure-read-project-list)
+  (when-let ((ent (assoc dir project--list)))
+    (setq project--list (delq ent project--list))
+    (message "Project `%s' removed from known projects" dir)
+    (project--write-project-list)))
+
 (defun project-prompt-project-dir ()
   "Prompt the user for a directory that is one of the known project roots.
 The project is chosen among projects known from the project list,
-- 
2.24.3 (Apple Git-128)