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 11:45:25 -0700 Message-ID: <87r36tn2ka.fsf@topbug.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1478112390 438 195.159.176.226 (2 Nov 2016 18:46:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Nov 2016 18:46:30 +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 19:46:26 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 1c20Y6-000646-6O for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 19:46:10 +0100 Original-Received: from localhost ([::1]:56976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c20Y8-0007ND-SS for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 14:46:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c20Y2-0007N7-2l for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:46:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c20Xx-0004gO-Vb for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:46:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53709) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c20Xx-0004gF-SU for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c20Xx-0005uV-Lt for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Nov 2016 18:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24861 X-GNU-PR-Package: emacs 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.147811234622696 (code B ref -1); Wed, 02 Nov 2016 18:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Nov 2016 18:45:46 +0000 Original-Received: from localhost ([127.0.0.1]:40875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c20Xi-0005u0-4x for submit@debbugs.gnu.org; Wed, 02 Nov 2016 14:45:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53943) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c20Xg-0005tj-EY for submit@debbugs.gnu.org; Wed, 02 Nov 2016 14:45:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c20Xa-00042E-E9 for submit@debbugs.gnu.org; Wed, 02 Nov 2016 14:45:39 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49556) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c20Xa-00041w-AQ for submit@debbugs.gnu.org; Wed, 02 Nov 2016 14:45:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c20XZ-0007Lz-7c for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:45:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c20XU-0003sf-Ig for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:45:37 -0400 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21382) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c20XU-0003qj-9s for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 14:45:32 -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 147811232675317.45572158415564; Wed, 2 Nov 2016 11:45:26 -0700 (PDT) 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:125278 Archived-At: --=-=-= Content-Type: text/plain This patch adds a customizable variable cpp-message-min-time-interval to avoid over messaging. --=-=-= 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..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)))) --=-=-=--