all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Annoying "Parsing...done" message when editing C++ files
Date: Wed, 02 Nov 2016 13:31:57 -0400	[thread overview]
Message-ID: <jwvins5bxpf.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAOj2CQSFby+3Uma8eW35DxPGxKHM5WNDhiAV6RoD5jHpDBBO9Q@mail.gmail.com

> (defun my-cpp-highlight-buffer-advice (orig &rest args)
>   (let ((inhibit-message t))
>     (apply orig args)))
>
> (with-eval-after-load 'cpp
>   (advice-add 'cpp-highlight-buffer :around
>               #'my-cpp-highlight-buffer-advice))

One more thing: just like with the docstring, it's often better to
name the function after what it *does* than after who uses it.

This applies less to hooks and such (which tend to be rather
specific/ad-hoc), but here it does because your piece of advice is
actually quite generic:

    (defun my-inhibit-messages (orig &rest args)
      (let ((inhibit-message t))
        (apply orig args)))
    (advice-add 'cpp-highlight-buffer :around #'my-inhibit-messages)

Oh, yet another thing: you can shorten the function slightly to

    (defun my-inhibit-messages (&rest args)
      (let ((inhibit-message t))
        (apply args)))


-- Stefan




  parent reply	other threads:[~2016-11-02 17:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  1:41 Annoying "Parsing...done" message when editing C++ files Hong Xu
2016-11-02  8:16 ` Alex Kost
2016-11-02 17:19 ` John Mastro
2016-11-02 17:25   ` Stefan Monnier
2016-11-02 17:31   ` Stefan Monnier [this message]
2016-11-02 23:36   ` Hong Xu
2016-11-03 17:48   ` Alex Kost

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=jwvins5bxpf.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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.