help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Annoying "Parsing...done" message when editing C++ files


From: Stefan Monnier
Subject: Re: Annoying "Parsing...done" message when editing C++ files
Date: Wed, 02 Nov 2016 13:31:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> (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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]