unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Hagelberg <phil@hagelb.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: scymtym@gmx.net, emacs-devel@gnu.org
Subject: Re: CEDET merge
Date: Wed, 30 Sep 2009 22:14:52 -0700	[thread overview]
Message-ID: <87my4bwv8z.fsf@hagelb.org> (raw)
In-Reply-To: <873a63yf44.fsf@hagelb.org> (Phil Hagelberg's message of "Wed, 30 Sep 2009 20:20:27 -0700")

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

Phil Hagelberg <phil@hagelb.org> writes:

> Chong Yidong <cyd@stupidchicken.com> writes:
>> Phil Hagelberg <phil@hagelb.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-pulsing-progress-reporter-functionality.patch --]
[-- Type: text/x-diff, Size: 3855 bytes --]

From 91f10af059ab03d50da990a332995b93aa4fcfbc Mon Sep 17 00:00:00 2001
From: Phil Hagelberg <technomancy@gmail.com>
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


  reply	other threads:[~2009-10-01  5:14 UTC|newest]

Thread overview: 194+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-28 15:31 CEDET merge Chong Yidong
2009-09-28 17:31 ` Ulrich Mueller
2009-09-28 17:55   ` Chong Yidong
2009-09-28 18:42     ` Ulrich Mueller
2009-09-28 19:30       ` Chong Yidong
2009-09-28 20:03         ` Ulrich Mueller
2009-09-28 20:20           ` Rupert Swarbrick
2009-09-28 22:16             ` Ulrich Mueller
2009-09-28 17:47 ` Eli Zaretskii
2009-09-28 18:00 ` Eli Zaretskii
2009-09-28 18:25   ` Chong Yidong
2009-09-28 19:23     ` Eli Zaretskii
2009-09-28 19:27       ` Andreas Schwab
2009-09-28 18:20 ` Phil Hagelberg
2009-09-28 22:10   ` Chong Yidong
2009-09-28 22:25     ` Phil Hagelberg
2009-09-30 16:38     ` Phil Hagelberg
2009-09-30 17:29       ` Chong Yidong
2009-09-30 21:43         ` Phil Hagelberg
2009-10-01  1:19           ` Chong Yidong
2009-10-01  3:20             ` Phil Hagelberg
2009-10-01  5:14               ` Phil Hagelberg [this message]
2009-10-01  7:07                 ` Stefan Monnier
2009-10-02 17:46                   ` Phil Hagelberg
2010-03-17 18:24                     ` progress-reporter (was: CEDET merge) Michael Albinus
2009-09-28 19:34 ` CEDET merge Andreas Schwab
2009-09-28 20:20   ` Andreas Schwab
2009-09-28 20:20 ` Alan Mackenzie
2009-09-28 21:57   ` Chong Yidong
2009-09-29  4:28 ` Glenn Morris
2009-09-29 11:28   ` Eric M. Ludlam
2009-09-30  9:32 ` Juanma Barranquero
2009-09-30 18:38   ` Eli Zaretskii
2009-09-30 19:32     ` Juanma Barranquero
2009-09-30 10:29 ` Sascha Wilde
2009-10-01 10:58   ` Sascha Wilde
2009-10-01 11:38     ` Eric M. Ludlam
2009-10-01 12:51       ` Sascha Wilde
2009-10-01 16:28         ` Sascha Wilde
2009-10-03 13:07           ` Eric M. Ludlam
2009-10-03 21:01             ` Sascha Wilde
2009-10-06 16:15               ` Sascha Wilde
2009-10-06 17:51                 ` Chong Yidong
2009-10-07  9:34                   ` Problems with EDE (was: CEDET merge) Sascha Wilde
2009-10-07  9:49                     ` Problems with EDE Sascha Wilde
2009-10-07 16:32                       ` Eric M. Ludlam
2009-10-08  1:51                         ` Chong Yidong
2009-10-08  2:17                           ` Chong Yidong
2009-10-08  9:53                             ` Sascha Wilde
2009-10-08 20:51                               ` Sascha Wilde
2009-10-08 12:04                             ` Eric M. Ludlam
2009-10-08 13:38                               ` Miles Bader
2009-10-08 13:46                               ` Sascha Wilde
2009-10-08 14:16                                 ` Chong Yidong
2009-10-08 19:46                                   ` Sascha Wilde
2009-10-08 14:11                               ` Chong Yidong
2009-10-08 14:16                                 ` David Kastrup
2009-10-14  1:56                                 ` Eric M. Ludlam
2009-10-08 18:32                               ` defalias customize-* in ede.el (was: Problems with EDE) Reiner Steib
2009-10-08 20:58                       ` Problems with EDE Sascha Wilde
2009-10-08 22:15                         ` Chong Yidong
2009-10-09  8:03                           ` Eli Zaretskii
2009-10-09 12:15                           ` Sascha Wilde
2009-10-15  3:45                             ` Eric M. Ludlam
2009-10-15  8:58                               ` Sascha Wilde
2009-10-15 14:38                                 ` Chong Yidong
2009-10-17 14:27                                   ` Chong Yidong
2009-10-20 13:22                                     ` Sascha Wilde
2009-10-14  2:34                           ` Eric M. Ludlam
2009-10-09 12:34                         ` Sascha Wilde
2009-10-09 12:42                           ` Sascha Wilde
2009-10-10  0:24                             ` Eric M. Ludlam
2009-10-10  7:34                               ` Sascha Wilde
2009-10-15  3:05                             ` Eric M. Ludlam
2009-10-09 17:10                           ` Andreas Schwab
2009-10-09 18:08                             ` Chong Yidong
2009-10-09 18:54                               ` Sascha Wilde
2009-10-09 19:14                                 ` Sascha Wilde
2009-10-09 20:33                                   ` Chong Yidong
2009-10-09 21:19                                     ` Sascha Wilde
2009-10-14  2:43                                       ` Eric M. Ludlam
2009-10-09 19:46                               ` Eric M. Ludlam
2009-10-08 22:21                     ` Chong Yidong
2009-10-03 20:10       ` CEDET merge Chong Yidong
2009-10-03 20:31         ` Eric M. Ludlam
2009-10-04  1:44           ` Chong Yidong
2009-10-04  2:30             ` Eric M. Ludlam
2009-10-04  5:52               ` Chong Yidong
2009-10-01  3:58 ` Miles Bader
2009-10-01 11:31   ` Eric M. Ludlam
2009-10-01 14:48     ` Chong Yidong
2009-10-07  3:43 ` Phil Hagelberg
2009-10-07  5:37   ` Chong Yidong
2009-10-07 16:20     ` Eric M. Ludlam
  -- strict thread matches above, loose matches on Subject: below --
2012-09-16  1:55 Feature freeze on October 1 Chong Yidong
2012-09-16 15:30 ` David Engster
2012-09-16 19:04   ` Stefan Monnier
2012-09-26 20:24     ` CEDET merge (was: Feature freeze on October 1) David Engster
2012-09-30 13:55       ` CEDET merge David Engster
2012-09-30 14:10         ` David Engster
2012-09-30 18:58         ` Glenn Morris
2012-09-30 19:17           ` Paul Eggert
2012-10-01  0:16             ` Glenn Morris
2012-10-01  3:44         ` Chong Yidong
2012-10-01 11:44           ` Eric M. Ludlam
2012-10-01 15:17           ` David Engster
2012-10-01 17:48             ` Chong Yidong
2012-10-01 17:56               ` Chong Yidong
2012-10-02 15:24               ` Chong Yidong
2012-10-04 19:32         ` David Engster
2012-10-06 11:19           ` Chong Yidong
2012-10-06 11:30             ` David Engster
2012-10-06 14:24               ` Chong Yidong
2012-10-06 14:54                 ` Stefan Monnier
2012-10-06 17:29                   ` David Engster
2012-10-06 18:10                     ` Stefan Monnier
2012-10-07 11:19                       ` David Engster
2012-10-06 23:31                     ` Glenn Morris
2012-10-07  1:15                       ` Glenn Morris
2012-10-07 11:03                         ` David Engster
2012-10-27 14:40                           ` David Engster
2012-10-28 18:50                             ` Glenn Morris
2012-11-17  3:23                               ` Glenn Morris
2012-11-18 15:42                                 ` David Engster
2012-11-20  2:45                                   ` Glenn Morris
2012-11-21 13:09                                   ` Chong Yidong
2012-10-07 20:50                 ` David Engster
2012-11-08 12:32         ` Alex Ott
2012-10-02  2:44 Dmitry Gutov
2012-10-02  5:05 ` Chong Yidong
2012-10-02  5:56   ` David Engster
2017-01-12 19:32 CEDET Merge Edward John Steere
2017-01-12 19:45 ` Eli Zaretskii
2017-01-12 20:27   ` Edward John Steere
2017-01-12 20:10 ` Bastian Beischer
2017-01-12 20:40   ` Edward John Steere
2017-01-16 18:45     ` Edward John Steere
2017-01-16 19:30       ` Eli Zaretskii
2017-01-16 19:55         ` Edward John Steere
2017-01-16 20:06           ` Eli Zaretskii
2017-01-16 20:12             ` Edward John Steere
2017-01-17 15:59               ` Eli Zaretskii
2017-01-17 16:10                 ` Edward John Steere
2017-01-17 16:36                   ` Stephen Leake
2017-01-17 20:36                     ` Edward John Steere
2017-01-17 21:22                       ` Stephen Leake
2017-01-17 21:23                       ` David Engster
2017-01-18 10:12                         ` Edward Steere
2017-01-18 22:05                           ` David Engster
2017-01-19 18:01                             ` Edward John Steere
2017-01-19 21:57                               ` David Engster
2017-01-19 22:29                                 ` Karl Fogel
2017-01-20 22:20                                   ` David Engster
2017-01-20 22:40                                     ` Stefan Monnier
2017-01-20 22:57                                       ` David Engster
2017-01-21  0:08                                         ` Stefan Monnier
2017-01-21 12:02                                     ` Eli Zaretskii
2017-01-21 18:29                                       ` Glenn Morris
2017-01-21 18:37                                         ` Eli Zaretskii
2017-01-21 18:52                                           ` Glenn Morris
2017-01-21 19:50                                             ` Eli Zaretskii
2017-01-21 22:57                                               ` Paul Eggert
2017-01-22 16:08                                                 ` Eli Zaretskii
2017-01-22 22:00                                             ` David Engster
2017-01-23  1:37                                               ` Paul Eggert
2017-01-22 21:31                                 ` David Engster
2017-01-24 19:02                                   ` Edward John Steere
2017-01-26 19:54                                     ` Edward John Steere
2017-01-26 21:06                                       ` David Engster
2017-01-27  4:38                                         ` Edward Steere
2017-01-27 20:20                                   ` Edward John Steere
2017-01-27 21:04                                     ` David Engster
2017-01-28  9:23                                       ` Edward John Steere
2017-01-29 21:34                                         ` David Engster
2017-01-31 16:51                                           ` Lars Ingebrigtsen
2017-01-31 18:48                                             ` Ted Zlatanov
2017-01-28 13:45                                       ` Edward John Steere
2017-01-17 21:10                     ` David Engster
2017-01-17 21:25                       ` Stephen Leake
2017-01-16 20:26           ` David Engster
2017-01-16 20:37             ` Edward John Steere
2017-01-16 21:13               ` David Engster
2017-01-17  5:21                 ` Edward Steere
2017-01-17 21:06                   ` David Engster
2017-01-17 21:19                     ` Dmitry Gutov
2017-01-17 21:32                       ` David Engster
2017-01-18  3:10                         ` Lee Hinman
2017-01-18  5:31                           ` Edward John Steere
2017-01-18 12:58                             ` Stephen Leake
2017-01-18 21:57                             ` David Engster
2017-01-19 17:51                               ` Edward John Steere
2017-01-19 20:25                                 ` Lee Hinman
2017-01-29 19:25                                   ` John Wiegley
2017-01-21 18:06                               ` Eric Ludlam
2017-09-23 11:38 ` Charles A. Roelli
2017-09-23 12:55   ` Edward John Steere
2017-09-24  8:24     ` Charles A. Roelli
2017-09-26 18:31 Edward John Steere

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87my4bwv8z.fsf@hagelb.org \
    --to=phil@hagelb.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=scymtym@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).