Mercurial > emacs
comparison lisp/emacs-lisp/ewoc.el @ 70582:f2d7dbf603c5
(ewoc--refresh-node): No longer save-excursion.
Update all callers to do it there, instead.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Thu, 11 May 2006 08:01:02 +0000 |
parents | 84297e870585 |
children | 77ae8497591f |
comparison
equal
deleted
inserted
replaced
70581:1eaae4fee224 | 70582:f2d7dbf603c5 |
---|---|
233 (ewoc--node-create (copy-marker pos) data)))) | 233 (ewoc--node-create (copy-marker pos) data)))) |
234 | 234 |
235 (defun ewoc--refresh-node (pp node) | 235 (defun ewoc--refresh-node (pp node) |
236 "Redisplay the element represented by NODE using the pretty-printer PP." | 236 "Redisplay the element represented by NODE using the pretty-printer PP." |
237 (let ((inhibit-read-only t)) | 237 (let ((inhibit-read-only t)) |
238 (save-excursion | 238 ;; First, remove the string from the buffer: |
239 ;; First, remove the string from the buffer: | 239 (delete-region (ewoc--node-start-marker node) |
240 (delete-region (ewoc--node-start-marker node) | 240 (1- (marker-position |
241 (1- (marker-position | 241 (ewoc--node-start-marker (ewoc--node-right node))))) |
242 (ewoc--node-start-marker (ewoc--node-right node))))) | 242 ;; Calculate and insert the string. |
243 ;; Calculate and insert the string. | 243 (goto-char (ewoc--node-start-marker node)) |
244 (goto-char (ewoc--node-start-marker node)) | 244 (funcall pp (ewoc--node-data node)))) |
245 (funcall pp (ewoc--node-data node))))) | |
246 | 245 |
247 ;;; =========================================================================== | 246 ;;; =========================================================================== |
248 ;;; Public members of the Ewoc package | 247 ;;; Public members of the Ewoc package |
249 | 248 |
250 | 249 |
359 If more than two arguments are given, the remaining | 358 If more than two arguments are given, the remaining |
360 arguments will be passed to MAP-FUNCTION." | 359 arguments will be passed to MAP-FUNCTION." |
361 (ewoc--set-buffer-bind-dll-let* ewoc | 360 (ewoc--set-buffer-bind-dll-let* ewoc |
362 ((footer (ewoc--footer ewoc)) | 361 ((footer (ewoc--footer ewoc)) |
363 (node (ewoc--node-nth dll 1))) | 362 (node (ewoc--node-nth dll 1))) |
364 (while (not (eq node footer)) | 363 (save-excursion |
365 (if (apply map-function (ewoc--node-data node) args) | 364 (while (not (eq node footer)) |
366 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)) | 365 (if (apply map-function (ewoc--node-data node) args) |
367 (setq node (ewoc--node-next dll node))))) | 366 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)) |
367 (setq node (ewoc--node-next dll node)))))) | |
368 | 368 |
369 (defun ewoc-filter (ewoc predicate &rest args) | 369 (defun ewoc-filter (ewoc predicate &rest args) |
370 "Remove all elements in EWOC for which PREDICATE returns nil. | 370 "Remove all elements in EWOC for which PREDICATE returns nil. |
371 Note that the buffer for EWOC will be current-buffer when PREDICATE | 371 Note that the buffer for EWOC will be current-buffer when PREDICATE |
372 is called. PREDICATE must restore the current buffer before it returns | 372 is called. PREDICATE must restore the current buffer before it returns |
471 | 471 |
472 (defun ewoc-invalidate (ewoc &rest nodes) | 472 (defun ewoc-invalidate (ewoc &rest nodes) |
473 "Call EWOC's pretty-printer for each element in NODES. | 473 "Call EWOC's pretty-printer for each element in NODES. |
474 Delete current text first, thus effecting a \"refresh\"." | 474 Delete current text first, thus effecting a \"refresh\"." |
475 (ewoc--set-buffer-bind-dll ewoc | 475 (ewoc--set-buffer-bind-dll ewoc |
476 (dolist (node nodes) | 476 (save-excursion |
477 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)))) | 477 (dolist (node nodes) |
478 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))))) | |
478 | 479 |
479 (defun ewoc-goto-prev (ewoc arg) | 480 (defun ewoc-goto-prev (ewoc arg) |
480 "Move point to the ARGth previous element in EWOC. | 481 "Move point to the ARGth previous element in EWOC. |
481 Don't move if we are at the first element, or if EWOC is empty. | 482 Don't move if we are at the first element, or if EWOC is empty. |
482 Return the node we moved to." | 483 Return the node we moved to." |
570 | 571 |
571 (defun ewoc-set-hf (ewoc header footer) | 572 (defun ewoc-set-hf (ewoc header footer) |
572 "Set the HEADER and FOOTER of EWOC." | 573 "Set the HEADER and FOOTER of EWOC." |
573 (setf (ewoc--node-data (ewoc--header ewoc)) header) | 574 (setf (ewoc--node-data (ewoc--header ewoc)) header) |
574 (setf (ewoc--node-data (ewoc--footer ewoc)) footer) | 575 (setf (ewoc--node-data (ewoc--footer ewoc)) footer) |
575 (ewoc--refresh-node 'insert (ewoc--header ewoc)) | 576 (save-excursion |
576 (ewoc--refresh-node 'insert (ewoc--footer ewoc))) | 577 (ewoc--refresh-node 'insert (ewoc--header ewoc)) |
578 (ewoc--refresh-node 'insert (ewoc--footer ewoc)))) | |
577 | 579 |
578 | 580 |
579 (provide 'ewoc) | 581 (provide 'ewoc) |
580 | 582 |
581 ;;; Local Variables: | 583 ;;; Local Variables: |