unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Annoying "Parsing...done" message when editing C++ files
@ 2016-11-02  1:41 Hong Xu
  2016-11-02  8:16 ` Alex Kost
  2016-11-02 17:19 ` John Mastro
  0 siblings, 2 replies; 7+ messages in thread
From: Hong Xu @ 2016-11-02  1:41 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]


Is it possible to remove the annoying "Parsing...done" message in C++
mode? It often competes with other useful information I've set up.

I saw this line in progmodes/cpp.el, but don't know how to diminish it:

     (message "Parsing...done"))


Hong

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Kost @ 2016-11-02  8:16 UTC (permalink / raw)
  To: Hong Xu; +Cc: help-gnu-emacs

Hong Xu (2016-11-01 18:41 -0700) wrote:

> Is it possible to remove the annoying "Parsing...done" message in C++
> mode? It often competes with other useful information I've set up.
>
> I saw this line in progmodes/cpp.el, but don't know how to diminish it:
>
>      (message "Parsing...done"))

Since this message is just a line of code in 'cpp-highlight-buffer'
command, I think the only way to get rid of it is to write your own
function that will override 'cpp-highlight-buffer', but I wouldn't
recommend doing it as you'll have to maintain your version of this
command (which is pretty big).  It's probably better to make a bug
report that you'd like to have an option to avoid these "Parsing..."
messages.

-- 
Alex



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  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
                     ` (3 more replies)
  1 sibling, 4 replies; 7+ messages in thread
From: John Mastro @ 2016-11-02 17:19 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Hong Xu

Hong Xu <hong@topbug.net> wrote:
>
> Is it possible to remove the annoying "Parsing...done" message in C++
> mode? It often competes with other useful information I've set up.
>
> I saw this line in progmodes/cpp.el, but don't know how to diminish it:
>
>      (message "Parsing...done"))

Something like this should do the trick:

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

Hope that helps

        John



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  2016-11-02 17:19 ` John Mastro
@ 2016-11-02 17:25   ` Stefan Monnier
  2016-11-02 17:31   ` Stefan Monnier
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-11-02 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

> (with-eval-after-load 'cpp
>   (advice-add 'cpp-highlight-buffer :around
>               #'my-cpp-highlight-buffer-advice))

You shouldn't need to wrap this in `with-eval-after-load`:
`advice-add` is careful to preserve the advice across (re)definition of
the function.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  2016-11-02 17:19 ` John Mastro
  2016-11-02 17:25   ` Stefan Monnier
@ 2016-11-02 17:31   ` Stefan Monnier
  2016-11-02 23:36   ` Hong Xu
  2016-11-03 17:48   ` Alex Kost
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-11-02 17:31 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  2016-11-02 17:19 ` John Mastro
  2016-11-02 17:25   ` Stefan Monnier
  2016-11-02 17:31   ` Stefan Monnier
@ 2016-11-02 23:36   ` Hong Xu
  2016-11-03 17:48   ` Alex Kost
  3 siblings, 0 replies; 7+ messages in thread
From: Hong Xu @ 2016-11-02 23:36 UTC (permalink / raw)
  To: John Mastro; +Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]


On 2016-11-02 Wed 10:19 GMT-0700, John Mastro <john.b.mastro@gmail.com> wrote:
> Something like this should do the trick:
>
> (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))
>
> Hope that helps
>

Thanks. FYI, I've submitted a patch to resolve this issue, which is
probably more elegant:

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24861#17

Hong

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Annoying "Parsing...done" message when editing C++ files
  2016-11-02 17:19 ` John Mastro
                     ` (2 preceding siblings ...)
  2016-11-02 23:36   ` Hong Xu
@ 2016-11-03 17:48   ` Alex Kost
  3 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2016-11-03 17:48 UTC (permalink / raw)
  To: John Mastro; +Cc: help-gnu-emacs@gnu.org, Hong Xu

John Mastro (2016-11-02 10:19 -0700) wrote:

> Hong Xu <hong@topbug.net> wrote:
>>
>> Is it possible to remove the annoying "Parsing...done" message in C++
>> mode? It often competes with other useful information I've set up.
>>
>> I saw this line in progmodes/cpp.el, but don't know how to diminish it:
>>
>>      (message "Parsing...done"))
>
> Something like this should do the trick:
>
> (defun my-cpp-highlight-buffer-advice (orig &rest args)
>   (let ((inhibit-message t))
>     (apply orig args)))

Wow, this is great, I didn't know about 'inhibit-message', thanks!

> (with-eval-after-load 'cpp
>   (advice-add 'cpp-highlight-buffer :around
>               #'my-cpp-highlight-buffer-advice))
>
> Hope that helps
>
>         John
>
>

-- 
Alex



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-03 17:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-11-02 23:36   ` Hong Xu
2016-11-03 17:48   ` Alex Kost

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).