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

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

[elpa] externals/lentic 621671d1a7 269/333: Garbage Collects configs on


From: ELPA Syncer
Subject: [elpa] externals/lentic 621671d1a7 269/333: Garbage Collects configs on init.
Date: Tue, 27 Feb 2024 13:00:43 -0500 (EST)

branch: externals/lentic
commit 621671d1a7b7583872127282f38f5e179a7289ed
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>

    Garbage Collects configs on init.
    
    We now garbage collect old config objects when attempting to initialize
    all buffers. Previously, if a lentic had already been created,
    subsequent creations required forcing even if all the config objects
    were pointing to killed buffers. We now clean these out first.
---
 lentic-mode.el |  1 +
 lentic.el      | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lentic-mode.el b/lentic-mode.el
index 4e9de58a18..931bbefa2f 100644
--- a/lentic-mode.el
+++ b/lentic-mode.el
@@ -110,6 +110,7 @@ Lentics are listed in the same order as in fundamental
 ;;;###autoload
 (defun lentic-mode-create-from-init (&optional force)
   (interactive "P")
+  (lentic-garbage-collect-config)
   (if (and lentic-config (not force))
       (message "Already initialized. C-u to force.")
     (let ((before (length lentic-config))
diff --git a/lentic.el b/lentic.el
index 20e7a670e5..c777f2fe53 100644
--- a/lentic.el
+++ b/lentic.el
@@ -682,14 +682,22 @@ SEEN-BUFFER is a list of buffers to ignore."
            (funcall fn that)
            (lentic-each that fn seen-buffer))))
      lentic-config)))
-;; #+end_src
 
+(defun lentic-garbage-collect-config ()
+  "Remove non-live configs in current-buffer."
+  (setq lentic-config
+        (--filter
+         (buffer-live-p
+          (lentic-that it))
+         lentic-config)))
+;; #+end_src
 
 ;; *** Initialisation
 
 ;; #+begin_src emacs-lisp
 (defun lentic-ensure-init ()
   "Ensure that the `lentic-init' has been run."
+  (lentic-garbage-collect-config)
   (setq lentic-config
         ;; and attach to lentic-config
         (-concat



reply via email to

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