all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47287: 28.0.50; [PATCH] Add command project-remove-known-project
@ 2021-03-20 23:28 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-21  0:27 ` Dmitry Gutov
  2021-03-21  6:17 ` Eli Zaretskii
  0 siblings, 2 replies; 24+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-20 23:28 UTC (permalink / raw)
  To: 47287

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-command-project-remove-known-project.patch --]
[-- Type: text/x-patch, Size: 1901 bytes --]

From 60992f4f6c4a7e9bc876f5546e7316f3fea0bf59 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
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)


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

end of thread, other threads:[~2021-09-21 18:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-20 23:28 bug#47287: 28.0.50; [PATCH] Add command project-remove-known-project Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21  0:27 ` Dmitry Gutov
2021-03-21  6:33   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 11:42     ` Dmitry Gutov
2021-03-21  6:17 ` Eli Zaretskii
2021-03-21  6:38   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 12:12     ` Dmitry Gutov
2021-03-21 12:15       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 23:21       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 23:54         ` Dmitry Gutov
2021-03-22  7:48           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-22 11:52             ` Dmitry Gutov
2021-03-22 12:29               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-23 11:37             ` Eli Zaretskii
2021-03-23 12:30               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-23 12:43                 ` Eli Zaretskii
2021-03-23 12:50                   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-24 23:17                     ` Dmitry Gutov
2021-03-25  0:03                       ` Basil L. Contovounesios
2021-03-25  1:04                         ` Dmitry Gutov
2021-03-25  6:15                           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25  7:29                             ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 13:24                               ` Dmitry Gutov
2021-09-21 18:36                                 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.