unofficial mirror of bug-gnu-emacs@gnu.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: Tue, 27 Jun 2023 16:30:38 -0400	[thread overview]
Message-ID: <ierv8f8zlzl.fsf@janestreet.com> (raw)
In-Reply-To: <83o7lfsa6a.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 16 Jun 2023 18:23:41 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: 63896@debbugs.gnu.org
>> Date: Fri, 16 Jun 2023 10:26:05 -0400
>> 
>> Eli Zaretskii <eliz@gnu.org> 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)))





  reply	other threads:[~2023-06-27 20:30 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=ierv8f8zlzl.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).