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: Sat, 19 Nov 2016 16:20:10 -0800 Message-ID: <87k2bz6lz9.fsf@topbug.net> References: <87r36tn2ka.fsf@topbug.net> <87oa1xmyok.fsf@topbug.net> <83d1idmy3c.fsf@gnu.org> <87pomdihhd.fsf@topbug.net> <831sysmnvc.fsf@gnu.org> <87a8dgo13q.fsf@topbug.net> <877f84mgu0.fsf@topbug.net> <83zikxcejl.fsf@gnu.org> <83mvgvc3hr.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1479601274 21517 195.159.176.226 (20 Nov 2016 00:21:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2016 00:21:14 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.12 Cc: 24861@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 20 01:21:10 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 1c8Fsb-0004Vz-F6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Nov 2016 01:21:09 +0100 Original-Received: from localhost ([::1]:43194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8Fse-0004W3-KN for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Nov 2016 19:21:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8FsY-0004Vw-2s for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2016 19:21:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8FsT-0008Cc-VF for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2016 19:21:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c8FsT-0008CY-Rw; Sat, 19 Nov 2016 19:21:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c8FsT-0002cw-Mf; Sat, 19 Nov 2016 19:21:01 -0500 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: Sun, 20 Nov 2016 00:21: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 Original-Received: via spool by 24861-submit@debbugs.gnu.org id=B24861.147960122410023 (code B ref 24861); Sun, 20 Nov 2016 00:21:01 +0000 Original-Received: (at 24861) by debbugs.gnu.org; 20 Nov 2016 00:20:24 +0000 Original-Received: from localhost ([127.0.0.1]:35418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8Frs-0002bb-GC for submit@debbugs.gnu.org; Sat, 19 Nov 2016 19:20:24 -0500 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8Frq-0002bR-P8 for 24861@debbugs.gnu.org; Sat, 19 Nov 2016 19:20:23 -0500 Original-Received: from localhost (cpe-104-32-170-214.socal.res.rr.com [104.32.170.214]) by mx.zohomail.com with SMTPS id 1479601214795498.6386964251244; Sat, 19 Nov 2016 16:20:14 -0800 (PST) In-reply-to: <83mvgvc3hr.fsf@gnu.org> X-Zoho-Virus-Status: 1 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:125888 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2016-11-18 Fri 23:50 GMT-0800, Eli Zaretskii wrote: >> Cc: 24861@debbugs.gnu.org >> From: Hong Xu >> Date: Fri, 18 Nov 2016 11:55:28 -0800 >>=20 >> Allow users to customize the maximum frequency that >> `cpp-progress-message' prints messages. >>=20 >> * progmodes/cpp.el (cpp-message-min-time-interval) >> (cpp-progress-message): Add variable >> `cpp-message-min-time-interval' to indicate the minimum time >> interval in seconds that `cpp-progress-message' prints messages. >>=20 >> * progmodes/cpp.el (cpp-progress-time): Initialize to '(0 0 0 0) instea= d of >> 0 and improve the documentation. >>=20 >> * progmodes/cpp.el (cpp-highlight-buffer): Use >> `cpp-progress-message' instead of `message'. > > Thanks, but there are still left-overs: > >> +(defcustom cpp-message-min-time-interval 1.0 >> + "Indicate the minimum time interval in seconds that >> +`cpp-progress-message' should print messages. > > This should be one line, so the sentence should be shorter to fit. If > you drop the redundant "Indicate the" part, it will come close. > >> -(defvar cpp-progress-time 0) >> -;; Last time we issued a progress message. >> +(defvar cpp-progress-time '(0 0 0 0) > > You could leave it at 0, no need to have a list here. > >> + "Indicate the last time `cpp-progress-message' issued a >> + progress message.") > > This should be a single line. Once again, please drop the uneeded > "Indicate" part. > >> (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 (=3D time cpp-progress-time) >> - () >> - (setq cpp-progress-time time) >> - (apply 'message args)))) >> + "Report progress by printing messages at most once every >> +`cpp-message-min-time-interval' seconds for functions whose names >> +start with \"cpp-\". If `cpp-message-min-time-interval' is nil, >> +it prints no message. The ARGS are the same as in `message'." > > The first sentence of the doc string should take only one line. Thanks, updated. Allow users to customize the maximum frequency that `cpp-progress-message' = prints messages. * progmodes/cpp.el (cpp-message-min-time-interval) (cpp-progress-message): Add variable `cpp-message-min-time-interval' to indicate the minimum time interval in seconds that `cpp-progress-message' prints messages. * progmodes/cpp.el (cpp-progress-time): Improve the documentation. * progmodes/cpp.el (cpp-highlight-buffer): Use `cpp-progress-message' instead of `message' to print messages. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=cpp-message.patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index 7d641ab47f09..fc8c271cc5ec 100644 =2D-- 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) =20 +(defcustom cpp-message-min-time-interval 1.0 + "The minimum time interval in seconds that `cpp-progress-message' prints= messages. +If it is set to nil, `cpp-progress-message' prints no message." + :type 'float + :group 'cpp + :version "26.1") + (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")))))))) =2D (message "Parsing...done")) + (cpp-progress-message "Parsing...done")) (if cpp-state-stack (save-excursion (goto-char (nth 3 (car cpp-state-stack))) @@ -819,16 +826,21 @@ cpp-face-name =20 ;;; Utilities: =20 =2D(defvar cpp-progress-time 0) =2D;; Last time we issued a progress message. +(defvar cpp-progress-time 0 + "The last time `cpp-progress-message' issued a progress message.") =20 (defun cpp-progress-message (&rest args) =2D ;; Report progress at most once a second. Take same ARGS as `message'. =2D (let ((time (nth 1 (current-time)))) =2D (if (=3D time cpp-progress-time) =2D () =2D (setq cpp-progress-time time) =2D (apply 'message args)))) + "Report progress by printing messages used by \"cpp-\" functions. +It prints messages at most once every +`cpp-message-min-time-interval' seconds. If +`cpp-message-min-time-interval' is nil, it prints no message. +The ARGS are the same as in `message'." + (when cpp-message-min-time-interval + (let ((time (current-time))) + (when (>=3D (float-time (time-subtract time cpp-progress-time)) + cpp-message-min-time-interval) + (setq cpp-progress-time time) + (apply 'message args))))) =20 (provide 'cpp) =20 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJYMOw6AAoJECZsfTOCL4R4HRwP/20qYlbL6ROQXXIRd/HRN91N kVqLI/ljT6iZzR/qzBTiBQoq9G/ieXcfgGZA4V41vxXsqchg+vac6e9diL5tSpzJ 8SIwEtMbRyBKRdml5z8RCb2+9UATB43gWPxP+P1TNHt9jLkK5b96yrK9SCBkPiDv 1XiP4dm57ZAE0ORxMw9T6xGR8vVUbLTwD3Bu8at1v+QUllCElFUwVcE9MEvSXBzL rLfv0RKuGtQXcpz4SF1dQY4bOUKeErh9OfaXLvCAqH1MEhQQG57BaT4ydeEHugoh w2ad1H2kzLjXGNV4W8G+kc27PGv0GwTHtUt/U5beuFINBtC3Ad5JqRNFpyHbgjpR J+3yF8P8aQf+g/MShzpRVQeGqlopOQnwvv9gRcU4fK8c4UV1iakkJIOzBTqN9DeP WCSXvv2x9BqObfLQZZW6kkx/iLuCpu0/gPpmMfGSOyBHOwdFCLNwEtFiGLRpsCQ9 nqWh+cXi7RI/6fbIRR7kypJg2ADWCGkMR4vTRCFK9cTven5JU0rlBZupt+Qt2Vrw BoBhyHJ8VTPnx2OXMuCx6x4apv4wWwHLewUg6aetY6zm1Q+L8riIiO9Io/tP3Mq3 V0GtBKPZ+8NbF6S8NT7s64POOj5xR02vTwTcrzX4xlVrvR0JcpDb7/GN9K26iZve bEaOTrFJ90Sp3GKqShbG =Vlr4 -----END PGP SIGNATURE----- --==-=-=--