From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Date: Mon, 05 Jun 2023 14:23:37 +0300 Message-ID: <83v8g240g6.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5545"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63896@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 05 13:43:37 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 1q68ca-0001Fo-4E for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Jun 2023 13:43:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q68Ji-0007FC-F1; Mon, 05 Jun 2023 07:24:06 -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 1q68Je-0007DP-IP for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2023 07:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q68Je-00068K-9l for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2023 07:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q68Jd-0007nO-Rm for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2023 07:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Jun 2023 11:24: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.168596422829935 (code B ref 63896); Mon, 05 Jun 2023 11:24:01 +0000 Original-Received: (at 63896) by debbugs.gnu.org; 5 Jun 2023 11:23:48 +0000 Original-Received: from localhost ([127.0.0.1]:48259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q68JP-0007ml-VX for submit@debbugs.gnu.org; Mon, 05 Jun 2023 07:23:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q68JN-0007mX-Rv for 63896@debbugs.gnu.org; Mon, 05 Jun 2023 07:23:46 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q68JI-00065u-8Q; Mon, 05 Jun 2023 07:23:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Lu13+MeXcsXdC+xNLo37GDF5PsspqBaeA0NqV9HwNro=; b=XMuN4y1Hmen+ WrxcOnw1uUGpC4wyeRzO9z9ZF3eZtYSI3uXmkUJ4z5+j3rTnPoEDtjf2f0XgzxjS796YGO3ZJdKSZ Nqvqyx0Y2ChdYI9h4aZl42YYeqYly9V+pvhj/YfWhb1rNCM1wY4T1+U+ib8Mquihp1D5kAxBMb4bh nYDBZ4Q7kiPTAT9kb4wRLZB+gzwlVidEWRsucsdezxByi8RufWg/A8mcc2GIddP3ID4p+lkE2j88O HHs+B45/tzGZXtEa7pd5S+JAVqmPzrsE57UjDhNwLJutHd86N/o1kZwZByv4AQKSzyDyWRUyJTq7y LC/rPYlHgYBT2zIAti+zmQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q68JH-0005Wq-Nx; Mon, 05 Jun 2023 07:23:40 -0400 In-Reply-To: (message from Spencer Baugh on Sun, 04 Jun 2023 17:20:19 -0400) 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:263002 Archived-At: > From: Spencer Baugh > Date: Sun, 04 Jun 2023 17:20:19 -0400 > > 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. Thanks. A few minor comments. > +(defun project-annotation-numbufs (pr) > + "Annotate PROJECT with the length of `project-buffers'." The argument is named PR, not PROJECT. Also, instead if too-technical "length of `project-buffers'", how about saying "number of buffers in the project", or "number of buffers in `project-buffers'"? > +(defun project-annotation-mtime (pr) > + "Annotate PROJECT with the modification time of its root directory. PR, not PROJECT. > +Note that the modification time will only change when files > +directly under the root directory are added or deleted. If you > +only add or delete files in subdirectories, or if you only modify > +existing files, the modification time won't change." This is not guaranteed, so I'd suggest to mention that the reliability of this annotation is questionable, and depends on the underlying filesystem. > +(defun project-annotation-compilation (project) > + "Annotate PROJECT with information from its compilation buffer if any." I'd add here something about that "information". Right now, this doc string is not very useful. > + (cons (+ (* 100 compilation-num-errors-found) > + (* 10 compilation-num-warnings-found) Why "encode" these numbers in a single value? why not use a cons or a vector? > + (format-mode-line mode-line-process nil nil buf))) Do you really need to call format-mode-line? My advice is to stay away of that function: it could have unpleasant side effects.