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 22:14:52 -0700 Message-ID: <87my4bwv8z.fsf@hagelb.org> References: <87hbun9jbs.fsf@stupidchicken.com> <87ocov9bji.fsf@hagelb.org> <8763b2pvo0.fsf@stupidchicken.com> <8763b0z8uo.fsf@hagelb.org> <87vdj08hp0.fsf@stupidchicken.com> <87iqf0xg4q.fsf@hagelb.org> <87ab0bzzam.fsf@stupidchicken.com> <873a63yf44.fsf@hagelb.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1254374182 9085 80.91.229.12 (1 Oct 2009 05:16:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Oct 2009 05:16:22 +0000 (UTC) Cc: scymtym@gmx.net, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 01 07:16:15 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 1MtE1R-0006rl-TM for ged-emacs-devel@m.gmane.org; Thu, 01 Oct 2009 07:16:10 +0200 Original-Received: from localhost ([127.0.0.1]:56259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtE1R-0005or-6Z for ged-emacs-devel@m.gmane.org; Thu, 01 Oct 2009 01:16:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtE0M-0005aA-4d for emacs-devel@gnu.org; Thu, 01 Oct 2009 01:15:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtE0G-0005Z1-NU for emacs-devel@gnu.org; Thu, 01 Oct 2009 01:15:00 -0400 Original-Received: from [199.232.76.173] (port=51071 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtE0G-0005Yw-Bl for emacs-devel@gnu.org; Thu, 01 Oct 2009 01:14:56 -0400 Original-Received: from caiajhbdccac.dreamhost.com ([208.97.132.202]:37527 helo=homiemail-a25.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtE0F-0003xq-OY for emacs-devel@gnu.org; Thu, 01 Oct 2009 01:14:56 -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-a25.g.dreamhost.com (Postfix) with ESMTPSA id 9D5B0678063; Wed, 30 Sep 2009 22:14:53 -0700 (PDT) In-Reply-To: <873a63yf44.fsf@hagelb.org> (Phil Hagelberg's message of "Wed, 30 Sep 2009 20:20:27 -0700") 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:115819 Archived-At: --=-=-= Phil Hagelberg writes: > Chong Yidong writes: >> Phil Hagelberg writes: >> >>> (defun make-pulsing-progress-reporter (&optional message) >> >> I think `make-progress-reporter' should do "pulsing" automatically if >> min-value and max-value are null, instead of providing a new function. > > Good idea. I will implement that and send a patch. The attached patch implements this. So make-progress-reporter will make a pulsing reporter when min-value and max-value are not specified. I made it so that you must use progress-reporter-pulse to update a pulsing reporter, but I realized afterwards that it would be easy enough to have progress-reporter-update check to see if the reporter is a pulsing one or not and call the correct function underneath without the caller having to think about it. If you think this is a good idea I can make the change. -Phil --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-pulsing-progress-reporter-functionality.patch >From 91f10af059ab03d50da990a332995b93aa4fcfbc Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 30 Sep 2009 22:02:57 -0700 Subject: [PATCH] Add pulsing progress reporter functionality. --- lisp/subr.el | 41 ++++++++++++++++++++++++++++++----------- 1 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index a7d3fcd..e26783f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3415,9 +3415,8 @@ you call it." (when (>= value (car reporter)) (progress-reporter-do-update reporter value))) -(defun make-progress-reporter (message min-value max-value - &optional current-value - min-change min-time) +(defun make-progress-reporter (message &optional min-value max-value + current-value min-change min-time) "Return progress reporter object to be used with `progress-reporter-update'. MESSAGE is shown in the echo area. When at least 1% of operation @@ -3426,20 +3425,23 @@ MESSAGE. When you call `progress-reporter-done', word \"done\" is printed after the MESSAGE. You can change MESSAGE of an existing progress reporter with `progress-reporter-force-update'. -MIN-VALUE and MAX-VALUE designate starting (0% complete) and -final (100% complete) states of operation. The latter should be -larger; if this is not the case, then simply negate all values. -Optional CURRENT-VALUE specifies the progress by the moment you -call this function. You should omit it or set it to nil in most -cases since it defaults to MIN-VALUE. +If provided, MIN-VALUE and MAX-VALUE designate starting (0% +complete) and final (100% complete) states of operation. The +latter should be larger; if this is not the case, then simply +negate all values. Optional CURRENT-VALUE specifies the progress +by the moment you call this function. You should omit it or set +it to nil in most cases since it defaults to MIN-VALUE. Optional MIN-CHANGE determines the minimal change in percents to report (default is 1%.) Optional MIN-TIME specifies the minimal time before echo area updates (default is 0.2 seconds.) If `float-time' function is not present, then time is not tracked at all. If OS is not capable of measuring fractions of seconds, -then this parameter is effectively rounded up." +then this parameter is effectively rounded up. +If MIN-VALUE and MAX-VALUE are unknown, they may be omitted to +return a \"pulsing\" progress reporter. This should be updated +using the `progress-reporter-pulse' function instead." (unless min-time (setq min-time 0.2)) (let ((reporter @@ -3447,7 +3449,7 @@ then this parameter is effectively rounded up." (vector (if (and (fboundp 'float-time) (>= min-time 0.02)) (float-time) nil) - min-value + (or min-value 0) max-value message (if min-change (max (min min-change 50) 1) 1) @@ -3505,6 +3507,23 @@ change the displayed message." (message "%s%d%%" (aref parameters 3) percentage) (message "%s" (aref parameters 3)))))) +(defvar progress-pulse-values ["-" "\\" "|" "/"] + "Characters to use for pulsing progress reporters.") + +(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)))) + (defun progress-reporter-done (reporter) "Print reporter's message followed by word \"done\" in echo area." (message "%sdone" (aref (cdr reporter) 3))) -- 1.6.0.4 --=-=-=--