Mercurial > emacs
comparison lisp/emacs-lisp/ewoc.el @ 71012:04ef040bae36
Commentary and whitespace munging; nfc.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Sat, 27 May 2006 18:13:15 +0000 |
parents | 103ed71d4639 |
children | bf1f0ff1e25e |
comparison
equal
deleted
inserted
replaced
71011:295f9867e78b | 71012:04ef040bae36 |
---|---|
86 ;; | 86 ;; |
87 ;; Remember that an element can be anything. Your imagination is the | 87 ;; Remember that an element can be anything. Your imagination is the |
88 ;; limit! It is even possible to have another ewoc as an | 88 ;; limit! It is even possible to have another ewoc as an |
89 ;; element. In that way some kind of tree hierarchy can be created. | 89 ;; element. In that way some kind of tree hierarchy can be created. |
90 ;; | 90 ;; |
91 ;; Full documentation will, God willing, soon be available in a | 91 ;; The Emacs Lisp Reference Manual documents ewoc.el's "public interface". |
92 ;; Texinfo manual. | |
93 | |
94 ;; In the mean time `grep '^(.*ewoc-[^-]' emacs-lisp/ewoc.el' can help | |
95 ;; you find all the exported functions: | |
96 ;; | |
97 ;; (defun ewoc-create (pretty-printer &optional header footer nosep) | |
98 ;; (defalias 'ewoc-data 'ewoc--node-data) | |
99 ;; (defun ewoc-set-data (node data) | |
100 ;; (defun ewoc-location (node) | |
101 ;; (defun ewoc-enter-first (ewoc data) | |
102 ;; (defun ewoc-enter-last (ewoc data) | |
103 ;; (defun ewoc-enter-after (ewoc node data) | |
104 ;; (defun ewoc-enter-before (ewoc node data) | |
105 ;; (defun ewoc-next (ewoc node) | |
106 ;; (defun ewoc-prev (ewoc node) | |
107 ;; (defun ewoc-nth (ewoc n) | |
108 ;; (defun ewoc-map (map-function ewoc &rest args) | |
109 ;; (defun ewoc-filter (ewoc predicate &rest args) | |
110 ;; (defun ewoc-delete (ewoc &rest nodes) | |
111 ;; (defun ewoc-locate (ewoc &optional pos guess) | |
112 ;; (defun ewoc-invalidate (ewoc &rest nodes) | |
113 ;; (defun ewoc-goto-prev (ewoc arg) | |
114 ;; (defun ewoc-goto-next (ewoc arg) | |
115 ;; (defun ewoc-goto-node (ewoc node) | |
116 ;; (defun ewoc-refresh (ewoc) | |
117 ;; (defun ewoc-collect (ewoc predicate &rest args) | |
118 ;; (defun ewoc-buffer (ewoc) | |
119 ;; (defun ewoc-get-hf (ewoc) | |
120 ;; (defun ewoc-set-hf (ewoc header footer) | |
121 | 92 |
122 ;; Coding conventions | 93 ;; Coding conventions |
123 ;; ================== | 94 ;; ================== |
124 ;; | 95 ;; |
125 ;; All functions of course start with `ewoc'. Functions and macros | 96 ;; All functions of course start with `ewoc'. Functions and macros |
126 ;; starting with the prefix `ewoc--' are meant for internal use, | 97 ;; starting with the prefix `ewoc--' are meant for internal use, |
127 ;; while those starting with `ewoc-' are exported for public use. | 98 ;; while those starting with `ewoc-' are exported for public use. |
128 ;; There are currently no global or buffer-local variables used. | |
129 | |
130 | 99 |
131 ;;; Code: | 100 ;;; Code: |
132 | 101 |
133 (eval-when-compile (require 'cl)) ;because of CL compiler macros | 102 (eval-when-compile (require 'cl)) ;because of CL compiler macros |
134 | 103 |
326 "Enter DATA last in EWOC. | 295 "Enter DATA last in EWOC. |
327 Return the new node." | 296 Return the new node." |
328 (ewoc--set-buffer-bind-dll ewoc | 297 (ewoc--set-buffer-bind-dll ewoc |
329 (ewoc-enter-before ewoc (ewoc--node-nth -1) data))) | 298 (ewoc-enter-before ewoc (ewoc--node-nth -1) data))) |
330 | 299 |
331 | |
332 (defun ewoc-enter-after (ewoc node data) | 300 (defun ewoc-enter-after (ewoc node data) |
333 "Enter a new element DATA after NODE in EWOC. | 301 "Enter a new element DATA after NODE in EWOC. |
334 Return the new node." | 302 Return the new node." |
335 (ewoc--set-buffer-bind-dll ewoc | 303 (ewoc--set-buffer-bind-dll ewoc |
336 (ewoc-enter-before ewoc (ewoc--node-next node) data))) | 304 (ewoc-enter-before ewoc (ewoc--node-next node) data))) |
354 Return nil if NODE is nil or the first element." | 322 Return nil if NODE is nil or the first element." |
355 (when node | 323 (when node |
356 (ewoc--filter-hf-nodes | 324 (ewoc--filter-hf-nodes |
357 ewoc (let ((ewoc--current-dll (ewoc--dll ewoc))) | 325 ewoc (let ((ewoc--current-dll (ewoc--dll ewoc))) |
358 (ewoc--node-prev node))))) | 326 (ewoc--node-prev node))))) |
359 | |
360 | 327 |
361 (defun ewoc-nth (ewoc n) | 328 (defun ewoc-nth (ewoc n) |
362 "Return the Nth node. | 329 "Return the Nth node. |
363 N counts from zero. Return nil if there is less than N elements. | 330 N counts from zero. Return nil if there is less than N elements. |
364 If N is negative, return the -(N+1)th last element. | 331 If N is negative, return the -(N+1)th last element. |