[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el
From: |
Thien-Thi Nguyen |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el |
Date: |
Tue, 23 May 2006 07:30:21 +0000 |
Index: emacs/lisp/emacs-lisp/ewoc.el
diff -u emacs/lisp/emacs-lisp/ewoc.el:1.28 emacs/lisp/emacs-lisp/ewoc.el:1.29
--- emacs/lisp/emacs-lisp/ewoc.el:1.28 Mon May 22 05:39:24 2006
+++ emacs/lisp/emacs-lisp/ewoc.el Tue May 23 07:30:20 2006
@@ -107,6 +107,7 @@
;; (defun ewoc-nth (ewoc n)
;; (defun ewoc-map (map-function ewoc &rest args)
;; (defun ewoc-filter (ewoc predicate &rest args)
+;; (defun ewoc-delete (ewoc &rest nodes)
;; (defun ewoc-locate (ewoc &optional pos guess)
;; (defun ewoc-invalidate (ewoc &rest nodes)
;; (defun ewoc-goto-prev (ewoc arg)
@@ -376,6 +377,27 @@
(ewoc--refresh-node pp node))
(setq node (ewoc--node-next dll node))))))
+(defun ewoc-delete (ewoc &rest nodes)
+ "Delete NODES from EWOC."
+ (ewoc--set-buffer-bind-dll-let* ewoc
+ ((L nil) (R nil))
+ (dolist (node nodes)
+ ;; If we are about to delete the node pointed at by last-node,
+ ;; set last-node to nil.
+ (if (eq (ewoc--last-node ewoc) node)
+ (setf (ewoc--last-node ewoc) nil))
+ (delete-region (ewoc--node-start-marker node)
+ (ewoc--node-start-marker (ewoc--node-next dll node)))
+ (set-marker (ewoc--node-start-marker node) nil)
+ (setf L (ewoc--node-left node)
+ R (ewoc--node-right node)
+ ;; Link neighbors to each other.
+ (ewoc--node-right L) R
+ (ewoc--node-left R) L
+ ;; Forget neighbors.
+ (ewoc--node-left node) nil
+ (ewoc--node-right node) nil))))
+
(defun ewoc-filter (ewoc predicate &rest args)
"Remove all elements in EWOC for which PREDICATE returns nil.
Note that the buffer for EWOC will be current-buffer when PREDICATE
@@ -386,28 +408,13 @@
(ewoc--set-buffer-bind-dll-let* ewoc
((node (ewoc--node-nth dll 1))
(footer (ewoc--footer ewoc))
- (next nil)
- (L nil) (R nil)
+ (goodbye nil)
(inhibit-read-only t))
(while (not (eq node footer))
- (setq next (ewoc--node-next dll node))
(unless (apply predicate (ewoc--node-data node) args)
- ;; If we are about to delete the node pointed at by last-node,
- ;; set last-node to nil.
- (if (eq (ewoc--last-node ewoc) node)
- (setf (ewoc--last-node ewoc) nil))
- (delete-region (ewoc--node-start-marker node)
- (ewoc--node-start-marker (ewoc--node-next dll node)))
- (set-marker (ewoc--node-start-marker node) nil)
- (setf L (ewoc--node-left node)
- R (ewoc--node-right node)
- ;; Link neighbors to each other.
- (ewoc--node-right L) R
- (ewoc--node-left R) L
- ;; Forget neighbors.
- (ewoc--node-left node) nil
- (ewoc--node-right node) nil))
- (setq node next))))
+ (push node goodbye))
+ (setq node (ewoc--node-next dll node)))
+ (apply 'ewoc-delete ewoc goodbye)))
(defun ewoc-locate (ewoc &optional pos guess)
"Return the node that POS (a buffer position) is within.
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/05
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/10
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/11
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/12
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/12
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/17
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/17
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/18
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/21
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/22
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el,
Thien-Thi Nguyen <=
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/26
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Thien-Thi Nguyen, 2006/05/27
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Stefan Monnier, 2006/05/28
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el, Stefan Monnier, 2006/05/29