all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 63896@debbugs.gnu.org
Subject: bug#63896: [PATCH] Support annotating and sorting the project list during completion
Date: Thu, 15 Jun 2023 15:04:20 -0400	[thread overview]
Message-ID: <ier1qich7ij.fsf@janestreet.com> (raw)
In-Reply-To: <83legmutrp.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Jun 2023 15:12:58 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: 63896@debbugs.gnu.org
>> Date: Tue, 13 Jun 2023 17:19:52 -0400
>> 
>> >> +          (cons (+ (* 100 compilation-num-errors-found)
>> >> +                   (* 10 compilation-num-warnings-found)
>> >
>> > Why "encode" these numbers in a single value? why not use a cons or a
>> > vector?
>> 
>> I'd be happy to use a cons or a vector, or even a more complicated
>> structure, but I didn't see an easy way to do comparison of
>> complicated structures, for the sorting of projects based on their
>> annotation.  For example, if I have values of the form
>> (num . (num num num))
>
> You'd need to write a custom comparison function, but why is that a
> problem?

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?





  reply	other threads:[~2023-06-15 19:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-04 21:20 bug#63896: [PATCH] Support annotating and sorting the project list during completion Spencer Baugh
2023-06-05 11:23 ` Eli Zaretskii
2023-06-13 21:19   ` Spencer Baugh
2023-06-14 12:12     ` Eli Zaretskii
2023-06-15 19:04       ` Spencer Baugh [this message]
2023-06-16  5:43         ` Eli Zaretskii
2023-06-16 14:26           ` Spencer Baugh
2023-06-16 15:23             ` Eli Zaretskii
2023-06-27 20:30               ` Spencer Baugh
2023-06-28 11:45                 ` Eli Zaretskii
2023-08-24  1:54   ` Dmitry Gutov
2023-08-24  5:29     ` Eli Zaretskii
2023-08-24 13:08       ` Dmitry Gutov
2023-08-24 14:39         ` Eli Zaretskii
2023-08-24  1:47 ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ier1qich7ij.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=63896@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.