From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Date: Thu, 24 Aug 2023 04:47:36 +0300 Message-ID: <6beaa4eb-bf50-2f1d-099e-cc5cdbb995e2@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9308"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: Spencer Baugh , 63896@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 24 03:48:24 2023 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 1qYzSR-0002FT-B6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 03:48:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYzS4-0004aP-Nt; Wed, 23 Aug 2023 21:48:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYzS3-0004aC-MB for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 21:47:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYzS2-0000J7-BM for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 21:47:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYzS6-0000TZ-0p for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 21:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Aug 2023 01:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63896-submit@debbugs.gnu.org id=B63896.16928416731772 (code B ref 63896); Thu, 24 Aug 2023 01:48:01 +0000 Original-Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 01:47:53 +0000 Original-Received: from localhost ([127.0.0.1]:35700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYzRx-0000SU-34 for submit@debbugs.gnu.org; Wed, 23 Aug 2023 21:47:53 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:35611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYzRu-0000Rd-7f for 63896@debbugs.gnu.org; Wed, 23 Aug 2023 21:47:52 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 60EAE32008FC; Wed, 23 Aug 2023 21:47:40 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 23 Aug 2023 21:47:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1692841659; x=1692928059; bh=tdvguO9PH6ZekzU/e5XaF7AVLj6eO6ud8hl h/AfXMe4=; b=q1fbZoc1R5LJ6cJv17k01RVAZYyAXrB0zaAaGPCHq6Sr+laPg/J MLKyPQCV9UEWDyEv61aZWs712/Cdy2Yt7fIWWyRdHd1OUus/AsoE/QGmEOQjl8zg vgSNj/KRMiZ/owDXNiZB912rbcXd+XH3qiBxhSvLDmAPoLSbfbGTTiwVkT1O2zLY MB9fANOr7rCKRZ+j9T57p13BjDvJd/W71BLtznJJBy2bm491NA2nuqhf2hEL0auQ mk0NfGI69cYk91kV1Gb+lW0y4OK6yhACj46h3z4jlCjKqou7pPqpYZWj8zk1qPkf V4QfPBdKOXo0pIX1ZwS5UqiP2Cxy93FqGag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1692841659; x= 1692928059; bh=tdvguO9PH6ZekzU/e5XaF7AVLj6eO6ud8hlh/AfXMe4=; b=g ZrLF4lsrKiV4sbcuO+ZLhMG0/9Nkx07A6KvZbyRRtQkCw0nXtaZv94xZR+l7BiWk 90SkBWIATSn3UAzO7A6Vv1Jk7sqzmpWWy9eCBTZkkpS8LuyDAjnhYmNoEHYI4JO/ z7Ux2WWdV5bbngVvCsytTRUM+rzaJl51OxwLzNo53OoZSOBcEClmbpTKNb2tudLc 9SCnPp3hpi5Fn4vpuZeqUXncH5rHz9aBLMGQwCD2Dy6TWTFSJya4egI2n8TWYeHy IFbooLqVRK5d5oC9R4yH9ewz+eD/fPXoagnaQDxshv/HySEsWrXAY5DCXbT0WQnw 6fNdSnGKDHJAJ9/jci2Ow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddvhedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeghedthedujeeiteeutddtjeekheejteeukeehffdutdejuedvfeevueeviedu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Aug 2023 21:47:38 -0400 (EDT) Content-Language: en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268291 Archived-At: Hi Spencer, Sorry for replying late on this one. It looks like an interesting feature, going a bit further in the IDE department ("denser" UI). I've tried the patch a little, here are some notes. On 05/06/2023 00:20, Spencer Baugh wrote: > Tags: patch > > > This patch adds an annotation-function and display-sort-function to the > completion-table used for project-prompt-project-dir and > project-prompt-project-name, as well as a user customization variable to > customize the behavior of the annotation and sorting functions. > The idea is that projects are annotated with useful information for > deciding which one you want to switch to, and sorted based on how likely > you are to want to switch to or work on them. For example, a user might > want to know how many buffers they have open in each project, to help > tell them apart at a glance. Furthermore, a user might be more likely > to switch to projects they've already been working on in this Emacs > instance, so they might want projects with more buffers open to be > sorted before projects with no buffers. Or they might still like the MRU order, or some combination of that together with the number of open issues or compilation errors. > All this is customized by the variable project-annotations which is a > list of functions used to generate the annotations and sorting metadata. > The user can add their own functions to add new annotations and sorting > behavior. See its docstring for more details. What do you think about splitting it into two vars? One for annotations (just text) and another for "sorters" (or something). Unless the performance difference is noticeable, decoupling the two will lead to better customizability: the fact that I want to see the numbers of errors doesn't necessarily mean I want them to be used for sorting. Or vice versa: I could move that number closer to the end in display, but prefer to have it weigh more prominently when sorting. > I added three annotation functions as a starting point, which when added > to project-annotations will annotate with the number of buffers, the > modification time of the root directory, and compilation results. Regarding the mtime one, we could also look at mtime of .git or .hg subdirectory when present, and take the max. About the "compilation" one -- and this is nothing urgent -- I launch my compilation submode buffers using rspec-mode, not through project-compile. Might be useful to have that supported ootb without having to tweak the corresponding function. Just a search for compiletion-mode derived buffers belonging to the given project could work. > In this patch I have turned all three of these annotations on by > default, by putting all three in project-annotations, but probably when > this is actually pushed we want project-annotations to be empty by > default. (Maybe?) Probably. Up for later discussion, I guess. We could also run an experiment. > In my own packages, building on this, I hope to add annotation functions > like "number of bugs assigned to you in this project" and "number of > lines of incoming code to review in this project", so that > project-switch-project is a nice way to pick what to work on next. Very cool. Nothing that we could include ootb, but if you have a system which fetches the info over time and caches locally, that would be a great addition. > This patch is still a bit rough around the edges, but I'm posting it now > to get feedback. Two problems I encountered when testing: - It tries to connect to remote directories which have no currenct connection. This line: + (cons (car dir) (project--find-in-directory (car dir)))) I fixed it by adding (when (or (not (file-remote-p (car dir))) (file-remote-p (car dir) nil t)) ... but there might be a more efficient solution. We could drop remote projects from this altogether, but OTOH some users could work exclusively over Tramp (e.g. in local Docker VMs). Something to think about. - The (return ...) call needed the cl- prefix. It doesn't compile otherwise (and breaks in 'emacs -Q').