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)