From: Hong Xu <hong@topbug.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24861@debbugs.gnu.org, Andreas Schwab <schwab@linux-m68k.org>
Subject: bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode
Date: Wed, 02 Nov 2016 16:34:22 -0700 [thread overview]
Message-ID: <87pomdihhd.fsf@topbug.net> (raw)
In-Reply-To: <83d1idmy3c.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 337 bytes --]
On 2016-11-02 Wed 13:21 GMT-0700, Eli Zaretskii <eliz@gnu.org> wrote:
> (Not that I understand why this particular message needs to be
> customizable.)
Because the messages by cpp.el is so frequent that it often competes
with other useful information. I've added some explanation in the
docstring.
The attachment is a new version.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: cpp-message.patch --]
[-- Type: text/x-diff, Size: 1803 bytes --]
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 7d641ab47f09..a0705023b448 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -104,6 +104,15 @@ cpp-edit-list
(const :tag "Both branches writable" both))))
:group 'cpp)
+(defcustom cpp-message-min-time-interval 1
+ "Indicate the minimum time interval in seconds that `cc-mode'
+should print messages. If set to nil, `cc-mode' will print no
+message. This may be useful to set when the message `cc-mode'
+prints too many messages that competes with other information in
+the echo area."
+ :type 'integer
+ :group 'cpp)
+
(defvar cpp-overlay-list nil)
;; List of cpp overlays active in the current buffer.
(make-variable-buffer-local 'cpp-overlay-list)
@@ -278,7 +287,7 @@ cpp-highlight-buffer
(cpp-parse-close from to))
(t
(cpp-parse-error "Parser error"))))))))
- (message "Parsing...done"))
+ (cpp-progress-message "Parsing...done"))
(if cpp-state-stack
(save-excursion
(goto-char (nth 3 (car cpp-state-stack)))
@@ -823,12 +832,14 @@ cpp-progress-time
;; Last time we issued a progress message.
(defun cpp-progress-message (&rest args)
- ;; Report progress at most once a second. Take same ARGS as `message'.
- (let ((time (nth 1 (current-time))))
- (if (= time cpp-progress-time)
- ()
- (setq cpp-progress-time time)
- (apply 'message args))))
+ "Report progress at most once a second. Take same ARGS as
+`message'."
+ (when cpp-message-min-time-interval
+ (let ((time (nth 1 (current-time))))
+ (when (>= (- time cpp-progress-time)
+ cpp-message-min-time-interval)
+ (setq cpp-progress-time time)
+ (apply 'message args)))))
(provide 'cpp)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2016-11-02 23:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 18:45 bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode Hong Xu
2016-11-02 20:09 ` Hong Xu
2016-11-02 20:21 ` Eli Zaretskii
2016-11-02 23:34 ` Hong Xu [this message]
2016-11-03 18:15 ` Eli Zaretskii
2016-11-03 18:43 ` Hong Xu
2016-11-16 0:03 ` Hong Xu
2016-11-18 9:39 ` Eli Zaretskii
2016-11-18 19:55 ` Hong Xu
2016-11-19 7:50 ` Eli Zaretskii
2016-11-20 0:20 ` Hong Xu
2016-11-25 10:53 ` Eli Zaretskii
2016-11-02 23:39 ` Hong Xu
2016-11-03 16:39 ` Richard Stallman
2016-11-02 22:05 ` Andreas Schwab
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=87pomdihhd.fsf@topbug.net \
--to=hong@topbug.net \
--cc=24861@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=schwab@linux-m68k.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.