mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 17:21:41 -05:00
WIP: Add more columns
This commit is contained in:
parent
440f4d6957
commit
5ffeaed509
1 changed files with 34 additions and 0 deletions
|
@ -132,6 +132,23 @@
|
||||||
|
|
||||||
(taxy-magit-section-define-column-definer "ement-taxy")
|
(taxy-magit-section-define-column-definer "ement-taxy")
|
||||||
|
|
||||||
|
(ement-taxy-define-column #("🐱" 0 1 (help-echo "Avatar")) (:align 'right)
|
||||||
|
;; FIXME: The images tend to break alignment; not sure why.
|
||||||
|
(pcase-let ((`[,(cl-struct ement-room avatar (local (map room-list-avatar)))
|
||||||
|
,_session]
|
||||||
|
item))
|
||||||
|
(if (and ement-room-list-avatars avatar)
|
||||||
|
(or room-list-avatar
|
||||||
|
(let ((new-avatar
|
||||||
|
(propertize " " 'display
|
||||||
|
(ement--resize-image (get-text-property 0 'display avatar)
|
||||||
|
(frame-char-width) nil))))
|
||||||
|
;; alist-get doesn't seem to return the new value when used with setf?
|
||||||
|
(setf (alist-get 'room-list-avatar (ement-room-local room))
|
||||||
|
new-avatar)
|
||||||
|
new-avatar))
|
||||||
|
" ")))
|
||||||
|
|
||||||
(ement-taxy-define-column "Name" (:max-width 25)
|
(ement-taxy-define-column "Name" (:max-width 25)
|
||||||
(pcase-let* ((`[,room ,session] item)
|
(pcase-let* ((`[,room ,session] item)
|
||||||
((cl-struct ement-room (local (map buffer))) room)
|
((cl-struct ement-room (local (map buffer))) room)
|
||||||
|
@ -154,6 +171,19 @@
|
||||||
(propertize display-name 'face face))
|
(propertize display-name 'face face))
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
|
(ement-taxy-define-column "Topic" (:max-width 35)
|
||||||
|
(pcase-let ((`[,(cl-struct ement-room topic) ,_session] item))
|
||||||
|
(or topic "")))
|
||||||
|
|
||||||
|
(ement-taxy-define-column "Members" (:align 'right)
|
||||||
|
(pcase-let ((`[,(cl-struct ement-room
|
||||||
|
(summary (map ('m.joined_member_count member-count))))
|
||||||
|
,_session]
|
||||||
|
item))
|
||||||
|
(if member-count
|
||||||
|
(number-to-string member-count)
|
||||||
|
"")))
|
||||||
|
|
||||||
(ement-taxy-define-column "Latest" ()
|
(ement-taxy-define-column "Latest" ()
|
||||||
(pcase-let ((`[,(cl-struct ement-room latest-ts) ,_session] item))
|
(pcase-let ((`[,(cl-struct ement-room latest-ts) ,_session] item))
|
||||||
(if latest-ts
|
(if latest-ts
|
||||||
|
@ -169,6 +199,10 @@
|
||||||
(propertize formatted-ts 'face face))
|
(propertize formatted-ts 'face face))
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
|
(ement-taxy-define-column "Session" ()
|
||||||
|
(pcase-let ((`[,_room ,(cl-struct ement-session (user (cl-struct ement-user id)))] item))
|
||||||
|
id))
|
||||||
|
|
||||||
(unless ement-taxy-columns
|
(unless ement-taxy-columns
|
||||||
;; TODO: Automate this or document it
|
;; TODO: Automate this or document it
|
||||||
(setq-default ement-taxy-columns
|
(setq-default ement-taxy-columns
|
||||||
|
|
Loading…
Add table
Reference in a new issue