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: Wed, 14 Jun 2023 15:12:58 +0300 Message-ID: <83legmutrp.fsf@gnu.org> References: <83v8g240g6.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31123"; 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 Wed Jun 14 14:13:21 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 1q9PNJ-0007vm-41 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Jun 2023 14:13:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9PN2-0007r0-3u; Wed, 14 Jun 2023 08:13:04 -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 1q9PN0-0007q3-Aq for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 08:13: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 1q9PMz-00051y-US for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 08:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q9PMz-00026t-OG for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 08:13: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: Wed, 14 Jun 2023 12:13: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.16867447738088 (code B ref 63896); Wed, 14 Jun 2023 12:13:01 +0000 Original-Received: (at 63896) by debbugs.gnu.org; 14 Jun 2023 12:12:53 +0000 Original-Received: from localhost ([127.0.0.1]:43944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9PMo-000269-54 for submit@debbugs.gnu.org; Wed, 14 Jun 2023 08:12:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9PMk-00025m-5L for 63896@debbugs.gnu.org; Wed, 14 Jun 2023 08:12:49 -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 1q9PMe-0004w8-8F; Wed, 14 Jun 2023 08:12: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=Gxk+Zbv0zZDzu15ltZIK4weHJaX2ZNjKS7yKmorJAvo=; b=CGU8MuyDLRUI 5j/mIri+4k5GA5BI43Afm51BTlC0Lr0wGKvXZ46HsFWq88zwKzxr9IT/W5cMP3ONBPv89zyHNX9AW ZvJ+/Ve3Rzc41hlCSaBHiBKnwUY4ul9FFQ5keAoU1UoT4IXt8tzv6YRM3ktoq8qq9iCJr4nDq81NQ RI2OBjj0ZbB/mIKqcDI4TejmSVqFnUAVmlmNxkT+r+hRmoXqoDIzDYmrutNAVTi+lpvEwxOjrwRf4 m8vsFSsU5fl2c4DnnXxEHTKVQ8RQDCOsOn11DYobhF3caDXdffLAcMV0+BN6Y8Id8C+timA2JIAAS Dw59tBwPR6HR561b5ypdFw==; 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 1q9PMd-0003pC-OT; Wed, 14 Jun 2023 08:12:40 -0400 In-Reply-To: (message from Spencer Baugh on Tue, 13 Jun 2023 17:19:52 -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:263367 Archived-At: > From: Spencer Baugh > Cc: 63896@debbugs.gnu.org > Date: Tue, 13 Jun 2023 17:19:52 -0400 > > >> + (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? > > I'd be happy to use a cons or a vector, or even a more complicated > structure, but I didn't see an easy way to do comparison of > complicated structures, for the sorting of projects based on their > annotation. For example, if I have values of the form > (num . (num num num)) You'd need to write a custom comparison function, but why is that a problem? > there's no way to know what sorting predicate to use for such values - I > need to be able to know which value should sort sort first, when I have > a pair of them. But the encoding scheme above provides the answer: you want errors to sort before the warnings. So it sounds like you already decided how to sort those, no? > >> + (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. > > Annoyingly if I want to include the exit code of the compilation in the > annotation, the only place it's found is as a string in > mode-line-process. I could extract that string from mode-line-process > and use it, but I thought it would be a bad idea to depend on the exact > structure of what compile.el puts in mode-line-process. So I just > format-mode-line'd it. > > Would it be OK to make compile.el store the exit code as a number in a > variable and then use that? Then I wouldn't need to touch > mode-line-process at all. I don't see why you'd need that. Doesn't process-exit-status give you that value? mode-line-process is not some magic, it just accesses process information exposed via the different primitives.