X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Spencer Baugh <sbaugh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 04 Jun 2023 21:21:02 +0000 Resent-Message-ID: <handler.63896.B.168591363026688 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 63896 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.168591363026688 (code B ref -1); Sun, 04 Jun 2023 21:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Jun 2023 21:20:30 +0000 Received: from localhost ([127.0.0.1]:47504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q5v9J-0006wN-T7 for submit <at> debbugs.gnu.org; Sun, 04 Jun 2023 17:20:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:47884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1q5v9H-0006wD-7x for submit <at> debbugs.gnu.org; Sun, 04 Jun 2023 17:20:28 -0400 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 <sbaugh@HIDDEN>) id 1q5v9G-0003Ri-N0 for bug-gnu-emacs@HIDDEN; Sun, 04 Jun 2023 17:20:27 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>) id 1q5v9D-0001BM-Po for bug-gnu-emacs@HIDDEN; Sun, 04 Jun 2023 17:20:26 -0400 From: Spencer Baugh <sbaugh@HIDDEN> Date: Sun, 04 Jun 2023 17:20:19 -0400 Message-ID: <ierpm6audpo.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain 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. 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. 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. 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?) 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. This patch is still a bit rough around the edges, but I'm posting it now to get feedback. In GNU Emacs 29.0.90 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.12) of 2023-06-02 built on igm-qws-u22796a Repository revision: ff6163fac51759945aa619ca6bf28413be4a53e0 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: CentOS Linux 7 (Core) Configured using: 'configure --with-x-toolkit=gtk --with-gif=ifavailable' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Support-annotating-and-sorting-the-project-list-duri.patch From 11d76029db5f0d9e016f247aac24dd430b729c2a Mon Sep 17 00:00:00 2001 From: Spencer Baugh <sbaugh@HIDDEN> Date: Sat, 3 Jun 2023 13:21:30 -0400 Subject: [PATCH] Support annotating and sorting the project list during completion --- lisp/progmodes/project.el | 124 +++++++++++++++++++++++++++++++++++--- 1 file changed, 117 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 04c67710d71..01ce414221f 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -317,6 +317,117 @@ project--file-completion-table (t (complete-with-action action all-files string pred))))) +(defun project-annotation-numbufs (pr) + "Annotate PROJECT with the length of `project-buffers'." + (let ((numbufs (length (project-buffers pr)))) + (cons numbufs + (if (zerop numbufs) + "" + (format "%s buf" numbufs))))) + +(defun project-annotation-mtime (pr) + "Annotate PROJECT with the modification time of its root directory. + +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." + (let* ((mtime (file-attribute-modification-time (file-attributes (project-root pr)))) + (since-change (float-time (time-subtract (current-time) mtime)))) + (cons (- since-change) + (cl-dolist (format '("%x%Y" "%x%D" "%x%H" "%x%M" "%x%S") "") + (let ((result (format-seconds format since-change))) + (when (not (string-empty-p result)) + (return (concat result " old")))))))) + +(defun project-annotation-compilation (project) + "Annotate PROJECT with information from its compilation buffer if any." + (let* ((default-directory (project-root project)) + (name (funcall + (or project-compilation-buffer-name-function + compilation-buffer-name-function) "compilation")) + (buf (get-buffer name))) + (if buf + ;; TODO we should include in the sorting number whether the + ;; compilation exited non-zero; I don't see where, if + ;; anywhere, that's stored, though... + (with-current-buffer buf + (cons (+ (* 100 compilation-num-errors-found) + (* 10 compilation-num-warnings-found) + compilation-num-infos-found) + (format-mode-line mode-line-process nil nil buf))) + ;; projects with no errors are less interesting; + ;; sort them below projects that haven't been compiled at all + '(1 . "")))) + +(defcustom project-annotations (list + #'project-annotation-compilation + #'project-annotation-numbufs + #'project-annotation-mtime + ) + "Functions to call to add annotations when prompting for a project. + +While prompting for a project in `project-current' or +`project-switch-project', these functions are called to annotate +each completion alternative with information about the project, +and provide metadata to sort the projects by relevance. By +customizing this variable, you can make arbitrary information +available during project completion, as long as it's fast enough +to compute that it doesn't slow down completion. + +The order of functions in this list determines the order in which +annotations are used, which determines both their precedence for +sorting and the order in which they appear as an annotation after +the completion alternative. + +Each function is called with a single argument, a project +instance. It should return a cons cell, whose car should be +numeric and is used to sort the projects, greater values first, +and whose cdr should be a string to be included as an annotation +on the project during completion." + :type '(repeat (const :tag "Number of buffers" + project-annotation-compilation) + (const :tag "Modification time of root dir" + project-annotation-mtime) + (const :tag "Compilation results" + project-annotation-compilation) + (function :tag "Custom function" nil))) + +(defun project--project-completion-table (collection projects) + "Completion table for project identifiers in COLLECTION + +PROJECTS should be an alist mapping completions from COLLECTION +to project instances. Completions which are not in PROJECTS are +not annotated with `project-annotations'." + (let* (annots + (get-annot (lambda (completion pr) + (or (cdr (assoc completion annots)) + (let ((annot (mapcar (lambda (func) (funcall func pr)) project-annotations))) + (push (cons completion annot) annots) + annot)))) + (annotation-function + (lambda (completion) + (if-let (pr (cdr (assoc completion projects))) + (let ((annotations (mapcar #'cdr (funcall get-annot completion pr)))) + (concat " " (string-join (seq-remove #'string-empty-p annotations) ", "))) + ""))) + (display-sort-function + (lambda (completions) + (let ((with-nums (mapcar (lambda (completion) + (cons (when-let (pr (cdr (assoc completion projects))) + (mapcar #'car (funcall get-annot completion pr))) + completion)) + completions))) + (mapcar #'cdr (sort with-nums (lambda (a b) (version-list-< (car b) (car a))))))))) + (lambda (string pred action) + (cond + ((eq action 'metadata) + `(metadata . ((category . project-file) + (annotation-function . ,annotation-function) + (display-sort-function . ,display-sort-function)))) + (t + (complete-with-action action collection string pred)))))) + (cl-defmethod project-root ((project (head transient))) (cdr project)) @@ -1640,11 +1751,12 @@ project-prompt-project-dir It's also possible to enter an arbitrary directory not in the list." (project--ensure-read-project-list) (let* ((dir-choice "... (choose a dir)") + (projects + (mapcar (lambda (dir) + (cons (car dir) (project--find-in-directory (car dir)))) + project--list)) (choices - ;; XXX: Just using this for the category (for the substring - ;; completion style). - (project--file-completion-table - (append project--list `(,dir-choice)))) + (project--project-completion-table (cons dir-choice projects) projects)) (pr-dir "")) (while (equal pr-dir "") ;; If the user simply pressed RET, do this again until they don't. @@ -1667,9 +1779,7 @@ project-prompt-project-name (if-let (proj (project--find-in-directory dir)) (push (cons (project-name proj) proj) ret))) ret)) - ;; XXX: Just using this for the category (for the substring - ;; completion style). - (table (project--file-completion-table (cons dir-choice choices))) + (table (project--project-completion-table (cons dir-choice choices) choices)) (pr-name "")) (while (equal pr-name "") ;; If the user simply pressed RET, do this again until they don't. -- 2.39.3 --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Spencer Baugh <sbaugh@HIDDEN> Subject: bug#63896: Acknowledgement ([PATCH] Support annotating and sorting the project list during completion) Message-ID: <handler.63896.B.168591363026688.ack <at> debbugs.gnu.org> References: <ierpm6audpo.fsf@HIDDEN> X-Gnu-PR-Message: ack 63896 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 63896 <at> debbugs.gnu.org Date: Sun, 04 Jun 2023 21:21:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 63896 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 63896: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63896 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 05 Jun 2023 11:24:01 +0000 Resent-Message-ID: <handler.63896.B63896.168596422829935 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168596422829935 (code B ref 63896); Mon, 05 Jun 2023 11:24:01 +0000 Received: (at 63896) by debbugs.gnu.org; 5 Jun 2023 11:23:48 +0000 Received: from localhost ([127.0.0.1]:48259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q68JP-0007ml-VX for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 07:23:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1q68JN-0007mX-Rv for 63896 <at> debbugs.gnu.org; Mon, 05 Jun 2023 07:23:46 -0400 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 <eliz@HIDDEN>) 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==; 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 <eliz@HIDDEN>) id 1q68JH-0005Wq-Nx; Mon, 05 Jun 2023 07:23:40 -0400 Date: Mon, 05 Jun 2023 14:23:37 +0300 Message-Id: <83v8g240g6.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <ierpm6audpo.fsf@HIDDEN> (message from Spencer Baugh on Sun, 04 Jun 2023 17:20:19 -0400) References: <ierpm6audpo.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > 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.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Spencer Baugh <sbaugh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 13 Jun 2023 21:20:02 +0000 Resent-Message-ID: <handler.63896.B63896.168669120024124 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168669120024124 (code B ref 63896); Tue, 13 Jun 2023 21:20:02 +0000 Received: (at 63896) by debbugs.gnu.org; 13 Jun 2023 21:20:00 +0000 Received: from localhost ([127.0.0.1]:43182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q9BQm-0006H2-2e for submit <at> debbugs.gnu.org; Tue, 13 Jun 2023 17:20:00 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:34201) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1q9BQk-0006Gl-7C for 63896 <at> debbugs.gnu.org; Tue, 13 Jun 2023 17:19:58 -0400 From: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <83v8g240g6.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 05 Jun 2023 14:23:37 +0300") References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> Date: Tue, 13 Jun 2023 17:19:52 -0400 Message-ID: <ier5y7rgivb.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Spencer Baugh <sbaugh@HIDDEN> >> 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. Thanks, fixed. >> + (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)) 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. I could make project-annotations a list of tuples of functions, the first being the annotation-generating function, the second being the annotation-comparison function. Then I wouldn't need to encode the numbers into a single value. Does that seem like a reasonable design? I thought that was a bit overly complex. >> + (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.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 14 Jun 2023 12:13:01 +0000 Resent-Message-ID: <handler.63896.B63896.16867447738088 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.16867447738088 (code B ref 63896); Wed, 14 Jun 2023 12:13:01 +0000 Received: (at 63896) by debbugs.gnu.org; 14 Jun 2023 12:12:53 +0000 Received: from localhost ([127.0.0.1]:43944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q9PMo-000269-54 for submit <at> debbugs.gnu.org; Wed, 14 Jun 2023 08:12:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1q9PMk-00025m-5L for 63896 <at> debbugs.gnu.org; Wed, 14 Jun 2023 08:12:49 -0400 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 <eliz@HIDDEN>) 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==; 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 <eliz@HIDDEN>) id 1q9PMd-0003pC-OT; Wed, 14 Jun 2023 08:12:40 -0400 Date: Wed, 14 Jun 2023 15:12:58 +0300 Message-Id: <83legmutrp.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <ier5y7rgivb.fsf@HIDDEN> (message from Spencer Baugh on Tue, 13 Jun 2023 17:19:52 -0400) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: 63896 <at> 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.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Spencer Baugh <sbaugh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 15 Jun 2023 19:05:01 +0000 Resent-Message-ID: <handler.63896.B63896.168685586830798 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168685586830798 (code B ref 63896); Thu, 15 Jun 2023 19:05:01 +0000 Received: (at 63896) by debbugs.gnu.org; 15 Jun 2023 19:04:28 +0000 Received: from localhost ([127.0.0.1]:47964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q9sGi-00080e-6D for submit <at> debbugs.gnu.org; Thu, 15 Jun 2023 15:04:28 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:58433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1q9sGg-00080P-2N for 63896 <at> debbugs.gnu.org; Thu, 15 Jun 2023 15:04:26 -0400 From: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <83legmutrp.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 14 Jun 2023 15:12:58 +0300") References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> Date: Thu, 15 Jun 2023 15:04:20 -0400 Message-ID: <ier1qich7ij.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Spencer Baugh <sbaugh@HIDDEN> >> Cc: 63896 <at> 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? Yes, but how does that get configured? >> 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? Yes, but I mean that *this function* doesn't know, given some opaque value returned by a user-provided annotation function, how to sort. >> >> + (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. For sure, process-exit-status gives me that value. But how do I get the process to call it on? The process is dead at this point, so (get-buffer-process "*compilation*") returns nil. Is there a way to get the process associated with the buffer even though it's killed?
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 16 Jun 2023 05:44:02 +0000 Resent-Message-ID: <handler.63896.B63896.168689421314796 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168689421314796 (code B ref 63896); Fri, 16 Jun 2023 05:44:02 +0000 Received: (at 63896) by debbugs.gnu.org; 16 Jun 2023 05:43:33 +0000 Received: from localhost ([127.0.0.1]:48458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qA2FB-0003qZ-DM for submit <at> debbugs.gnu.org; Fri, 16 Jun 2023 01:43:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52316) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qA2F8-0003qL-K1 for 63896 <at> debbugs.gnu.org; Fri, 16 Jun 2023 01:43:32 -0400 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 <eliz@HIDDEN>) id 1qA2F2-0004Ts-4B; Fri, 16 Jun 2023 01:43:25 -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=GfLSCt+14xaLUTT+a4c3BzpolRhR0WzCpk60OERhMvM=; b=gFjFlr3mPPWl 16kem2gVCJb2xIC4d5me+w1i9SWDsCZuNRuQ2hviZxze6HTxv/431zH+34J5kuwlDe1tbtX5W2DiW bc7xZHwfR3Tex6eOignKfiv8fou1CklaMNJTh0e9C1VftfwwNHUnPQrHFrcrdGorLRgGVQw6YdDQ4 skft8rLADBovkosMJndqQbrG/jegXP5G7XAX+lt/qEjcd4JpM5EEh/aPPtNNZodWivr92IEEAMU23 UFgm3z+fnQpeVR/749qzpMby8u+okebcgHAihY5CPyy0NfJ83Wg9H9gILMcAC5wlmWwcXnL91asQ1 qEpNcc/w3Qo7tYDftH3piQ==; 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 <eliz@HIDDEN>) id 1qA2F1-0003hQ-8g; Fri, 16 Jun 2023 01:43:23 -0400 Date: Fri, 16 Jun 2023 08:43:47 +0300 Message-Id: <83bkhgt10s.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <ier1qich7ij.fsf@HIDDEN> (message from Spencer Baugh on Thu, 15 Jun 2023 15:04:20 -0400) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> <ier1qich7ij.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: 63896 <at> debbugs.gnu.org > Date: Thu, 15 Jun 2023 15:04:20 -0400 > > Eli Zaretskii <eliz@HIDDEN> writes: > > >> 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? > > Yes, but how does that get configured? > > >> 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? > > Yes, but I mean that *this function* doesn't know, given some opaque > value returned by a user-provided annotation function, how to sort. You'd need to include the comparison function in the annotation data, I guess. > >> 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. > > For sure, process-exit-status gives me that value. But how do I get the > process to call it on? The process is dead at this point, so > (get-buffer-process "*compilation*") returns nil. Is there a way to get > the process associated with the buffer even though it's killed? If project.el wants to access data from an exited compilation, it needs to record that when the compilation exits (via the compilation-finish-functions hook, for example). Calling format-mode-line will not help you, because if the process doesn't exist, its data cannot be accessed, and relying on what's displayed on the mode line is a bad idea: it could be outdated or even irrelevant. So please don't use such kludges, even though they might look convenient at first sight.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Spencer Baugh <sbaugh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 16 Jun 2023 14:27:01 +0000 Resent-Message-ID: <handler.63896.B63896.16869255739906 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.16869255739906 (code B ref 63896); Fri, 16 Jun 2023 14:27:01 +0000 Received: (at 63896) by debbugs.gnu.org; 16 Jun 2023 14:26:13 +0000 Received: from localhost ([127.0.0.1]:50125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qAAOz-0002Zi-4T for submit <at> debbugs.gnu.org; Fri, 16 Jun 2023 10:26:13 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:47311) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1qAAOx-0002ZR-BU for 63896 <at> debbugs.gnu.org; Fri, 16 Jun 2023 10:26:11 -0400 From: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <83bkhgt10s.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 16 Jun 2023 08:43:47 +0300") References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> <ier1qich7ij.fsf@HIDDEN> <83bkhgt10s.fsf@HIDDEN> Date: Fri, 16 Jun 2023 10:26:05 -0400 Message-ID: <ierr0qbfpqa.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Spencer Baugh <sbaugh@HIDDEN> >> Cc: 63896 <at> debbugs.gnu.org >> Date: Thu, 15 Jun 2023 15:04:20 -0400 >> >> Eli Zaretskii <eliz@HIDDEN> writes: >> >> >> 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? >> >> Yes, but how does that get configured? >> >> >> 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? >> >> Yes, but I mean that *this function* doesn't know, given some opaque >> value returned by a user-provided annotation function, how to sort. > > You'd need to include the comparison function in the annotation data, > I guess. Yes, I'm just not sure the right approach. It would be wasteful to return the comparison function from the annotation function every time it's called, since it's the same for every call. >> >> 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. >> >> For sure, process-exit-status gives me that value. But how do I get the >> process to call it on? The process is dead at this point, so >> (get-buffer-process "*compilation*") returns nil. Is there a way to get >> the process associated with the buffer even though it's killed? > > If project.el wants to access data from an exited compilation, it > needs to record that when the compilation exits (via the > compilation-finish-functions hook, for example). Calling > format-mode-line will not help you, because if the process doesn't > exist, its data cannot be accessed, and relying on what's displayed on > the mode line is a bad idea: it could be outdated or even irrelevant. > So please don't use such kludges, even though they might look > convenient at first sight. Would it be OK for compile.el to start storing this data in a variable? The number of errors/warnings/infos is already stored; also storing the exit status would probably be useful for all kinds of things.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 16 Jun 2023 15:24:02 +0000 Resent-Message-ID: <handler.63896.B63896.168692903316238 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168692903316238 (code B ref 63896); Fri, 16 Jun 2023 15:24:02 +0000 Received: (at 63896) by debbugs.gnu.org; 16 Jun 2023 15:23:53 +0000 Received: from localhost ([127.0.0.1]:50222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qABIn-0004Dp-GP for submit <at> debbugs.gnu.org; Fri, 16 Jun 2023 11:23:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qABIl-0004Dd-AI for 63896 <at> debbugs.gnu.org; Fri, 16 Jun 2023 11:23:52 -0400 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 <eliz@HIDDEN>) id 1qABIf-0007ki-Cc; Fri, 16 Jun 2023 11:23:45 -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=oFaJjj7qKY1rvMLNG0/mgWL7kudNR8RFSGwXZ6zVmCY=; b=LxXZtGQ6ndA9 VUNB5t08dgJNtLDfIkM9IT7PkYYUQvyUq5pei0kOUEPlePY0NKIHMEuHEyeyUKAkSjxCEkRKgNlSn ripCAQjs/RAZMhl+zVhnxPks2tSNqxNbV3Jx88v1kaQwnyh6XYoLE9q7X+90/fwBCfD6Ix+KxfonP NHoxzleNMXMk4DRDaRx25xoaTkCnbhLfyggJJ/qIuPTyfUO9o2QkxSJCTRqa0kwQzfMA0uJ3DRqhI 0QcdNtxH5uLTF4nlV1L6JIXC5+/wLYzfQhsAwOFT/Jzup/Qu+DJjuC18QifEKDATcfrVGPKE1GNDU VHmycOR7Q8uTIGDTUipbfQ==; 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 <eliz@HIDDEN>) id 1qABIe-0002Sx-ED; Fri, 16 Jun 2023 11:23:44 -0400 Date: Fri, 16 Jun 2023 18:23:41 +0300 Message-Id: <83o7lfsa6a.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <ierr0qbfpqa.fsf@HIDDEN> (message from Spencer Baugh on Fri, 16 Jun 2023 10:26:05 -0400) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> <ier1qich7ij.fsf@HIDDEN> <83bkhgt10s.fsf@HIDDEN> <ierr0qbfpqa.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: 63896 <at> debbugs.gnu.org > Date: Fri, 16 Jun 2023 10:26:05 -0400 > > Eli Zaretskii <eliz@HIDDEN> writes: > > > > If project.el wants to access data from an exited compilation, it > > needs to record that when the compilation exits (via the > > compilation-finish-functions hook, for example). Calling > > format-mode-line will not help you, because if the process doesn't > > exist, its data cannot be accessed, and relying on what's displayed on > > the mode line is a bad idea: it could be outdated or even irrelevant. > > So please don't use such kludges, even though they might look > > convenient at first sight. > > Would it be OK for compile.el to start storing this data in a variable? > The number of errors/warnings/infos is already stored; also storing the > exit status would probably be useful for all kinds of things. I think it would be okay to store data about the process in a buffer-local variable, but we need to make sure we store everything that might be useful.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Spencer Baugh <sbaugh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 27 Jun 2023 20:31:02 +0000 Resent-Message-ID: <handler.63896.B63896.168789785010768 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168789785010768 (code B ref 63896); Tue, 27 Jun 2023 20:31:02 +0000 Received: (at 63896) by debbugs.gnu.org; 27 Jun 2023 20:30:50 +0000 Received: from localhost ([127.0.0.1]:49600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qEFKq-0002na-J6 for submit <at> debbugs.gnu.org; Tue, 27 Jun 2023 16:30:50 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:32973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1qEFKl-0002nJ-I4 for 63896 <at> debbugs.gnu.org; Tue, 27 Jun 2023 16:30:47 -0400 From: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <83o7lfsa6a.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 16 Jun 2023 18:23:41 +0300") References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> <ier1qich7ij.fsf@HIDDEN> <83bkhgt10s.fsf@HIDDEN> <ierr0qbfpqa.fsf@HIDDEN> <83o7lfsa6a.fsf@HIDDEN> Date: Tue, 27 Jun 2023 16:30:38 -0400 Message-ID: <ierv8f8zlzl.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Spencer Baugh <sbaugh@HIDDEN> >> Cc: 63896 <at> debbugs.gnu.org >> Date: Fri, 16 Jun 2023 10:26:05 -0400 >> >> Eli Zaretskii <eliz@HIDDEN> writes: >> > >> > If project.el wants to access data from an exited compilation, it >> > needs to record that when the compilation exits (via the >> > compilation-finish-functions hook, for example). Calling >> > format-mode-line will not help you, because if the process doesn't >> > exist, its data cannot be accessed, and relying on what's displayed on >> > the mode line is a bad idea: it could be outdated or even irrelevant. >> > So please don't use such kludges, even though they might look >> > convenient at first sight. >> >> Would it be OK for compile.el to start storing this data in a variable? >> The number of errors/warnings/infos is already stored; also storing the >> exit status would probably be useful for all kinds of things. > > I think it would be okay to store data about the process in a > buffer-local variable, but we need to make sure we store everything > that might be useful. Sure, how about this? diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ccf64fb670b..b1f6d146d01 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -171,6 +171,10 @@ compilation-error (defvar compilation-arguments nil "Arguments that were given to `compilation-start'.") +(defvar compilation-exit-status nil + "The `process-exit-status' of the compilation process, or nil if not exited yet.") +(defvar compilation-process-status nil + "The latest `process-status' of the compilation process.") (defvar compilation-num-errors-found 0) (defvar compilation-num-warnings-found 0) (defvar compilation-num-infos-found 0) @@ -2457,6 +2461,7 @@ compilation-minor-mode (defun compilation-handle-exit (process-status exit-status msg) "Write MSG in the current buffer and hack its `mode-line-process'." + (setq-local compilation-exit-status exit-status) (let ((inhibit-read-only t) (status (if compilation-exit-message-function (funcall compilation-exit-message-function @@ -2500,6 +2505,7 @@ compilation-handle-exit ;; Called when compilation process changes state. (defun compilation-sentinel (proc msg) "Sentinel for compilation buffers." + (setq-local compilation-process-status (process-status proc)) (if (memq (process-status proc) '(exit signal)) (unwind-protect (let ((buffer (process-buffer proc)))
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 28 Jun 2023 11:45:02 +0000 Resent-Message-ID: <handler.63896.B63896.168795269916381 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.168795269916381 (code B ref 63896); Wed, 28 Jun 2023 11:45:02 +0000 Received: (at 63896) by debbugs.gnu.org; 28 Jun 2023 11:44:59 +0000 Received: from localhost ([127.0.0.1]:50144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qETbW-0004G9-NS for submit <at> debbugs.gnu.org; Wed, 28 Jun 2023 07:44:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qETbR-0004Fs-O3 for 63896 <at> debbugs.gnu.org; Wed, 28 Jun 2023 07:44:57 -0400 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 <eliz@HIDDEN>) id 1qETbM-0003wG-Ay; Wed, 28 Jun 2023 07:44:48 -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=O8CAfTkzhjs9pJr/e/LSgAJJOlx72A4wD3zlLWD/cWc=; b=FXMyuAuurrGY OoRzHHWnDdxF9ZGbvnCtd9efqIPcF30kB4kw0Ml+Syp5u9yrMr8ybs1ZDkOa/2RFwNOD7CkwbvZvP faUHPi/V2QH1r5XGYfrOC53gBtB4HAEPck5Ps3tD39JYAB5qIEm/jmdYExZYijL4blNOG1Tdveysd Vz9xDyyVXMR9o9ABxbtUZ0f0cE9mhnO/RmWTgNTiWBSyJ2CqMX8kVHjDqznTtwCwp2GQXcgfcfqMk aUhCBjip24bf4+1cIgSbpuITWS1kcL5vgyNNymouXk93H50DN5cTEFp9SETtsXCX8n5xuilx2aTbo pY7AeuBlEW+zveVAZDtlLw==; 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 <eliz@HIDDEN>) id 1qETbL-0004Zm-Qq; Wed, 28 Jun 2023 07:44:48 -0400 Date: Wed, 28 Jun 2023 14:45:12 +0300 Message-Id: <83o7kzvmif.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <ierv8f8zlzl.fsf@HIDDEN> (message from Spencer Baugh on Tue, 27 Jun 2023 16:30:38 -0400) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <ier5y7rgivb.fsf@HIDDEN> <83legmutrp.fsf@HIDDEN> <ier1qich7ij.fsf@HIDDEN> <83bkhgt10s.fsf@HIDDEN> <ierr0qbfpqa.fsf@HIDDEN> <83o7lfsa6a.fsf@HIDDEN> <ierv8f8zlzl.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: 63896 <at> debbugs.gnu.org > Date: Tue, 27 Jun 2023 16:30:38 -0400 > > Eli Zaretskii <eliz@HIDDEN> writes: > > +(defvar compilation-exit-status nil > + "The `process-exit-status' of the compilation process, or nil if not exited yet.") This should clarify that this is the exit status of the _last_ compilation in this buffer. It should also say that the variable is always buffer-local. I'd also add a reference to compilation-process-status, because the value of nil is not informative enough unless one looks at that other variable. > +(defvar compilation-process-status nil > + "The latest `process-status' of the compilation process.") Likewise here, about the buffer-local part. I think these variables warrant to be called out in NEWS.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Dmitry Gutov <dmitry@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Aug 2023 01:48:01 +0000 Resent-Message-ID: <handler.63896.B63896.16928416731772 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Spencer Baugh <sbaugh@HIDDEN>, 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.16928416731772 (code B ref 63896); Thu, 24 Aug 2023 01:48:01 +0000 Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 01:47:53 +0000 Received: from localhost ([127.0.0.1]:35700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qYzRx-0000SU-34 for submit <at> debbugs.gnu.org; Wed, 23 Aug 2023 21:47:53 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:35611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <dmitry@HIDDEN>) id 1qYzRu-0000Rd-7f for 63896 <at> debbugs.gnu.org; Wed, 23 Aug 2023 21:47:52 -0400 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) 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: <xms:u7bmZPptciEvIbTaoJgpkgyyY1rhizpYVHnUP1v3FrKl8DFBhrpr5Q> <xme:u7bmZJqL9YIzYiZNNVjUBx6qj9TplS47r-JkV3exQZZG3daXmuVGgHvKlE6nredNb n9pH6eSumT8mS-p3w0> X-ME-Received: <xmr:u7bmZMMkUZNC24tvJM_Fulq8ZBsZvYCE_ovdgXYE8-JQE0msOYzMGtJWVUs-cZs> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddvhedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeghedthedujeeiteeutddtjeekheejteeukeehffdutdejuedvfeevueeviedu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: <xmx:u7bmZC5FO-OztJkP3cgW9d1koQfH8Tmel7HFfXIR-AOQbkwAU9bBbw> <xmx:u7bmZO6MD-cufOe-LjfE4GVzTEZlkPebXGVqWYIk-3OLQU3mdf7J7w> <xmx:u7bmZKhxiyrmT5tjmWKkPI7vLDZb_63CgH8rrzK5TatO1dBfWmAMQw> <xmx:u7bmZDj3xvgKyLmUJzRHMr7jHIZ41DcEl2CmljTYq2DtP0b7kKxesQ> Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Aug 2023 21:47:38 -0400 (EDT) Message-ID: <6beaa4eb-bf50-2f1d-099e-cc5cdbb995e2@HIDDEN> Date: Thu, 24 Aug 2023 04:47:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <ierpm6audpo.fsf@HIDDEN> From: Dmitry Gutov <dmitry@HIDDEN> In-Reply-To: <ierpm6audpo.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.7 (--) 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').
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Dmitry Gutov <dmitry@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Aug 2023 01:55:01 +0000 Resent-Message-ID: <handler.63896.B63896.16928420992752 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN> Cc: 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.16928420992752 (code B ref 63896); Thu, 24 Aug 2023 01:55:01 +0000 Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 01:54:59 +0000 Received: from localhost ([127.0.0.1]:35705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qYzYp-0000iJ-7q for submit <at> debbugs.gnu.org; Wed, 23 Aug 2023 21:54:59 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:56237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <dmitry@HIDDEN>) id 1qYzYm-0000i6-W2 for 63896 <at> debbugs.gnu.org; Wed, 23 Aug 2023 21:54:58 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 75E5F320069B; Wed, 23 Aug 2023 21:54:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 23 Aug 2023 21:54:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :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= 1692842086; x=1692928486; bh=JC5VXVgqaQh1Pi8LGE4ojnFLHqn15yeA7um vffw2Hj8=; b=sLTsWINPSOCrhOOWwhR5kWhSNFUWyqeDSNX5+hjqW1Mq1cOuSJI q+WWxn6gpoPD+Pn7Au3Xy/Z2K3VltFgmRh6mOXuubx8Mi+Lv6p9Z3BBRgewLLMuT ZtIMbFvszddhvhm+pLObe9wy4NtjTxutzuAdP14Dmye+EogWcmdPY1VofUheshLk FDVr/wNTrGkmANPCRLdrROJcFXo0Y4xxJ6xkaoepWEVLe5nnf3K2YV3iCWFwW03g peBhaJ1A7syOLyu6qOwqGCPycU+sEXFfwpALI+70WpliO1oxe5PWO9Rtja7Ve6qk NCdCdtBjsDSogxuLNSGLHHLE/58tDnjLngw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1692842086; x=1692928486; bh=JC5VXVgqaQh1Pi8LGE4ojnFLHqn15yeA7um vffw2Hj8=; b=Qxk0h4L8vBMOE4V94l4VzGIDYuGvl+88ek43OPLOhe753JQW88y IZ5hYuqvwS4fuXEe9NBx8Ablck17Bg8gNh4mT66fMHjPww5aqKasLaF1WAG6sx0I HmFpxKofmgs1oVMlat50SMo/69Bg2GIFecAQz3oMH0zoqj1dGIqY9EO7aIUrGtL5 WYOEKgR6TQtGhizcmkACE3cL2ruYB2k/+x2Yazc0BSJH3LDfLGlTOBtAt79ygYdl scaqpEWMUYRoHatWSm20Fc8mNcvopEVqAeNjjU1o++bWqpkyG6kZqZCwWlFaFVMt w1ligPl5mSZkt+dQFU4mAd+UEbvvpQ7h6WQ== X-ME-Sender: <xms:ZrjmZGW-EV8crj9Kz1KtlyGp7e3yKUYPaN9st-bGzo1JoeZbEBlBsg> <xme:ZrjmZCnrrs4MVUVJy2c8B2kmBzlplMAYm9wfyqvbZ0mBbVw9q-PRHFIML9_TCHVK0 Pin1ag3tRe1pKNVolM> X-ME-Received: <xmr:ZrjmZKZO7XbbA3iCvks1puyJ7KZ85arOCc17j0AWkdy44AJ0ahauSFJohw3orGU> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddvhedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: <xmx:ZrjmZNUMn5GU4GP0uawlnNWQ4u0RdglTUg4XAc2VMcRwWc01mlU8Eg> <xmx:ZrjmZAmZ36ytYiNreS-2ZkmS_718VCm61wzXwRQMgVLoQ_vloWQPzw> <xmx:ZrjmZCfb5OE3SkbliUy1DKk5_370pqBnzG92om97kbXzpw7JF1HTng> <xmx:ZrjmZMv9mM-BXvV63AjRvLmFr3afO2-HuR0sAmJXuRejQvPKfxCxtQ> Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Aug 2023 21:54:45 -0400 (EDT) Message-ID: <2688fc0b-6afb-7f13-1805-bf79b0fcabd3@HIDDEN> Date: Thu, 24 Aug 2023 04:54:44 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> From: Dmitry Gutov <dmitry@HIDDEN> In-Reply-To: <83v8g240g6.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.7 (--) On 05/06/2023 14:23, Eli Zaretskii wrote: >> + (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. Does calling format-mode-line trigger extra redisplays or something? That sounds unexpected. OTOH, relying on the format of the value of mode-line-process is iffy (submodes could change it; though I haven't really seen it done so far).
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Aug 2023 05:29:01 +0000 Resent-Message-ID: <handler.63896.B63896.169285494025716 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov <dmitry@HIDDEN> Cc: sbaugh@HIDDEN, 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.169285494025716 (code B ref 63896); Thu, 24 Aug 2023 05:29:01 +0000 Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 05:29:00 +0000 Received: from localhost ([127.0.0.1]:35898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZ2tw-0006gi-0z for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 01:29:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qZ2tu-0006gV-Je for 63896 <at> debbugs.gnu.org; Thu, 24 Aug 2023 01:28:59 -0400 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 <eliz@HIDDEN>) id 1qZ2tl-0003aZ-0B; Thu, 24 Aug 2023 01:28:49 -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=SefDhveQbNjDfAfblKdSCddqlAzXnbSZtPOyYEDj/5U=; b=rQ9j29uy5v6K iWCzGh8tJ4TkdXS096ho+5KuTy7Z/Z4Nw6ewwKhrN34tZ873afyKjW7wXpm56Skzonir/xOuUNJIf CqkOKobzZqCg4H1e/ebNBx6vOGglPb58ipOJR+ZPyYNdYopyXYWBVjY4GfwGdiRRmjWBmwwkfYxEi rbPqlCqYMslG9n0oBbUODvYw7O+vjnmQFLkItyTfRCvr6pFmoG91m5/i0dqC9kmxbcmDzknkgF1He yJZDCgSulbpBFPIQjUYeQYdmx6yIM3R6saSLAOUX6G9go8YUi1FfHm4Eltu7YDG2CSXkB3PcO+m6V UI4xsdQ4FxMDyYXTEOUE+A==; Date: Thu, 24 Aug 2023 08:29:13 +0300 Message-Id: <83lee1qa8m.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <2688fc0b-6afb-7f13-1805-bf79b0fcabd3@HIDDEN> (message from Dmitry Gutov on Thu, 24 Aug 2023 04:54:44 +0300) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <2688fc0b-6afb-7f13-1805-bf79b0fcabd3@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Thu, 24 Aug 2023 04:54:44 +0300 > Cc: 63896 <at> debbugs.gnu.org > From: Dmitry Gutov <dmitry@HIDDEN> > > On 05/06/2023 14:23, Eli Zaretskii wrote: > >> + (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. > > Does calling format-mode-line trigger extra redisplays or something? > That sounds unexpected. It reuses parts of the redisplay's code, yes. Depending what's in the format variable passed to format-mode-line, that could cause a variety of surprises, especially if :eval forms are involved. It could also temporarily select another window and/or buffer, if the respective arguments are not omitted, which could also be unexpected. IMO, this function should be used sparing and with caution.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Dmitry Gutov <dmitry@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Aug 2023 13:09:02 +0000 Resent-Message-ID: <handler.63896.B63896.169288249820263 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: sbaugh@HIDDEN, 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.169288249820263 (code B ref 63896); Thu, 24 Aug 2023 13:09:02 +0000 Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 13:08:18 +0000 Received: from localhost ([127.0.0.1]:36350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZA4P-0005Gl-OP for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 09:08:18 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45193) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <dmitry@HIDDEN>) id 1qZA4N-0005GX-VE for 63896 <at> debbugs.gnu.org; Thu, 24 Aug 2023 09:08:16 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CCB795C0074; Thu, 24 Aug 2023 09:08:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 24 Aug 2023 09:08:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :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= 1692882486; x=1692968886; bh=Y6jmeqLsZlRaMBaytrmbi97CTQ4xe4f8Tfi yzFPvnrs=; b=naIzNMCpmHPDrbPwqkCj5KDZ8VTOr3jUr7lF7v8tLw6zf2epZZJ JUs9fr/PAv2UFL4kACKd8ZcshFtp+KaebEkULz5b4rI7uFbtMDwcszGq+5arQDsd /FxJOGkFnWJSR3mPKcZo449P22jMcVVYf65wlhAzOUSbsO6mRFYYiYTfZICpPF2a ARKgzMV8c8+beQhAgx+XrTRsw3oPR3OzouOgQalTKPRyAz0TnY+SE0a8RLFYLt6q uE0yfc7COdf+EGA3Lpra9SYuKGWvh1uegMV5O2J3cl9kFTmNp7Y5UsIN+HvwFGJu qKIWNZHP74s2zYvYG5UL2LBU1N+wGkmf1LQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1692882486; x=1692968886; bh=Y6jmeqLsZlRaMBaytrmbi97CTQ4xe4f8Tfi yzFPvnrs=; b=Gz+GK1vZVnhZ0BNYORF9aW9UJL4VdqndKJBqWY0kzHKZUpeSL+I ZIpxUBbTfzXa37hQbXDzm/DD3wpD1bZ02+AgkV7zgw4zyQizHkqCT58sWlNLG2Et TGr+5Ywv1frrAH4nkTR7ztNf4kUnQDyMqnmuzOGUeSpC/h8yeQc84uGT4dt9jZiS nRa6P+SCO2MctFbDHWfbbm2zf1pg9QSbNujPk61qcrYity1A1HrJgTrg72eQXohn 6tZnDiMx6/aMg0Dv4jsXYRYmNpY2g8k7i9fYisliHzpBJJb0QcuyucPCa0TR+OvL 9p9Goy3varGHRzYLRQM4Z2Mebo2J3ACQ+Dw== X-ME-Sender: <xms:NlbnZJQHXW3xWv9GEaKqFBqqQXg3Dvbg1dPrTuVA2uC--qmNZCUBAw> <xme:NlbnZCxO0cF3FAlIKGhiPBlxpgF7e8NvQFEQmsXd1MlbBUsMmKDOChpuRwfxK3P0l _GBLwclq8LCo3x9CJw> X-ME-Received: <xmr:NlbnZO0oSsL5b7CTouqRRRVMqoe5YD8PgLwXu3K7AIFzaGwwZDR-XmKmXV_R3dQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddviedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: <xmx:NlbnZBDHt98AVBcfETGTJlqEIYR_d4T9k4dwZZG9lJTvjCCcqDCYhg> <xmx:NlbnZCjmG_3q-64Oy-oR-n8xS-ZPhxtLkkJSR6yN2px61C7ah8BcWg> <xmx:NlbnZFqLbzN7HgY2B0WLz0EUwX1dBejGA46v-L5LJrNrh5ppfTtv1g> <xmx:NlbnZGak-ssOkd9TK8iaEl3j2eyO6-RW_MSfgz9q-7nKDsmiTXK0pg> Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Aug 2023 09:08:05 -0400 (EDT) Message-ID: <5cbcf6cb-5abf-d911-1778-8c74c8bc9368@HIDDEN> Date: Thu, 24 Aug 2023 16:08:04 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <2688fc0b-6afb-7f13-1805-bf79b0fcabd3@HIDDEN> <83lee1qa8m.fsf@HIDDEN> From: Dmitry Gutov <dmitry@HIDDEN> In-Reply-To: <83lee1qa8m.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.7 (--) On 24/08/2023 08:29, Eli Zaretskii wrote: >> Date: Thu, 24 Aug 2023 04:54:44 +0300 >> Cc:63896 <at> debbugs.gnu.org >> From: Dmitry Gutov<dmitry@HIDDEN> >> >> On 05/06/2023 14:23, Eli Zaretskii wrote: >>>> + (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. >> Does calling format-mode-line trigger extra redisplays or something? >> That sounds unexpected. > It reuses parts of the redisplay's code, yes. Depending what's in the > format variable passed to format-mode-line, that could cause a variety > of surprises, especially if :eval forms are involved. It could also > temporarily select another window and/or buffer, if the respective > arguments are not omitted, which could also be unexpected. > > IMO, this function should be used sparing and with caution. All right, so I guess it's the same concern: when mode-line-process contains something unusual, possibly assigned by a derived mode.
X-Loop: help-debbugs@HIDDEN Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Aug 2023 14:40:01 +0000 Resent-Message-ID: <handler.63896.B63896.169288796231240 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 63896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov <dmitry@HIDDEN> Cc: sbaugh@HIDDEN, 63896 <at> debbugs.gnu.org Received: via spool by 63896-submit <at> debbugs.gnu.org id=B63896.169288796231240 (code B ref 63896); Thu, 24 Aug 2023 14:40:01 +0000 Received: (at 63896) by debbugs.gnu.org; 24 Aug 2023 14:39:22 +0000 Received: from localhost ([127.0.0.1]:38363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZBUY-00087o-4G for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 10:39:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qZBUW-00087b-Hm for 63896 <at> debbugs.gnu.org; Thu, 24 Aug 2023 10:39:21 -0400 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 <eliz@HIDDEN>) id 1qZBUM-0001zy-LX; Thu, 24 Aug 2023 10:39:10 -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=MgyxfWPRsf4F/gyy0w0BcbLsRpWKcj69zYokIq4omCQ=; b=bvmUP+mtSwTs aONzAq0m0ksxtfGRM4ncHrl2NMJMVh8Vi7dXgCFC74qFuxtl874eBU7stAd24LFmegXkKTuQhS2h1 5tm8+uhYVFAw37t/tHj16f28Hl4Cwl/gZ2ho8uCYU52fjgiygTWioGZP/hsOw3zAVvuZiyg5s0TON /0/tFohvBG5omhs9tSUQmhsFOJxIadwIQP+IW3D39IqTbGQ8h40HYogQbgTDvHtxF2D7Ym3iUXItK 8XDUNHSqonQGLlLLcnreQzxuRdSfafpBaTKPw+hRNBccRKoADSjHa9VZ7HGcuyLiPfjrnk6hLjrM7 OoTDqEXp0/mpwf6Vy8SvJw==; Date: Thu, 24 Aug 2023 17:39:34 +0300 Message-Id: <83jztkpkrd.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <5cbcf6cb-5abf-d911-1778-8c74c8bc9368@HIDDEN> (message from Dmitry Gutov on Thu, 24 Aug 2023 16:08:04 +0300) References: <ierpm6audpo.fsf@HIDDEN> <83v8g240g6.fsf@HIDDEN> <2688fc0b-6afb-7f13-1805-bf79b0fcabd3@HIDDEN> <83lee1qa8m.fsf@HIDDEN> <5cbcf6cb-5abf-d911-1778-8c74c8bc9368@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Thu, 24 Aug 2023 16:08:04 +0300 > Cc: sbaugh@HIDDEN, 63896 <at> debbugs.gnu.org > From: Dmitry Gutov <dmitry@HIDDEN> > > On 24/08/2023 08:29, Eli Zaretskii wrote: > >> Date: Thu, 24 Aug 2023 04:54:44 +0300 > >> Cc:63896 <at> debbugs.gnu.org > >> From: Dmitry Gutov<dmitry@HIDDEN> > >> > >> On 05/06/2023 14:23, Eli Zaretskii wrote: > >>>> + (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. > >> Does calling format-mode-line trigger extra redisplays or something? > >> That sounds unexpected. > > It reuses parts of the redisplay's code, yes. Depending what's in the > > format variable passed to format-mode-line, that could cause a variety > > of surprises, especially if :eval forms are involved. It could also > > temporarily select another window and/or buffer, if the respective > > arguments are not omitted, which could also be unexpected. > > > > IMO, this function should be used sparing and with caution. > > All right, so I guess it's the same concern: when mode-line-process > contains something unusual, possibly assigned by a derived mode. Yes.
Received: (at control) by debbugs.gnu.org; 4 Sep 2023 08:24:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 04 04:24:51 2023 Received: from localhost ([127.0.0.1]:48304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qd4t8-0005AY-Pw for submit <at> debbugs.gnu.org; Mon, 04 Sep 2023 04:24:50 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:47148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1qd4t7-0005AL-GC for control <at> debbugs.gnu.org; Mon, 04 Sep 2023 04:24:49 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5007f3d3235so1789197e87.2 for <control <at> debbugs.gnu.org>; Mon, 04 Sep 2023 01:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693815884; x=1694420684; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=9sWWcgFGGnwaTTR6GU7qyqnscQJw5XUVMinddIbdKP4=; b=GwyjUlxdm0/4RsWSdbkDJM4pguiyts4M+Pfem3Guras6xaTwFrHgkOg45WzbKwbMRN v2F1i0xZhXzPLNIghf586kxEOmsDqp8AHxLMUQXMkHHhp93222GRQbNsnro6mkVcfxkw u4YP4IuVf9o8TKrppUMX+WWw6/jVYmg10fw+E3e1QHwGghPPkbCS/dspyPxiPYjcUdRq 6GPxLtW1ywz35oB6onwbPzXipEgMic/WeBs4wG5REtJ5PwAf7yRSY3wwG+Ale2og9M4Q NDnED0ttIknZf4PAEWEaGwDBGLqBp5Sv+L+MnXYfL6HnHhjdyYMqnQlLupDpZU6/J9jv 3pNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693815884; x=1694420684; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9sWWcgFGGnwaTTR6GU7qyqnscQJw5XUVMinddIbdKP4=; b=IOp2d6gCABkPuSDWHp4cxZ5mfTGwdodD++ZtEtBkUlgEjpRz9hguqXgrzjL8PjHjEI M2qptHqHdWTvTbiXJZQ/1otE14TDTmU8lMpCgUqMwsAI7E+V3FQlYSl77VXpwGkOr+7k Pbdi7DdR7PGhmMIFOvkqxuHaQGQiRy8EF0wkNmRtntqE1iOn0tmMz5qhDHiTlPBIetCR IbkDDlyC8mtUfhdI7EQKAtCm2bOldvkQKSDmX4iBYeEi3pIUM7ljEIwpOOsuUmoxCbHG iTUUnIFRAXk7Y/0/xyK+BfK9oaEj5j7n72OQF2Sj8twxSfsKS0nPDZn3p4T2GfUlA/y0 0GxA== X-Gm-Message-State: AOJu0YxFai1iguun0CdOQUlv/ComiVMbINZBFzCo6F6v4ZBsRlnBWXyD x7A4hXvcK9dtOed2Cf4/YRy6iBw0dv8g4mmKB7Lu5WIXIvE= X-Google-Smtp-Source: AGHT+IFC8qfPc2DHNMqqnzEbNhr8xiKDEE19ss3xdbw0MFTObExoHACPUOhh7weWWRB0TY/HbKx17zHJGOlipOvdfew= X-Received: by 2002:a19:6709:0:b0:500:8fb1:7a47 with SMTP id b9-20020a196709000000b005008fb17a47mr4994750lfc.30.1693815883577; Mon, 04 Sep 2023 01:24:43 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 4 Sep 2023 01:24:43 -0700 From: Stefan Kangas <stefankangas@HIDDEN> MIME-Version: 1.0 Date: Mon, 4 Sep 2023 01:24:43 -0700 Message-ID: <CADwFkmkLkmXCZB8EWdmOJkjTAKuGO0bRu4mBhr7f9engnL_aQg@HIDDEN> Subject: control message for bug #63896 To: control <at> debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) severity 63896 wishlist quit
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.