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: Mon, 22 Mar 2021 13:29:29 +0100 Message-ID: References: <83v99lav45.fsf@gnu.org> <95323A8F-5875-413E-952D-383163B0D1A8@thornhill.no> <4f5e3918-e133-88e4-b5c9-90a81e348497@yandex.ru> <6f4a0b1d-017d-a22f-3973-e9062c193bc6@yandex.ru> 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="30054"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47287@debbugs.gnu.org To: Dmitry Gutov , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 22 13:30:51 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 1lOJhr-0007j7-66 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Mar 2021 13:30:51 +0100 Original-Received: from localhost ([::1]:46460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOJho-0004If-S2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Mar 2021 08:30:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOJh6-0004Gk-6H for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 08:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOJh4-00085t-F8 for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 08:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOJh4-0004fI-Bu for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 08:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Mar 2021 12:30:02 +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.161641617617858 (code B ref 47287); Mon, 22 Mar 2021 12:30:02 +0000 Original-Received: (at 47287) by debbugs.gnu.org; 22 Mar 2021 12:29:36 +0000 Original-Received: from localhost ([127.0.0.1]:56407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOJge-0004dx-4U for submit@debbugs.gnu.org; Mon, 22 Mar 2021 08:29:36 -0400 Original-Received: from out2.migadu.com ([188.165.223.204]:11952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOJga-0004dn-DV for 47287@debbugs.gnu.org; Mon, 22 Mar 2021 08:29:34 -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=1616416170; 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=+qNdapVxxhOdXbShNf09B2JDUJ+Az3IXwMS5sE7a/Fk=; b=N6l5pB723MmAcnKSm1LiSHRLP4It3Qb5MXgbacXfP1R78zx6SHvILuv9PTf/sjAGN5K85j V8mWswi9MUTt+/pPjvEa/yMzApU9HQqAzd820Oh7Bbv1iO/lxrVeOx1W39a9CfWOFC1bU7 eYVT35ay7BNQGUoVuIZNX6JWLucSCStbEK+mnJZ3f111kZ6uSeEPzvKIVV2wWXBGVO37bK v8WunqhWAu/Jb3fsJyhKM8bx2CxFNLlxoEXKter5jRbdbeKTJMAb/SsHTXuCN72/oYbKLQ NAVUcEcmXIWhMbzyNcdflqmzfy46XjIvwf8InDD5Z757ucWXHpy8rtOmTaTSFg== In-Reply-To: <6f4a0b1d-017d-a22f-3973-e9062c193bc6@yandex.ru> 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:202829 Archived-At: --=-=-= Content-Type: text/plain > Thanks, LGTM. > Great! >>> Anyway, the latter is not a big deal; project--remove-from-project-list >>> can be changed at any time later. >> Sure! Do the manual later, or now? > > It's the next step, yes. Something like this? -- Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-project-remove-known-project.patch >From adf4d92e5cea6183666611757f647c607f633bc0 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 | 4 ++++ lisp/progmodes/project.el | 22 ++++++++++++++++------ 3 files changed, 36 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..abe7107f12 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1573,6 +1573,10 @@ 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..d76bcbbe96 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,26 @@ 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." (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) --=-=-=--