[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treeview 0bdd3187c7 07/25: Reworked treeview-put so it can
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treeview 0bdd3187c7 07/25: Reworked treeview-put so it can insert images |
Date: |
Sat, 10 Sep 2022 17:59:37 -0400 (EDT) |
branch: elpa/treeview
commit 0bdd3187c7e47459e7a7031b43f694c54d5b3fa4
Author: Tilman Rassy <tilman.rassy@googlemail.com>
Commit: Tilman Rassy <tilman.rassy@googlemail.com>
Reworked treeview-put so it can insert images
---
treeview.el | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/treeview.el b/treeview.el
index 63026d871b..3ade22cb9d 100644
--- a/treeview.el
+++ b/treeview.el
@@ -258,14 +258,25 @@ node has no children or is unread (i.e., its state is
'folded-unred'.")
Calls the buffer local function `treeview-node-leaf-p-function' with one
argument, NODE."
(funcall treeview-node-leaf-p-function node))
-(defun treeview-put (&rest args)
- "Insert ARGS at point.
-Each element of ARGS may be a string, a character, nil, or a list. If nil, the
-element is ignored. If a list, the function recursively calls itself."
- (while args
- (let ( (arg (car args)) )
- (if arg (if (listp arg) (apply 'treeview-put arg) (insert arg)))
- (setq args (cdr args)) )))
+(defun treeview-put (&rest objects)
+ "Insert OBJECTS at point.
+Each element of OBJECTS may be a string, a character, an image, nil, or a list.
+If nil, the element is ignored. If a list, the function recursively calls
+itself."
+ (while objects
+ (let ( (object (car objects)) )
+ (when object
+ (if (listp object)
+ (if (eq (car object) 'image)
+ ;; It's an image
+ (let ( (start (point)) )
+ (insert " ")
+ (put-text-property start (point) 'display image))
+ ;; It's a list of objects
+ (apply 'treeview-put object))
+ ;; It's a string or character
+ (insert object) ))
+ (setq objects (cdr objects)) )))
(defun treeview-return-nil (_node)
"Return nil.
@@ -339,7 +350,7 @@ The default implementation is `treeview-return-nil'.")
(defvar treeview-get-icon-function 'treeview-return-nil
"Function to create and return the icon of a node.
Called with one argument, the node. Should return a string or nil. In the
-latter case the node does not get an icon.
+latter case the node does not get an icon.
The default implementation is `treeview-return-nil'.")
- [nongnu] elpa/treeview 07ea52cd7f 16/25: Added package dependency on emacs 24.4, (continued)
- [nongnu] elpa/treeview 07ea52cd7f 16/25: Added package dependency on emacs 24.4, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 8382de4bdd 18/25: Sharp-quoted function name, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview f0c0711070 04/25: Insering/removing nodes; treeview-after-node-expanded-function and treeview-after-node-folded-function, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 5dff23aac0 09/25: New functions for navigation; misc. improvements, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 3038ebf96e 08/25: Fixed bug when removing first child, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 34ecd7a320 24/25: Fixed issues detected by flycheck; updated documentation, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview a82bc8c5d1 17/25: Removed needless progn around body of while, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 4a341b05bc 14/25: Bugfix for updating hidden nodes, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 7fc5f30552 03/25: Initial commit of treeview.el, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 270cfbd5bd 06/25: Using 'let' to set buffer-read-only temporarily to t, ELPA Syncer, 2022/09/10
- [nongnu] elpa/treeview 0bdd3187c7 07/25: Reworked treeview-put so it can insert images,
ELPA Syncer <=