emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ement 6657789e12 1/2: Add: (ement-room-list-visibility-


From: ELPA Syncer
Subject: [elpa] externals/ement 6657789e12 1/2: Add: (ement-room-list-visibility-cache)
Date: Tue, 14 Mar 2023 10:57:51 -0400 (EDT)

branch: externals/ement
commit 6657789e12fff37949ec7e47c249a1b72bab42c4
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Add: (ement-room-list-visibility-cache)
---
 README.org         |  1 +
 ement-room-list.el | 18 ++++++++++++++++++
 ement.el           |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 5aea5d83c8..b13bba5e9a 100644
--- a/README.org
+++ b/README.org
@@ -297,6 +297,7 @@ Note that, while ~matrix-client~ remains usable, and 
probably will for some time
 
 *Additions*
 + Command ~ement-room-toggle-space~ toggles a room's membership in a space (a 
way to group rooms in Matrix).
++ Visibility of sections in the room list is saved across sessions.
 
 *Changes*
 
diff --git a/ement-room-list.el b/ement-room-list.el
index 7d2e3f0dc8..7e6392cca5 100644
--- a/ement-room-list.el
+++ b/ement-room-list.el
@@ -28,6 +28,7 @@
 (require 'button)
 (require 'rx)
 
+(require 'persist)
 (require 'svg-lib)
 (require 'taxy)
 (require 'taxy-magit-section)
@@ -58,6 +59,11 @@ Set automatically when `ement-room-list-mode' is activated.")
 (defvar ement-sessions)
 (defvar ement-room-prism-minimum-contrast)
 
+;;;;; Persistent variables
+
+(persist-defvar ement-room-list-visibility-cache nil
+                "Applied to `magit-section-visibility-cache', which see.")
+
 ;;;; Customization
 
 (defcustom ement-room-list-auto-update t
@@ -598,6 +604,9 @@ DISPLAY-BUFFER-ACTION is nil, the buffer is not displayed."
                 window-start (if (get-buffer-window buffer-name)
                                  (window-start (get-buffer-window buffer-name))
                                0))
+          (when ement-room-list-visibility-cache
+            (setf magit-section-visibility-cache 
ement-room-list-visibility-cache))
+          (add-hook 'kill-buffer-hook #'ement-room-list--cache-visibility nil 
'local)
           (delete-all-overlays)
           (erase-buffer)
           (save-excursion
@@ -681,6 +690,15 @@ left."
 
 ;;;; Functions
 
+(defun ement-room-list--cache-visibility ()
+  "Save visibility cache.
+Sets `ement-room-list-visibility-cache' to the value of
+`magit-section-visibility-cache'.  To be called in
+`kill-buffer-hook'."
+  (ignore-errors
+    (when magit-section-visibility-cache
+      (setf ement-room-list-visibility-cache magit-section-visibility-cache))))
+
 ;;;###autoload
 (defun ement-room-list-auto-update (_session)
   "Automatically update the Taxy room list buffer.
diff --git a/ement.el b/ement.el
index c22917cf5a..4ed698e7c6 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.8-pre
-;; Package-Requires: ((emacs "27.1") (map "2.1") (plz "0.2") (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.2") 
(taxy "0.10") (taxy-magit-section "0.12.1") (svg-lib "0.2.5") (transient 
"0.3.7"))
 ;; Keywords: comm
 
 ;; This program is free software; you can redistribute it and/or modify



reply via email to

[Prev in Thread] Current Thread [Next in Thread]