Mercurial > emacs
comparison lisp/subr.el @ 57408:601c087f45f6
(progress-reporter-update): Define before first usage.
(make-progress-reporter): Doc fix.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 09 Oct 2004 21:50:57 +0000 |
parents | 78290fa43da5 |
children | 0326440c511a |
comparison
equal
deleted
inserted
replaced
57407:47b51cd0be44 | 57408:601c087f45f6 |
---|---|
2669 ;; | 2669 ;; |
2670 ;; NEXT-UPDATE-TIME is a float. While `float-time' loses a couple | 2670 ;; NEXT-UPDATE-TIME is a float. While `float-time' loses a couple |
2671 ;; digits of precision, it doesn't really matter here. On the other | 2671 ;; digits of precision, it doesn't really matter here. On the other |
2672 ;; hand, it greatly simplifies the code. | 2672 ;; hand, it greatly simplifies the code. |
2673 | 2673 |
2674 (defsubst progress-reporter-update (reporter value) | |
2675 "Report progress of an operation in the echo area. | |
2676 However, if the change since last echo area update is too small | |
2677 or not enough time has passed, then do nothing (see | |
2678 `make-progress-reporter' for details). | |
2679 | |
2680 First parameter, REPORTER, should be the result of a call to | |
2681 `make-progress-reporter'. Second, VALUE, determines the actual | |
2682 progress of operation; it must be between MIN-VALUE and MAX-VALUE | |
2683 as passed to `make-progress-reporter'. | |
2684 | |
2685 This function is very inexpensive, you may not bother how often | |
2686 you call it." | |
2687 (when (>= value (car reporter)) | |
2688 (progress-reporter-do-update reporter value))) | |
2689 | |
2674 (defun make-progress-reporter (message min-value max-value | 2690 (defun make-progress-reporter (message min-value max-value |
2675 &optional current-value | 2691 &optional current-value |
2676 min-change min-time) | 2692 min-change min-time) |
2677 "Return an object suitable for reporting operation progress with `progress-reporter-update'. | 2693 "Return progress reporter object usage with `progress-reporter-update'. |
2678 | 2694 |
2679 MESSAGE is shown in the echo area. When at least 1% of operation | 2695 MESSAGE is shown in the echo area. When at least 1% of operation |
2680 is complete, the exact percentage will be appended to the | 2696 is complete, the exact percentage will be appended to the |
2681 MESSAGE. When you call `progress-reporter-done', word \"done\" | 2697 MESSAGE. When you call `progress-reporter-done', word \"done\" |
2682 is printed after the MESSAGE. You can change MESSAGE of an | 2698 is printed after the MESSAGE. You can change MESSAGE of an |
2708 message | 2724 message |
2709 (if min-change (max (min min-change 50) 1) 1) | 2725 (if min-change (max (min min-change 50) 1) 1) |
2710 min-time)))) | 2726 min-time)))) |
2711 (progress-reporter-update reporter (or current-value min-value)) | 2727 (progress-reporter-update reporter (or current-value min-value)) |
2712 reporter)) | 2728 reporter)) |
2713 | |
2714 (defsubst progress-reporter-update (reporter value) | |
2715 "Report progress of an operation in the echo area. | |
2716 However, if the change since last echo area update is too small | |
2717 or not enough time has passed, then do nothing (see | |
2718 `make-progress-reporter' for details). | |
2719 | |
2720 First parameter, REPORTER, should be the result of a call to | |
2721 `make-progress-reporter'. Second, VALUE, determines the actual | |
2722 progress of operation; it must be between MIN-VALUE and MAX-VALUE | |
2723 as passed to `make-progress-reporter'. | |
2724 | |
2725 This function is very inexpensive, you may not bother how often | |
2726 you call it." | |
2727 (when (>= value (car reporter)) | |
2728 (progress-reporter-do-update reporter value))) | |
2729 | 2729 |
2730 (defun progress-reporter-force-update (reporter value &optional new-message) | 2730 (defun progress-reporter-force-update (reporter value &optional new-message) |
2731 "Report progress of an operation in the echo area unconditionally. | 2731 "Report progress of an operation in the echo area unconditionally. |
2732 | 2732 |
2733 First two parameters are the same as for | 2733 First two parameters are the same as for |