comparison lisp/emacs-lisp/ewoc.el @ 70687:9d6a9b899f95

(ewoc-map, ewoc-invalidate): Compute PP before looping.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Wed, 17 May 2006 10:36:40 +0000
parents 308a4824e11b
children 346a9c09f370
comparison
equal deleted inserted replaced
70686:2006f23b693c 70687:9d6a9b899f95
350 350
351 If more than two arguments are given, the remaining 351 If more than two arguments are given, the remaining
352 arguments will be passed to MAP-FUNCTION." 352 arguments will be passed to MAP-FUNCTION."
353 (ewoc--set-buffer-bind-dll-let* ewoc 353 (ewoc--set-buffer-bind-dll-let* ewoc
354 ((footer (ewoc--footer ewoc)) 354 ((footer (ewoc--footer ewoc))
355 (pp (ewoc--pretty-printer ewoc))
355 (node (ewoc--node-nth dll 1))) 356 (node (ewoc--node-nth dll 1)))
356 (save-excursion 357 (save-excursion
357 (while (not (eq node footer)) 358 (while (not (eq node footer))
358 (if (apply map-function (ewoc--node-data node) args) 359 (if (apply map-function (ewoc--node-data node) args)
359 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)) 360 (ewoc--refresh-node pp node))
360 (setq node (ewoc--node-next dll node)))))) 361 (setq node (ewoc--node-next dll node))))))
361 362
362 (defun ewoc-filter (ewoc predicate &rest args) 363 (defun ewoc-filter (ewoc predicate &rest args)
363 "Remove all elements in EWOC for which PREDICATE returns nil. 364 "Remove all elements in EWOC for which PREDICATE returns nil.
364 Note that the buffer for EWOC will be current-buffer when PREDICATE 365 Note that the buffer for EWOC will be current-buffer when PREDICATE
463 best-guess))))))) 464 best-guess)))))))
464 465
465 (defun ewoc-invalidate (ewoc &rest nodes) 466 (defun ewoc-invalidate (ewoc &rest nodes)
466 "Call EWOC's pretty-printer for each element in NODES. 467 "Call EWOC's pretty-printer for each element in NODES.
467 Delete current text first, thus effecting a \"refresh\"." 468 Delete current text first, thus effecting a \"refresh\"."
468 (ewoc--set-buffer-bind-dll ewoc 469 (ewoc--set-buffer-bind-dll-let* ewoc
470 ((pp (ewoc--pretty-printer ewoc)))
469 (save-excursion 471 (save-excursion
470 (dolist (node nodes) 472 (dolist (node nodes)
471 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))))) 473 (ewoc--refresh-node pp node)))))
472 474
473 (defun ewoc-goto-prev (ewoc arg) 475 (defun ewoc-goto-prev (ewoc arg)
474 "Move point to the ARGth previous element in EWOC. 476 "Move point to the ARGth previous element in EWOC.
475 Don't move if we are at the first element, or if EWOC is empty. 477 Don't move if we are at the first element, or if EWOC is empty.
476 Return the node we moved to." 478 Return the node we moved to."