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

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

[elpa] externals/crdt 20ff5b3 65/80: reenable crdt-mode and synchronize


From: ELPA Syncer
Subject: [elpa] externals/crdt 20ff5b3 65/80: reenable crdt-mode and synchronize after major mode change
Date: Sat, 28 Aug 2021 10:57:43 -0400 (EDT)

branch: externals/crdt
commit 20ff5b3308a7db57f23f5b34bfed15f95899b752
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>

    reenable crdt-mode and synchronize after major mode change
---
 crdt.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/crdt.el b/crdt.el
index 6f35306..83895c6 100644
--- a/crdt.el
+++ b/crdt.el
@@ -369,6 +369,18 @@ Also set CRDT--PSEUDO-CURSOR-TABLE to NIL."
              crdt--pseudo-cursor-table)
     (setq crdt--pseudo-cursor-table nil)))
 
+(defun crdt--after-change-major-mode ()
+  "Re-enable CRDT-MODE after major mode change."
+  (when (and crdt--session crdt--buffer-network-name
+             (eq (current-buffer)
+                 (gethash crdt--buffer-network-name
+                          (crdt--session-buffer-table crdt--session))))
+    (crdt--broadcast-maybe
+     (crdt--format-message `(ready ,crdt--buffer-network-name ,major-mode)) 
nil)
+    (crdt-mode)))
+
+(add-hook 'after-change-major-mode-hook #'crdt--after-change-major-mode)
+
 (define-minor-mode crdt-mode
     "CRDT mode" nil " CRDT" nil
     (if crdt-mode



reply via email to

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