From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#47287: 28.0.50; [PATCH] Add command project-remove-known-project Date: Tue, 23 Mar 2021 13:50:45 +0100 Message-ID: References: <83v99lav45.fsf@gnu.org> <95323A8F-5875-413E-952D-383163B0D1A8@thornhill.no> <4f5e3918-e133-88e4-b5c9-90a81e348497@yandex.ru> <835z1i85jc.fsf@gnu.org> <83zgyu6nwj.fsf@gnu.org> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47287@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 23 13:51:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lOgV5-0009Wl-Rr for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 13:51:12 +0100 Original-Received: from localhost ([::1]:42102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOgV4-00074g-PA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 08:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOgUw-000729-4o for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 08:51:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOgUv-000299-ST for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 08:51:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOgUv-0003wK-Qw for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 08:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Mar 2021 12:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47287 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47287-submit@debbugs.gnu.org id=B47287.161650385115125 (code B ref 47287); Tue, 23 Mar 2021 12:51:01 +0000 Original-Received: (at 47287) by debbugs.gnu.org; 23 Mar 2021 12:50:51 +0000 Original-Received: from localhost ([127.0.0.1]:59797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOgUl-0003vt-16 for submit@debbugs.gnu.org; Tue, 23 Mar 2021 08:50:51 -0400 Original-Received: from out2.migadu.com ([188.165.223.204]:50202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOgUi-0003vj-FK for 47287@debbugs.gnu.org; Tue, 23 Mar 2021 08:50:50 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1616503846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/C17YbBXa4oeEiWBMmvVG/a39CBhN5PuBA/OB+tdoXU=; b=ceSvZDXguvnR04J698496HkPoswkUOY1tbqTzP57o6QfmZ+RSkJThOo6HzsNgIsl2Vt0E0 KGj2zKlI/rO/3jYupxJyejawVSKqS3UKGlC4PAhlrFiZyV0r5gcNjUhlSKL3fKlPNH7RU9 0YwN92ralCiR0+PNrbNlYd3A6gjMAicsyb1emhv/LynUxBK8grit/vQ4g0sUS3doavvqy5 HfUwzOqFuzeqyx8B6NxlkKlqxouqAnC66+9pmg2iW5Ypefodxfkx/2XFWFLJB7zQ1tCbmw 0SCYkx1Yw5piwf455oX+m0YIAkk1+s8W6pb2lrHRnqPzQfcUs/kK8puze7Wpig== In-Reply-To: <83zgyu6nwj.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202899 Archived-At: --=-=-= Content-Type: text/plain > > 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 :) -- Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-project-remove-known-project.patch >From aca3a486b391f92b04ef2c9a16d5d5760062ec4b Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Mon, 22 Mar 2021 00:19:23 +0100 Subject: [PATCH] Add command project-remove-known-project * etc/NEWS: Mention the new command. * lisp/progmodes/project.el (project--remove-from-project-list): Add new argument, report-message, used to signal various messages when removal has happened. * lisp/progmodes/project.el (project-remove-known-project): New command that removes the selected directory from the project-list-file. * lisp/progmodes/project.el (project-current): Add the report message. * doc/emacs/maintaining.text: Add information about the new command to the manual. --- doc/emacs/maintaining.texi | 16 ++++++++++++++++ etc/NEWS | 5 +++++ lisp/progmodes/project.el | 23 +++++++++++++++++------ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 2750418871..7e449a5c25 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1843,6 +1843,22 @@ in the menu, and which key invokes each command. records the list of known projects. It defaults to the file @file{projects} in @code{user-emacs-directory} (@pxref{Find Init}). +@node Managing project list file +@subsection Managing Projects + +@table @kbd +@item M-x project-remove-known-project +Remove a known project from the (@code{project-list-file}). +@end table + +@findex project-remove-known-project + Normally Emacs handle adding and removing projects to the +(@code{project-list-file}) automatically. Sometimes you still want to +manually edit the available +projects. @kbd{M-x project-remove-known-project} will prompt you for the +available projects, and upon selecting one, it will disappear from the +@code{project-list-file} + @node Change Log @section Change Logs diff --git a/etc/NEWS b/etc/NEWS index 49a4bb8106..638e457972 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 b6a886f731..07842977ef 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -201,7 +201,8 @@ of the project instance object." (when maybe-prompt (if pr (project-remember-project pr) - (project--remove-from-project-list directory) + (project--remove-from-project-list + directory "Project `%s' not found; removed from list") (setq pr (cons 'transient directory)))) pr)) @@ -1217,17 +1218,27 @@ Save the result in `project-list-file' if the list of projects has changed." (push (list dir) project--list) (project--write-project-list)))) -(defun project--remove-from-project-list (pr-dir) - "Remove directory PR-DIR of a missing project from the project list. +(defun project--remove-from-project-list (project-root report-message) + "Remove directory PROJECT-ROOT of a missing project from the project list. If the directory was in the list before the removal, save the result in `project-list-file'. Announce the project's removal -from the list." +from the list using REPORT-MESSAGE, which is a format string +passed to `message' as its first argument." (project--ensure-read-project-list) - (when-let ((ent (assoc pr-dir project--list))) + (when-let ((ent (assoc project-root project--list))) (setq project--list (delq ent project--list)) - (message "Project `%s' not found; removed from list" pr-dir) + (message report-message project-root) (project--write-project-list))) +;;;###autoload +(defun project-remove-known-project (project-root) + "Remove directory PROJECT-ROOT from the project list. +PROJECT-ROOT is the root directory of a known project listed in +the project list." + (interactive (list (project-prompt-project-dir))) + (project--remove-from-project-list + dir "Project `%s' removed from known projects")) + (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) --=-=-=--