From: Michael Albinus <michael.albinus@gmx.de>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters
Date: Thu, 17 Feb 2011 22:43:54 +0100 [thread overview]
Message-ID: <87tyg272w5.fsf@gmx.de> (raw)
In-Reply-To: <8739nm1u6n.fsf_-_@lifelogs.com> (Ted Zlatanov's message of "Thu, 17 Feb 2011 10:50:56 -0600")
[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]
Ted Zlatanov <tzz@lifelogs.com> writes:
> How about (showing both proposed use cases)
>
> (setq pr1 (make-progress-reporter 'modeline))
> (setq pr4 (make-progress-reporter 'modeline 0 100))
> (while t
> (progress-reporter-update pr1)
> (progress-reporter-update pr4))
>
> to work in conjunction with a %/ in the modeline? The idea is that it
> is guaranteed to be 1 or log10(max)+2 characters (non-numeric or
> numeric) wide in this mode and it won't make any noise in the echo area.
As proof of concept the appended patch. I don't use a special "%/"
format in the modeline; instead of there is `mode-line-progress-reporter'
which can be placed somewhere in `mode-line-format' (I've done it after
`mode-line-remote').
You call
(setq pr (make-progress-reporter))
(while t (progress-reporter-update pr))
No text in `make-progress-reporter' would be the modeline indicator;
a text based progress reporter still writes in the minibuffer:
(setq pr (make-progress-reporter ""))
(while t (progress-reporter-update pr))
> Another suggestion for progress-reporter--pulse-characters for both
> modeline and regular use: there are some Unicode glyphs which could be
> used if the font supports them:
> http://en.wikipedia.org/wiki/Harvey_Balls#Harvey_Balls_in_Unicode
>
> Maybe progress-reporter--pulse-characters could be customizable with
> some presets like the above.
That's for later.
> Ted
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2481 bytes --]
=== modified file 'lisp/bindings.el'
--- lisp/bindings.el 2011-01-25 04:08:28 +0000
+++ lisp/bindings.el 2011-02-17 20:37:34 +0000
@@ -254,9 +254,13 @@
"Mode-line flag to show if default-directory for current buffer is remote.")
;;;###autoload
(put 'mode-line-remote 'risky-local-variable t)
-
(make-variable-buffer-local 'mode-line-remote)
+(defvar mode-line-progress-reporter nil
+ "Mode-line control for spinning progress-reporter.")
+;;;###autoload
+(put 'mode-line-progress-reporter 'risky-local-variable t)
+
;; Actual initialization is below.
(defvar mode-line-position nil
"Mode-line control for displaying the position in the buffer.
@@ -326,6 +330,7 @@
'mode-line-client
'mode-line-modified
'mode-line-remote
+ 'mode-line-progress-reporter
'mode-line-frame-identification
'mode-line-buffer-identification
(propertize " " 'help-echo help-echo)
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2011-02-01 21:37:12 +0000
+++ lisp/subr.el 2011-02-17 21:31:24 +0000
@@ -3486,7 +3486,7 @@
(>= value (car reporter))) ; For numerical reporter
(progress-reporter-do-update reporter value)))
-(defun make-progress-reporter (message &optional min-value max-value
+(defun make-progress-reporter (&optional message min-value max-value
current-value min-change min-time)
"Return progress reporter object for use with `progress-reporter-update'.
@@ -3553,6 +3553,7 @@
(min-value (aref parameters 1))
(max-value (aref parameters 2))
(text (aref parameters 3))
+ (min-time (aref parameters 5))
(current-time (float-time))
(enough-time-passed
;; See if enough time has passed since the last update.
@@ -3591,10 +3592,20 @@
(let ((index (mod (1+ (car reporter)) 4))
(message-log-max nil))
(setcar reporter index)
- (message "%s %s"
- text
- (aref progress-reporter--pulse-characters
- index)))))))
+ (if text
+ ;; Write into the minibuffer
+ (message "%s %s"
+ text
+ (aref progress-reporter--pulse-characters
+ index))
+ ;; Update modeline
+ (let ((mode-line-progress-reporter
+ (list (propertize
+ (aref progress-reporter--pulse-characters index)
+ 'mouse-face 'mode-line-highlight)))
+ mode-line-remote)
+ (force-mode-line-update)
+ (sit-for min-time t))))))))
(defun progress-reporter-done (reporter)
"Print reporter's message followed by word \"done\" in echo area."
next prev parent reply other threads:[~2011-02-17 21:43 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <buo7hczz61i.fsf@dhlpc061.dev.necel.com>
2011-02-17 12:14 ` auth-source-search: annoying messages Ted Zlatanov
2011-02-17 12:30 ` Michael Albinus
2011-02-17 13:41 ` Ted Zlatanov
2011-02-17 16:06 ` Michael Albinus
2011-02-17 16:50 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters (was: auth-source-search: annoying messages) Ted Zlatanov
2011-02-17 21:43 ` Michael Albinus [this message]
2011-02-18 14:47 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters Tom Tromey
2011-02-18 20:08 ` Ted Zlatanov
2011-02-20 11:29 ` Michael Albinus
2011-02-20 11:33 ` Michael Albinus
2011-02-20 18:37 ` Tom Tromey
2011-02-21 18:54 ` Michael Albinus
2011-02-22 17:28 ` Ted Zlatanov
2011-02-23 8:23 ` Lars Ingebrigtsen
2011-02-23 8:46 ` Michael Albinus
2011-02-23 15:08 ` Ted Zlatanov
2011-02-23 15:59 ` Michael Albinus
2011-02-23 16:43 ` Ted Zlatanov
2011-02-23 20:56 ` Chong Yidong
2011-02-23 21:28 ` make-progress-reporter suggestions: 'modeline and customizableprogress-reporter--pulse-characters Drew Adams
2011-02-23 21:35 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters Ted Zlatanov
2011-02-23 21:48 ` Global indicators (was: make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters) Julien Danjou
2011-02-24 0:05 ` Global indicators Chong Yidong
2011-02-24 0:13 ` Drew Adams
2011-02-24 11:02 ` Julien Danjou
2011-02-24 11:12 ` Miles Bader
2011-02-24 11:42 ` Julien Danjou
2011-02-24 12:56 ` joakim
2011-02-25 2:41 ` Miles Bader
2011-02-24 12:37 ` David Kastrup
2011-02-24 13:56 ` Julien Danjou
2011-02-24 16:50 ` Ted Zlatanov
2011-02-23 21:53 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters Eli Zaretskii
2011-02-24 16:37 ` Ted Zlatanov
2011-02-23 22:04 ` David Kastrup
2011-02-24 0:38 ` Ted Zlatanov
2011-02-24 1:27 ` make-progress-reporter suggestions: 'modeline and customizableprogress-reporter--pulse-characters Drew Adams
2011-02-24 2:01 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters Chong Yidong
2011-02-24 3:15 ` Ted Zlatanov
2011-02-24 16:55 ` Stefan Monnier
2011-02-24 17:45 ` Drew Adams
2011-02-24 18:05 ` Global indicators (was: make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters) Ted Zlatanov
2011-02-24 19:56 ` Global indicators Michael Albinus
2011-03-01 18:25 ` Ted Zlatanov
2011-03-28 18:44 ` Ted Zlatanov
2011-09-28 13:56 ` Ted Zlatanov
2011-02-25 13:56 ` make-progress-reporter suggestions: 'modeline and customizable progress-reporter--pulse-characters Michael Albinus
2011-02-17 20:17 ` auth-source-search: annoying messages Stefan Monnier
2011-02-18 20:06 ` Ted Zlatanov
2011-02-18 22:04 ` Lars Ingebrigtsen
2011-02-18 22:33 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tyg272w5.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=tzz@lifelogs.com \
/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.
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 NNTP newsgroup(s).