unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode
@ 2016-11-02 18:45 Hong Xu
  2016-11-02 20:09 ` Hong Xu
  0 siblings, 1 reply; 15+ messages in thread
From: Hong Xu @ 2016-11-02 18:45 UTC (permalink / raw)
  To: 24861

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


This patch adds a customizable variable cpp-message-min-time-interval to
avoid over messaging.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cpp-message.patch --]
[-- Type: text/x-diff, Size: 1420 bytes --]

diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 7d641ab47f09..1dd179d9103f 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -104,6 +104,12 @@ cpp-edit-list
 			       (const :tag "Both branches writable" both))))
   :group 'cpp)
 
+(defcustom cpp-message-min-time-interval 1
+  "The minimum time interval in seconds that cpp-mode should
+print messages.  No message will be printed if set to 0."
+  :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 +284,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,10 +829,10 @@ 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'.
+  "Report progress at most once a second.  Take same ARGS as `message'."
   (let ((time (nth 1 (current-time))))
-    (if (= time cpp-progress-time)
-	()
+    (when (>= (- time cpp-progress-time)
+              cpp-message-min-time-interval)
       (setq cpp-progress-time time)
       (apply 'message args))))
 

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

end of thread, other threads:[~2016-11-25 10:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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