From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#24861: [PATCH] Fix annoying "Parsing...done" message in c++-mode Date: Wed, 02 Nov 2016 13:09:15 -0700 Message-ID: <87oa1xmyok.fsf@topbug.net> References: <87r36tn2ka.fsf@topbug.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1478117427 7908 195.159.176.226 (2 Nov 2016 20:10:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Nov 2016 20:10:27 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.2 To: 24861@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 02 21:10:24 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c21rO-0008UX-9l for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 21:10:10 +0100 Original-Received: from localhost ([::1]:57480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c21rR-0007a5-3o for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 16:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c21rL-0007Ye-8x for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 16:10:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c21rK-0004uA-ER for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 16:10:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c21rG-0004sM-2G; Wed, 02 Nov 2016 16:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c21rF-0007qY-PJ; Wed, 02 Nov 2016 16:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 02 Nov 2016 20:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24861 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147811737330124 (code B ref -1); Wed, 02 Nov 2016 20:10:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Nov 2016 20:09:33 +0000 Original-Received: from localhost ([127.0.0.1]:40894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c21qm-0007pn-Qq for submit@debbugs.gnu.org; Wed, 02 Nov 2016 16:09:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c21ql-0007pc-S1 for submit@debbugs.gnu.org; Wed, 02 Nov 2016 16:09:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c21qf-0004i6-NR for submit@debbugs.gnu.org; Wed, 02 Nov 2016 16:09:26 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56808) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c21qf-0004i2-Kj for submit@debbugs.gnu.org; Wed, 02 Nov 2016 16:09:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c21qe-0007W6-OI for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 16:09:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c21qb-0004gS-JZ for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 16:09:24 -0400 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c21qb-0004fv-Ai for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 16:09:21 -0400 Original-Received: from localhost (cpe-104-32-170-214.socal.res.rr.com [104.32.170.214]) by mx.zohomail.com with SMTPS id 1478117356206870.7690829191052; Wed, 2 Nov 2016 13:09:16 -0700 (PDT) In-reply-to: <87r36tn2ka.fsf@topbug.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125280 Archived-At: --=-=-= Content-Type: text/plain The attachment is an updated version of the patch. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=cpp-message.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)))) --=-=-=--