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

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

bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode


From: Hong Xu
Subject: bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode
Date: Wed, 02 Nov 2016 13:09:15 -0700
User-agent: mu4e 0.9.17; emacs 25.1.50.2

The attachment is an updated version of the patch.

diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 7d641ab47f09..75ed7827adf8 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -104,6 +104,13 @@ 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
+`most-positive-fixnum'."
+  :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 +285,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 +830,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))))
 

reply via email to

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