summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/ewoc.el
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2006-05-27 09:37:13 +0000
committerThien-Thi Nguyen <ttn@gnuvola.org>2006-05-27 09:37:13 +0000
commitec491f90014dd3e6c15cafba0570fe67355c1413 (patch)
tree03ce5659df134e39c098403283fa7b81b7f799d5 /lisp/emacs-lisp/ewoc.el
parentf860b7216f200b4836f07a745fd8f1ddc39480ed (diff)
downloademacs-ec491f90014dd3e6c15cafba0570fe67355c1413.tar.gz
(ewoc-delete): Compute last node once before looping.
Diffstat (limited to 'lisp/emacs-lisp/ewoc.el')
-rw-r--r--lisp/emacs-lisp/ewoc.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index d1ededc583d..a02425b0cec 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -385,12 +385,12 @@ arguments will be passed to MAP-FUNCTION."
(defun ewoc-delete (ewoc &rest nodes)
"Delete NODES from EWOC."
(ewoc--set-buffer-bind-dll-let* ewoc
- ((L nil) (R nil))
+ ((L nil) (R nil) (last (ewoc--last-node ewoc)))
(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))
+ (when (eq last node)
+ (setf last nil (ewoc--last-node ewoc) nil))
(delete-region (ewoc--node-start-marker node)
(ewoc--node-start-marker (ewoc--node-next node)))
(set-marker (ewoc--node-start-marker node) nil)