GNU bug report logs -
#52018
28.0.60; Improve documentation for compilation-finish-functions
Previous Next
Reported by: Thibault Polge <thibault <at> thb.lt>
Date: Sun, 21 Nov 2021 10:49:01 UTC
Severity: minor
Tags: wontfix
Found in version 28.0.60
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52018 in the body.
You can then email your comments to 52018 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 10:49:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Thibault Polge <thibault <at> thb.lt>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 21 Nov 2021 10:49:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The attached patch links the docstring of `compilation-finish-functions`
to the info manual page documenting the string argument those functions
receive.
[0001-Clarify-documentation-of-compilation-finish-function.patch (text/x-patch, inline)]
From ff48c17796acb3d6a77c893bd2b58bff62d43b03 Mon Sep 17 00:00:00 2001
From: Thibault Polge <thibault <at> thb.lt>
Date: Sun, 21 Nov 2021 11:41:51 +0100
Subject: [PATCH] Clarify documentation of `compilation-finish-functions`
Link to reference on the possible values of the string argument.
---
lisp/progmodes/compile.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index ac26f5e934..b71ee410bb 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -114,7 +114,10 @@ compilation-buffer-name-function
(defvar compilation-finish-functions nil
"Functions to call when a compilation process finishes.
Each function is called with two arguments: the compilation buffer,
-and a string describing how the process finished.")
+and a string describing how the process finished.
+
+That string is the sentinel's event type string, see info
+node `(elisp) Sentinels' for more details.")
(defvar compilation-in-progress nil
"List of compilation processes now running.")
--
2.33.1
[Message part 3 (text/plain, inline)]
Best regards,
Thibault
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 15:14:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Date: Sun, 21 Nov 2021 11:48:00 +0100
>
> (defvar compilation-finish-functions nil
> "Functions to call when a compilation process finishes.
> Each function is called with two arguments: the compilation buffer,
> -and a string describing how the process finished.")
> +and a string describing how the process finished.
> +
> +That string is the sentinel's event type string, see info
> +node `(elisp) Sentinels' for more details.")
But this is not entirely accurate, is it? The code actually does
(let ((out-string (format ":%s [%s]" process-status (cdr status)))
(msg (format "%s %s" mode-name
(replace-regexp-in-string "\n?$" ""
(car status)))))
[...]
(run-hook-with-args 'compilation-finish-functions cur-buffer msg)))
So 'msg' is not just the process status , AFAIU.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 19:10:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> But this is not entirely accurate, is it?
I've done a quick test, and this seems accurate. As I understand it,
the code you quoted:
> (let ((out-string (format ":%s [%s]" process-status (cdr status)))
> (msg (format "%s %s" mode-name
> (replace-regexp-in-string "\n?$" ""
> (car status)))))
comes from a let block that happens in the context of:
(setq mode-line-process [...]
That is used to, IIUC, decorate the mode line with info about the
compilation result. This setq, and the let it wraps, ends just
before:
(force-mode-line-update)
[...]
(run-hook-with-args 'compilation-finish-functions cur-buffer msg)))
So the msg that compilation-handle-exit receives is passed, unmodified,
to all 'compilation-finish-functions`.
Best regards,
Thibault
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 19:27:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Sun, 21 Nov 2021 20:08:56 +0100
>
> (force-mode-line-update)
> [...]
> (run-hook-with-args 'compilation-finish-functions cur-buffer msg)))
>
> So the msg that compilation-handle-exit receives is passed, unmodified,
> to all 'compilation-finish-functions`.
Maybe so, but I'm looking at the calls of compilation-handle-exit, and
the callers do all kinds of transformations with the original status,
so I think documenting what happens to be more-or-less correct now is
fragile.
Why do you think this addition is of such great importance to have it
spelled out in the doc string?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 19:45:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> Maybe so, but I'm looking at the calls of compilation-handle-exit, and
> the callers do all kinds of transformations with the original status,
> so I think documenting what happens to be more-or-less correct now is
> fragile.
I assumed this interface was reasonably stable, I may be wrong.
> Why do you think this addition is of such great importance to have it
> spelled out in the doc string?
All the docstring currently states about that argument is that it's “a
string describing how the process finished”, which requires users to
determine its possible values through trial and error, or by digging
into the code. I assumed it would be nicer (but not of “great
importance”) to just document it a bit further.
Best regards,
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 19:54:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Sun, 21 Nov 2021 20:44:46 +0100
>
> > Why do you think this addition is of such great importance to have it
> > spelled out in the doc string?
>
> All the docstring currently states about that argument is that it's “a
> string describing how the process finished”, which requires users to
> determine its possible values through trial and error, or by digging
> into the code.
I'm asking why do you think they should care. If they want the
process exit status, they can have it, can't they?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 20:01:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> I'm asking why do you think they should care. If they want the
> process exit status, they can have it, can't they?
I honestly don't know how to do that, but if they can, I guess all is well.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 20:12:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Sun, 21 Nov 2021 21:00:20 +0100
>
> > I'm asking why do you think they should care. If they want the
> > process exit status, they can have it, can't they?
>
> I honestly don't know how to do that, but if they can, I guess all is well.
The function is called with the compilation buffer, right? And the
compilation process runs in that buffer, right? So the function can
call get-buffer-process, and then access the exit status via
process-exit-status.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 20:21:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> The function is called with the compilation buffer, right? And the
> compilation process runs in that buffer, right? So the function can
> call get-buffer-process, and then access the exit status via
> process-exit-status.
I actually tried that, but the docstring for get-buffer-process says the
process must be live. The following attempt fails:
(add-hook 'compilation-finish-functions
(defun my-compilation-finish-function (buffer _)
(let ((process (get-buffer-process buffer)))
(message "Is there a buffer? %s" (bufferp buffer))
(message "Is there a process? %s" (not (null process)))
(message "Its status is: %s" (process-exit-status process)))))
Fails with:
Is there a buffer? t
Is there a process? nil
error in process sentinel: message: Wrong type argument: processp, nil
error in process sentinel: Wrong type argument: processp, nil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Sun, 21 Nov 2021 20:30:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Sun, 21 Nov 2021 21:20:28 +0100
>
> > The function is called with the compilation buffer, right? And the
> > compilation process runs in that buffer, right? So the function can
> > call get-buffer-process, and then access the exit status via
> > process-exit-status.
>
> I actually tried that, but the docstring for get-buffer-process says the
> process must be live. The following attempt fails:
OK, then the info is also on the mode line and can be taken from
there.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Mon, 22 Nov 2021 09:13:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> OK, then the info is also on the mode line and can be taken from
> there.
I'm not sure I follow you. Are you suggesting functions in
`compilation-finish-functions` should scrape the mode line to get the
compilation process' exit status, instead of just using the string
argument they receive?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Mon, 22 Nov 2021 16:57:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Mon, 22 Nov 2021 10:12:46 +0100
>
> > OK, then the info is also on the mode line and can be taken from
> > there.
>
> I'm not sure I follow you. Are you suggesting functions in
> `compilation-finish-functions` should scrape the mode line to get the
> compilation process' exit status, instead of just using the string
> argument they receive?
No need to scrape the mode line: the info is readily available in
mode-line-process.
If the purpose is to provide the exit status to the function, we need
to take care to pass it without any massaging. We don't make a point
of doing that now, so I'd prefer not to document this in such certain
terms, as people will then complain that it isn't 100% accurate.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Tue, 23 Nov 2021 09:28:24 GMT)
Full text and
rfc822 format available.
Message #41 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> If the purpose is to provide the exit status to the function, we need
> to take care to pass it without any massaging. We don't make a point
> of doing that now, so I'd prefer not to document this in such certain
> terms, as people will then complain that it isn't 100% accurate.
Thanks for the clarification. This makes sense, I'm just not sure how to
act on this. Would you rather drop this change or modify it to use more
cautious language?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Tue, 23 Nov 2021 12:47:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Thibault Polge <thibault <at> thb.lt>
> Cc: 52018 <at> debbugs.gnu.org
> Date: Tue, 23 Nov 2021 10:26:50 +0100
>
> > If the purpose is to provide the exit status to the function, we need
> > to take care to pass it without any massaging. We don't make a point
> > of doing that now, so I'd prefer not to document this in such certain
> > terms, as people will then complain that it isn't 100% accurate.
>
> Thanks for the clarification. This makes sense, I'm just not sure how to
> act on this. Would you rather drop this change or modify it to use more
> cautious language?
Not sure, actually. Lars, WDYT?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Wed, 24 Nov 2021 07:04:01 GMT)
Full text and
rfc822 format available.
Message #47 received at 52018 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> > If the purpose is to provide the exit status to the function, we need
>> > to take care to pass it without any massaging. We don't make a point
>> > of doing that now, so I'd prefer not to document this in such certain
>> > terms, as people will then complain that it isn't 100% accurate.
>>
>> Thanks for the clarification. This makes sense, I'm just not sure how to
>> act on this. Would you rather drop this change or modify it to use more
>> cautious language?
>
> Not sure, actually. Lars, WDYT?
The string that's passed in is a pretty free-form string, so I'm not
sure what we could say about it in the manual that'd be meaningful.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Wed, 24 Nov 2021 12:41:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 52018 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Thibault Polge <thibault <at> thb.lt>, 52018 <at> debbugs.gnu.org
> Date: Wed, 24 Nov 2021 08:02:52 +0100
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> Thanks for the clarification. This makes sense, I'm just not sure how to
> >> act on this. Would you rather drop this change or modify it to use more
> >> cautious language?
> >
> > Not sure, actually. Lars, WDYT?
>
> The string that's passed in is a pretty free-form string, so I'm not
> sure what we could say about it in the manual that'd be meaningful.
So I guess we want to drop this patch, since the existing doc string
already says vaguely enough that the string describes how the process
finished.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52018
; Package
emacs
.
(Wed, 24 Nov 2021 16:32:01 GMT)
Full text and
rfc822 format available.
Message #53 received at 52018 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> So I guess we want to drop this patch, since the existing doc string
> already says vaguely enough that the string describes how the process
> finished.
Yup. I'm closing this issue, then.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Nov 2021 16:33:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
52018 <at> debbugs.gnu.org and Thibault Polge <thibault <at> thb.lt>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Nov 2021 16:33:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 23 Dec 2021 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 123 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.