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

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

[elpa] externals/activities 20ef360aa3 3/3: Merge: (activities--windows-


From: ELPA Syncer
Subject: [elpa] externals/activities 20ef360aa3 3/3: Merge: (activities--windows-set) Fix race condition
Date: Tue, 9 Jul 2024 21:57:44 -0400 (EDT)

branch: externals/activities
commit 20ef360aa341ed0332b7d8c21fc2a9d666977c86
Merge: 65bfb6f7f2 8d54734006
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Merge: (activities--windows-set) Fix race condition
    
    Closes #98.
---
 README.org    |  3 ++-
 activities.el | 26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/README.org b/README.org
index d1cce16e70..6d9de36755 100644
--- a/README.org
+++ b/README.org
@@ -153,7 +153,8 @@ When option ~activities-bookmark-store~ is enabled, an 
Emacs bookmark is stored
 
 ** v0.8-pre
 
-Nothing new yet.
+*Fixes*
++ Race condition when restoring multiple activities in rapid succession from 
user code.  ([[https://github.com/alphapapa/activity.el/pull/98][#98]].  Thanks 
to [[https://github.com/jdtsmith][JD Smith]].)
 
 ** v0.7
 
diff --git a/activities.el b/activities.el
index a03e2809de..b204199af1 100644
--- a/activities.el
+++ b/activities.el
@@ -250,8 +250,7 @@ discarded, such a bookmark could become stale."
         (cons 'window-side 'writable)
         (cons 'window-slot 'writable))
   "Additional window parameters to persist.
-See Info node `(elisp)Window Parameters'.  See also option
-`activities-set-window-persistent-parameters'."
+See Info node `(elisp)Window Parameters'."
   :type '(alist :key-type (symbol :tag "Window parameter")
                 :value-type (choice (const :tag "Not saved" nil)
                                     (const :tag "Saved" writable))))
@@ -639,17 +638,18 @@ activity's name is NAME."
 
 (defun activities--windows-set (state)
   "Set window configuration according to STATE."
-  (setf window-persistent-parameters (copy-sequence 
activities-window-persistent-parameters))
-  (pcase-let* ((window-persistent-parameters (append 
activities-window-persistent-parameters
-                                                     
window-persistent-parameters))
-               (state
-                ;; NOTE: We copy the state so as not to mutate the one in 
storage.
-                (activities--bufferize-window-state (copy-tree state))))
-    ;; HACK: Since `bookmark--jump-via' insists on calling a buffer-display
-    ;; function after handling the bookmark, we use an immediate timer to
-    ;; set the window configuration.
-    (run-at-time nil nil (lambda ()
-                           (window-state-put state (frame-root-window) 
'safe)))))
+  ;; HACK: Since `bookmark--jump-via' insists on calling a buffer-display
+  ;; function after handling the bookmark, we use an immediate timer to
+  ;; set the window configuration.
+  (run-at-time nil nil
+              (lambda (frame state)
+                (let ((window-persistent-parameters
+                       (append activities-window-persistent-parameters
+                               window-persistent-parameters)))
+                  (window-state-put state (frame-root-window frame) 'safe)))
+              (selected-frame)
+              ;; NOTE: We copy the state so as not to mutate the one in 
storage.
+              (activities--bufferize-window-state (copy-tree state))))
 
 (defun activities--bufferize-window-state (state)
   "Return window state STATE with its buffers reincarnated."



reply via email to

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