[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement 2764c104ef 2/3: Merge: Cache room-list visibility
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/ement 2764c104ef 2/3: Merge: Cache room-list visibility concisely |
|
Date: |
Wed, 24 Jan 2024 18:57:56 -0500 (EST) |
branch: externals/ement
commit 2764c104efd94bd309e2ad7b249d5cafc6a45df7
Merge: 4a25cc0991 eabb725767
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Merge: Cache room-list visibility concisely
---
ement-room-list.el | 25 ++++++++++++++++++++++++-
ement.el | 2 +-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/ement-room-list.el b/ement-room-list.el
index 867c150198..f0194db803 100644
--- a/ement-room-list.el
+++ b/ement-room-list.el
@@ -56,6 +56,29 @@ a symbol, it should be unquoted.."
(mouse-set-point event)
(call-interactively #',command))))
+;;;; Types
+
+(defclass ement-room-list-section (magit-section)
+ ;; We define this class so we can use it as the type of section we insert,
so we can
+ ;; define a method to return identifiers for our section type, so section
visibility can
+ ;; be cached concisely (i.e. without storing room event data in the values,
which can
+ ;; serialize to hundreds of megabytes after receiving many events).
+ nil)
+
+(cl-defmethod magit-section-ident-value ((section ement-room-list-section))
+ ;; FIXME: The name of each taxy could be ambiguous. Best would be to use the
+ ;; hierarchical path, but since the taxys aren't doubly linked, that isn't
easily done.
+ ;; Could probably be worked around by binding a special variable around the
creation of
+ ;; the taxy hierarchy that would allow the path to be saved into each taxy.
+ (pcase-exhaustive (oref section value)
+ ((and (cl-type taxy-magit-section) it)
+ (taxy-name it))
+ (`[,(and (cl-type ement-room) room)
+ ,(and (cl-type ement-session) session)]
+ (vector (ement-user-id (ement-session-user session))
+ (ement-room-id room)))
+ ((pred null) nil)))
+
;;;; Variables
(declare-function ement-room-toggle-space "ement-room")
@@ -687,7 +710,7 @@ DISPLAY-BUFFER-ACTION is nil, the buffer is not displayed."
(save-excursion
(taxy-magit-section-insert taxy :items 'first
;; :blank-between-depth bufler-taxy-blank-between-depth
- :initial-depth 0))
+ :initial-depth 0 :section-class 'ement-room-list-section))
(if-let* ((section-ident)
(section (magit-get-section section-ident)))
(goto-char (oref section start))
diff --git a/ement.el b/ement.el
index 687e43e57c..d788fcbb96 100644
--- a/ement.el
+++ b/ement.el
@@ -6,7 +6,7 @@
;; Maintainer: Adam Porter <adam@alphapapa.net>
;; URL: https://github.com/alphapapa/ement.el
;; Version: 0.14-pre
-;; Package-Requires: ((emacs "27.1") (map "2.1") (persist "0.5") (plz "0.6")
(taxy "0.10") (taxy-magit-section "0.12.1") (svg-lib "0.2.5") (transient
"0.3.7"))
+;; Package-Requires: ((emacs "27.1") (map "2.1") (persist "0.5") (plz "0.6")
(taxy "0.10") (taxy-magit-section "0.13") (svg-lib "0.2.5") (transient "0.3.7"))
;; Keywords: comm
;; This program is free software; you can redistribute it and/or modify