From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phil Hagelberg Newsgroups: gmane.emacs.devel Subject: Re: CEDET merge Date: Wed, 30 Sep 2009 14:43:49 -0700 Message-ID: <87iqf0xg4q.fsf@hagelb.org> References: <87hbun9jbs.fsf@stupidchicken.com> <87ocov9bji.fsf@hagelb.org> <8763b2pvo0.fsf@stupidchicken.com> <8763b0z8uo.fsf@hagelb.org> <87vdj08hp0.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254349155 19163 80.91.229.12 (30 Sep 2009 22:19:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Sep 2009 22:19:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 01 00:19:07 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mt7Vr-0006Rm-Ll for ged-emacs-devel@m.gmane.org; Thu, 01 Oct 2009 00:19:07 +0200 Original-Received: from localhost ([127.0.0.1]:37952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt7Vq-0005oy-JA for ged-emacs-devel@m.gmane.org; Wed, 30 Sep 2009 18:19:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mt6xp-0007PQ-VD for emacs-devel@gnu.org; Wed, 30 Sep 2009 17:43:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mt6xl-0007It-CI for emacs-devel@gnu.org; Wed, 30 Sep 2009 17:43:57 -0400 Original-Received: from [199.232.76.173] (port=52931 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt6xl-0007If-7a for emacs-devel@gnu.org; Wed, 30 Sep 2009 17:43:53 -0400 Original-Received: from caiajhbdcbbj.dreamhost.com ([208.97.132.119]:50500 helo=homiemail-a20.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mt6xk-0007WP-Nr for emacs-devel@gnu.org; Wed, 30 Sep 2009 17:43:52 -0400 Original-Received: from enigma (96-26-232-193.sea.clearwire-dns.net [96.26.232.193]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPSA id 370AD7EC060; Wed, 30 Sep 2009 14:43:51 -0700 (PDT) In-Reply-To: <87vdj08hp0.fsf@stupidchicken.com> (Chong Yidong's message of "Wed, 30 Sep 2009 13:29:15 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115814 Archived-At: Chong Yidong writes: > Phil Hagelberg writes: >> The reason Rudel uses the CEDET one vs the built-in Emacs one is that it >> needs a way to indicate that something is happening without knowing the >> overall percentage of the task that is actually complete. I believe this >> is commonly known as "pulsing" or a "spinner". >> >> We could probably implement this as an addition to the built-in progress >> reporter in subr.el; would this be a welcome feature? > > Yes, and it should be easy to implement too. Here's what I've come up with: (defvar progress-pulse-values ["-" "\\" "|" "/"] "A vector of characters to use for pulsing progress reporters.") (defun make-pulsing-progress-reporter (&optional message) "Return a pulsing progress reporter that display MESSAGE. MESSAGE can contain all formatting characters accepted by `format'. If message is nil, the string \"Working ...\" is displayed. Example: (let ((rep (make-pulsing-progress-reporter \"Connecting\"))) (dotimes (n 3) (sleep-for 0.1) (progress-reporter-pulse rep \"Connecting [new]\")) (dotimes (n 3) (sleep-for 0.1) (progress-reporter-pulse rep \"Connecting [synching]\")) (dotimes (n 3) (sleep-for 0.1) (progress-reporter-pulse rep \"Connecting [idle]\")) (progress-reporter-pulse rep \"Connecting \") (progress-reporter-done rep))" (cons nil ; total value is not known (vector nil 0 'dummy (or message "Working ... ")))) (defun progress-reporter-pulse (reporter &optional new-message) "Advance pulsing indicator of REPORTER. Display NEW-MESSAGE if given." (let* ((parameters (cdr reporter)) (message (or new-message (aref parameters 3))) (index (aref parameters 1)) (new-index (mod (+ index 1) 4))) (aset parameters 1 new-index) (aset parameters 3 message) (let ((message-log-max nil)) ; No logging (message "%s %s" (aref progress-pulse-values new-index) message)))) The example in the docstring should make it clear how this works. It's fairly close to how the existing progress reporter works, but it's got nil in a couple places in the data structure due to not knowing the total progress. I have my paperwork in. I could submit this as a patch if that's more convenient, or you could find a place for it in subr.el. Thanks! -Phil