tree.scm (TeXmacs-2.1.1-src) | : | tree.scm (TeXmacs-2.1.2-src) | ||
---|---|---|---|---|
skipping to change at line 289 | skipping to change at line 289 | |||
(tm-define (tree-in? t . l) | (tm-define (tree-in? t . l) | |||
(let* ((st (apply tree-ref (cons t (cDr l)))) | (let* ((st (apply tree-ref (cons t (cDr l)))) | |||
(ls (cAr l))) | (ls (cAr l))) | |||
(and st (in? (tree-label st) ls)))) | (and st (in? (tree-label st) ls)))) | |||
(tm-define (tree->path t . l) | (tm-define (tree->path t . l) | |||
(:synopsis "Get the position of the tree @t.") | (:synopsis "Get the position of the tree @t.") | |||
(if (null? l) (tree-get-path t) | (if (null? l) (tree-get-path t) | |||
(with i (cAr l) | (with i (cAr l) | |||
(if (or (== i :start) (== i :end) (integer? i)) | (if (or (== i :start) (== i :end) (integer? i)) | |||
(with u (apply tree-ref (cons t (cDr l))) | (let* ((u (apply tree-ref (cons t (cDr l)))) | |||
(cond ((not u) #f) | (p (and u (tree->path u)))) | |||
((== i :start) (path-start (root-tree) (tree->path u))) | (cond ((not p) #f) | |||
((== i :end) (path-end (root-tree) (tree->path u))) | ((== i :start) (path-start (root-tree) p)) | |||
((integer? i) (rcons (tree->path u) i)))) | ((== i :end) (path-end (root-tree) p)) | |||
((integer? i) (rcons p i)))) | ||||
(with u (apply tree-ref (cons t l)) | (with u (apply tree-ref (cons t l)) | |||
(and u (tree->path u))))))) | (and u (tree->path u))))))) | |||
(tm-define (tree-cursor-path t . l) | (tm-define (tree-cursor-path t . l) | |||
(:synopsis "Retrieve the current cursor position relative to the tree @t.") | (:synopsis "Retrieve the current cursor position relative to the tree @t.") | |||
(let* ((p (apply tree->path (cons t l))) | (let* ((p (apply tree->path (cons t l))) | |||
(c (cursor-path))) | (c (cursor-path))) | |||
(and p (list-starts? c p) (list-tail c (length p))))) | (and p (list-starts? c p) (list-tail c (length p))))) | |||
(tm-define (tree-go-to t . l) | (tm-define (tree-go-to t . l) | |||
End of changes. 1 change blocks. | ||||
5 lines changed or deleted | 6 lines changed or added |