summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2018-06-17 18:28:34 +0900
committerTino Calancha <tino.calancha@gmail.com>2018-06-17 18:28:34 +0900
commitedb1f85a27817a3fac38bb85752671414819203b (patch)
tree8da1b7145ad7959199b2150c9337cd2f308bbb8c /lisp/dabbrev.el
parent5099b3abb2b623ce949b8efc37bee8c41d5ad754 (diff)
downloademacs-edb1f85a27817a3fac38bb85752671414819203b.tar.gz
Add new macro dolist-with-progress-reporter
* lisp/subr.el (dolist-with-progress-reporter): New macro (Bug#31697). * lisp/cus-edit.el (custom-group-value-create): Use it. * lisp/dabbrev.el (dabbrev--progress-reporter): Delete variable. (dabbrev--find-expansion): Use dotimes-with-progress-reporter. * doc/lispref/display.texi: Document the macro. ; * etc/NEWS: Announce it.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el21
1 files changed, 8 insertions, 13 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 57ee9a526a9..4af22e61409 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -327,9 +327,6 @@ this list."
;; The regexp for recognizing a character in an abbreviation.
(defvar dabbrev--abbrev-char-regexp nil)
-;; The progress reporter for buffer-scanning progress.
-(defvar dabbrev--progress-reporter nil)
-
;;----------------------------------------------------------------
;; Macros
;;----------------------------------------------------------------
@@ -739,21 +736,19 @@ of the start of the occurrence."
;; Put that list in dabbrev--friend-buffer-list.
(unless dabbrev--friend-buffer-list
(setq dabbrev--friend-buffer-list
- (dabbrev--make-friend-buffer-list))
- (setq dabbrev--progress-reporter
- (make-progress-reporter
- "Scanning for dabbrevs..."
- (- (length dabbrev--friend-buffer-list)) 0 0 1 1.5))))
+ (dabbrev--make-friend-buffer-list))))
;; Walk through the buffers till we find a match.
(let (expansion)
- (while (and (not expansion) dabbrev--friend-buffer-list)
+ (dolist-with-progress-reporter
+ (_ dabbrev--friend-buffer-list)
+ (make-progress-reporter
+ "Scanning for dabbrevs..."
+ 0 (length dabbrev--friend-buffer-list) 0 1 1.5)
(setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list))
(set-buffer dabbrev--last-buffer)
- (progress-reporter-update dabbrev--progress-reporter
- (- (length dabbrev--friend-buffer-list)))
(setq dabbrev--last-expansion-location (point-min))
- (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case)))
- (progress-reporter-done dabbrev--progress-reporter)
+ (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case))
+ (unless expansion (setq dabbrev--friend-buffer-list '())))
expansion)))))
;; Compute the list of buffers to scan.