From 8b3a75ac8f9fb619b3136a811b34e9d36ec4e2b8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 15 Jan 2005 12:39:25 +0000 Subject: [PATCH] (ebrowse-class-in-tree): Return the tail of the tree rather than the element found, thus enabling the tree to be setcar'd. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/ebrowse.el | 18 +++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5bc8aada7de..567b5c5c9d5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2005-01-15 Alan Mackenzie + + * ebrowse.el (ebrowse-class-in-tree): Return the tail of the tree + rather than the element found, thus enabling the tree to be + setcar'd. + 2005-01-14 Carsten Dominik * textmodes/org.el (org-show-following-heading): New option. diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 478ce403b31..bf11ea28514 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -780,16 +780,16 @@ The class tree is found in the buffer-local variable `ebrowse--tree-obarray'." (defun ebrowse-class-in-tree (class tree) "Search for a class with name CLASS in TREE. -Return the class found, if any. This function is used during the load -phase where classes appended to a file replace older class -information." +If CLASS is found, return the tail of TREE starting at CLASS. This function +is used during the load phase where classes appended to a file replace older +class information." (let ((tclass (ebrowse-ts-class class)) found) (while (and tree (not found)) - (let ((root (car tree))) - (when (string= (ebrowse-qualified-class-name (ebrowse-ts-class root)) + (let ((root-ptr tree)) + (when (string= (ebrowse-qualified-class-name (ebrowse-ts-class (car root-ptr))) (ebrowse-qualified-class-name tclass)) - (setq found root)) + (setq found root-ptr)) (setq tree (cdr tree)))) found)) @@ -903,10 +903,10 @@ and TREE is a list of `ebrowse-ts' structures forming the class tree." (let ((gc-cons-threshold 2000000)) (while (not (progn (skip-chars-forward " \t\n\r") (eobp))) (let* ((root (read (current-buffer))) - (old-root (ebrowse-class-in-tree root tree))) + (old-root-ptr (ebrowse-class-in-tree root tree))) (ebrowse-show-progress "Reading data" (null tree)) - (if old-root - (setf (car old-root) root) + (if old-root-ptr + (setcar old-root-ptr root) (push root tree))))) (garbage-collect) (list header tree))) -- 2.39.5