unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Amin Bandali <bandali@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Show *compilation* only if build did not succeed
Date: Sat, 22 Dec 2018 12:52:06 -0500	[thread overview]
Message-ID: <87ftupxxdl.fsf@aminb.org> (raw)
In-Reply-To: <jwv7eg1ik38.fsf-monnier+gmane.emacs.help@gnu.org> (Stefan Monnier's message of "Sat, 22 Dec 2018 11:49:01 -0500")


On 2018-12-22 11:49 AM, Stefan Monnier wrote:
>
> Yes: the two replacements suggested by the warning.
>

Thanks for the reply, Stefan.  I had already tried both, but for some
reason I could not get it to work.  I gave it another shot, and it seems
like I got it right this time around.

For future reference, here’s what I ended up with in my config:

#+begin_src emacs-lisp
(defun amin--compilation-finish-function (buffer outstr)
  (unless (string-match "finished" outstr)
    (switch-to-buffer-other-window buffer))
  t)

(setq compilation-finish-functions #'amin--compilation-finish-function)

(require 'cl-macs)

(defadvice compilation-start
    (around inhibit-display
            (command &optional mode name-function highlight-regexp))
  (if (not (string-match "^\\(find\\|grep\\)" command))
      (cl-letf (((symbol-function 'display-buffer)   #'ignore)
                ((symbol-function 'set-window-point) #'ignore)
                ((symbol-function 'goto-char)        #'ignore))
        (save-window-excursion ad-do-it))
    ad-do-it))

(ad-activate 'compilation-start)
#+end_src

Best,
amin



  reply	other threads:[~2018-12-22 17:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-22 15:12 Show *compilation* only if build did not succeed Amin Bandali
2018-12-22 16:49 ` Stefan Monnier
2018-12-22 17:52   ` Amin Bandali [this message]
2018-12-22 18:21     ` Stefan Monnier
2018-12-22 19:09       ` Amin Bandali
2018-12-23 14:29         ` Stefan Monnier
2018-12-23 14:59           ` Amin Bandali

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=87ftupxxdl.fsf@aminb.org \
    --to=bandali@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
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).