comparison lisp/emacs-lisp/ewoc.el @ 33233:c12aa82daf99

(ewoc-goto-prev, ewoc-goto-next): Don't pass default arg to ewoc-locate. (ewoc-collect): Return result in the right order.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 06 Nov 2000 07:13:07 +0000
parents d5d7a3fbf10c
children dd613770eb0f
comparison
equal deleted inserted replaced
33232:abfd948c10d4 33233:c12aa82daf99
502 (defun ewoc-goto-prev (ewoc arg) 502 (defun ewoc-goto-prev (ewoc arg)
503 "Move point to the ARGth previous element. 503 "Move point to the ARGth previous element.
504 Don't move if we are at the first element, or if EWOC is empty. 504 Don't move if we are at the first element, or if EWOC is empty.
505 Returns the node we moved to." 505 Returns the node we moved to."
506 (ewoc--set-buffer-bind-dll-let* ewoc 506 (ewoc--set-buffer-bind-dll-let* ewoc
507 ((node (ewoc-locate ewoc (point) (ewoc--last-node ewoc)))) 507 ((node (ewoc-locate ewoc (point))))
508 (when node 508 (when node
509 ;; If we were past the last element, first jump to it. 509 ;; If we were past the last element, first jump to it.
510 (when (>= (point) (ewoc--node-start-marker (ewoc--node-right node))) 510 (when (>= (point) (ewoc--node-start-marker (ewoc--node-right node)))
511 (setq arg (1- arg))) 511 (setq arg (1- arg)))
512 (while (and node (> arg 0)) 512 (while (and node (> arg 0))
519 519
520 (defun ewoc-goto-next (ewoc arg) 520 (defun ewoc-goto-next (ewoc arg)
521 "Move point to the ARGth next element. 521 "Move point to the ARGth next element.
522 Returns the node (or nil if we just passed the last node)." 522 Returns the node (or nil if we just passed the last node)."
523 (ewoc--set-buffer-bind-dll-let* ewoc 523 (ewoc--set-buffer-bind-dll-let* ewoc
524 ((node (ewoc-locate ewoc (point) (ewoc--last-node ewoc)))) 524 ((node (ewoc-locate ewoc (point))))
525 (while (and node (> arg 0)) 525 (while (and node (> arg 0))
526 (setq arg (1- arg)) 526 (setq arg (1- arg))
527 (setq node (ewoc--node-next dll node))) 527 (setq node (ewoc--node-next dll node)))
528 ;; Never step below the first element. 528 ;; Never step below the first element.
529 ;; (unless (ewoc--filter-hf-nodes ewoc node) 529 ;; (unless (ewoc--filter-hf-nodes ewoc node)
576 result) 576 result)
577 (while (not (eq node header)) 577 (while (not (eq node header))
578 (if (apply predicate (ewoc--node-data node) args) 578 (if (apply predicate (ewoc--node-data node) args)
579 (push (ewoc--node-data node) result)) 579 (push (ewoc--node-data node) result))
580 (setq node (ewoc--node-prev dll node))) 580 (setq node (ewoc--node-prev dll node)))
581 result)) 581 (nreverse result)))
582 582
583 (defun ewoc-buffer (ewoc) 583 (defun ewoc-buffer (ewoc)
584 "Return the buffer that is associated with EWOC. 584 "Return the buffer that is associated with EWOC.
585 Returns nil if the buffer has been deleted." 585 Returns nil if the buffer has been deleted."
586 (let ((buf (ewoc--buffer ewoc))) 586 (let ((buf (ewoc--buffer ewoc)))