Subject: Re: bug#51132: Make sure user is doubly aware of finished complilations

From: Kévin Le Gouguec <[email-masked]>
Date: Wed, 20 Oct 2021 08:09:35 +0200

積丹尼 Dan Jacobson <[email-masked]> writes:

> Maybe (info "(emacs) Compilation") should mention:
> "Like KLG says, it is extremely easy to forget you had a lengthy compile
> job running, and ...
>
> KLG> 5. consider I have finished working on the unrelated matters, and close
> KLG>    Emacs,
>
> KLG> 6. bang my head on the desk out of frustration and self-loathing.
>
> ... therefore perhaps consider wrapping your compile jobs in a nohup(1)
> statement, perhaps with a tail -f nohup.out to simulate traditional
> compile-mode output. Example: ..."

That, or maybe advertise compilation-finish-functions more?  Promote it
to a defcustom, keep it nil by default, add some :options, such as:

- a function that calls notifications-notify,
- a function that saves the buffer; serving suggestion:

(defun compilation-save-buffer (buffer _results)
  ;; TODO:
  ;; - better path-separator escaping?
  ;; - give user more control over directory?
  ;; - give user more control over filename?
  ;; - use write-file and mark buffer as "unsaved"?
  (let* ((cmd (string-replace "/" "-"
                              (with-current-buffer buffer compile-command)))
         (time (format-time-string "%F-%T")))
    (with-current-buffer buffer
      (write-region (point-min) (point-max) (format "%s-%s.log" time cmd)))))

… and document it in (info "(emacs) Compilation").

I wouldn't mind working on a patch, if the above sounds appealing.  I'm
a bit swamped these days, but from our discussion I understand that this
wouldn't exactly be a high-priority feature anyway :)