264 |
|
|
265 |
(defun ewoc--delete-node-internal (ewoc node) |
(defun ewoc--delete-node-internal (ewoc node) |
266 |
"Delete a data string from EWOC. |
"Delete a data string from EWOC. |
267 |
Can not be used on the footer. Returns the wrapper that is deleted. |
Can not be used on the footer. Return the wrapper that is deleted. |
268 |
The start-marker in the wrapper is set to nil, so that it doesn't |
The start-marker in the wrapper is set to nil, so that it doesn't |
269 |
consume any more resources." |
consume any more resources." |
270 |
(let ((dll (ewoc--dll ewoc)) |
(let ((dll (ewoc--dll ewoc)) |
334 |
(defalias 'ewoc-data 'ewoc--node-data) |
(defalias 'ewoc-data 'ewoc--node-data) |
335 |
|
|
336 |
(defun ewoc-enter-first (ewoc data) |
(defun ewoc-enter-first (ewoc data) |
337 |
"Enter DATA first in EWOC." |
"Enter DATA first in EWOC. |
338 |
|
Return the new node." |
339 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
340 |
(ewoc-enter-after ewoc (ewoc--node-nth dll 0) data))) |
(ewoc-enter-after ewoc (ewoc--node-nth dll 0) data))) |
341 |
|
|
342 |
(defun ewoc-enter-last (ewoc data) |
(defun ewoc-enter-last (ewoc data) |
343 |
"Enter DATA last in EWOC." |
"Enter DATA last in EWOC. |
344 |
|
Return the new node." |
345 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
346 |
(ewoc-enter-before ewoc (ewoc--node-nth dll -1) data))) |
(ewoc-enter-before ewoc (ewoc--node-nth dll -1) data))) |
347 |
|
|
348 |
|
|
349 |
(defun ewoc-enter-after (ewoc node data) |
(defun ewoc-enter-after (ewoc node data) |
350 |
"Enter a new element DATA after NODE in EWOC. |
"Enter a new element DATA after NODE in EWOC. |
351 |
Returns the new NODE." |
Return the new node." |
352 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
353 |
(ewoc-enter-before ewoc (ewoc--node-next dll node) data))) |
(ewoc-enter-before ewoc (ewoc--node-next dll node) data))) |
354 |
|
|
355 |
(defun ewoc-enter-before (ewoc node data) |
(defun ewoc-enter-before (ewoc node data) |
356 |
"Enter a new element DATA before NODE in EWOC. |
"Enter a new element DATA before NODE in EWOC. |
357 |
Returns the new NODE." |
Return the new node." |
358 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
359 |
(ewoc--node-enter-before |
(ewoc--node-enter-before |
360 |
node |
node |
364 |
(ewoc--node-start-marker node))))) |
(ewoc--node-start-marker node))))) |
365 |
|
|
366 |
(defun ewoc-next (ewoc node) |
(defun ewoc-next (ewoc node) |
367 |
"Get the next node. |
"Return the node in EWOC that follows NODE. |
368 |
Returns nil if NODE is nil or the last element." |
Return nil if NODE is nil or the last element." |
369 |
(when node |
(when node |
370 |
(ewoc--filter-hf-nodes |
(ewoc--filter-hf-nodes |
371 |
ewoc (ewoc--node-next (ewoc--dll ewoc) node)))) |
ewoc (ewoc--node-next (ewoc--dll ewoc) node)))) |
372 |
|
|
373 |
(defun ewoc-prev (ewoc node) |
(defun ewoc-prev (ewoc node) |
374 |
"Get the previous node. |
"Return the node in EWOC that precedes NODE. |
375 |
Returns nil if NODE is nil or the first element." |
Return nil if NODE is nil or the first element." |
376 |
(when node |
(when node |
377 |
(ewoc--filter-hf-nodes |
(ewoc--filter-hf-nodes |
378 |
ewoc |
ewoc |
499 |
best-guess))))))) |
best-guess))))))) |
500 |
|
|
501 |
(defun ewoc-invalidate (ewoc &rest nodes) |
(defun ewoc-invalidate (ewoc &rest nodes) |
502 |
"Refresh some elements. |
"Call EWOC's pretty-printer for each element in NODES. |
503 |
The pretty-printer set for EWOC will be called for all NODES." |
Delete current text first, thus effecting a \"refresh\"." |
504 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
505 |
(dolist (node nodes) |
(dolist (node nodes) |
506 |
(ewoc--refresh-node (ewoc--pretty-printer ewoc) node)))) |
(ewoc--refresh-node (ewoc--pretty-printer ewoc) node)))) |
507 |
|
|
508 |
(defun ewoc-goto-prev (ewoc arg) |
(defun ewoc-goto-prev (ewoc arg) |
509 |
"Move point to the ARGth previous element. |
"Move point to the ARGth previous element in EWOC. |
510 |
Don't move if we are at the first element, or if EWOC is empty. |
Don't move if we are at the first element, or if EWOC is empty. |
511 |
Returns the node we moved to." |
Return the node we moved to." |
512 |
(ewoc--set-buffer-bind-dll-let* ewoc |
(ewoc--set-buffer-bind-dll-let* ewoc |
513 |
((node (ewoc-locate ewoc (point)))) |
((node (ewoc-locate ewoc (point)))) |
514 |
(when node |
(when node |
524 |
(ewoc-goto-node ewoc node)))) |
(ewoc-goto-node ewoc node)))) |
525 |
|
|
526 |
(defun ewoc-goto-next (ewoc arg) |
(defun ewoc-goto-next (ewoc arg) |
527 |
"Move point to the ARGth next element. |
"Move point to the ARGth next element in EWOC. |
528 |
Returns the node (or nil if we just passed the last node)." |
Return the node (or nil if we just passed the last node)." |
529 |
(ewoc--set-buffer-bind-dll-let* ewoc |
(ewoc--set-buffer-bind-dll-let* ewoc |
530 |
((node (ewoc-locate ewoc (point)))) |
((node (ewoc-locate ewoc (point)))) |
531 |
(while (and node (> arg 0)) |
(while (and node (> arg 0)) |
537 |
(ewoc-goto-node ewoc node))) |
(ewoc-goto-node ewoc node))) |
538 |
|
|
539 |
(defun ewoc-goto-node (ewoc node) |
(defun ewoc-goto-node (ewoc node) |
540 |
"Move point to NODE." |
"Move point to NODE in EWOC." |
541 |
(ewoc--set-buffer-bind-dll ewoc |
(ewoc--set-buffer-bind-dll ewoc |
542 |
(goto-char (ewoc--node-start-marker node)) |
(goto-char (ewoc--node-start-marker node)) |
543 |
(if goal-column (move-to-column goal-column)) |
(if goal-column (move-to-column goal-column)) |
588 |
|
|
589 |
(defun ewoc-buffer (ewoc) |
(defun ewoc-buffer (ewoc) |
590 |
"Return the buffer that is associated with EWOC. |
"Return the buffer that is associated with EWOC. |
591 |
Returns nil if the buffer has been deleted." |
Return nil if the buffer has been deleted." |
592 |
(let ((buf (ewoc--buffer ewoc))) |
(let ((buf (ewoc--buffer ewoc))) |
593 |
(when (buffer-name buf) buf))) |
(when (buffer-name buf) buf))) |
594 |
|
|