[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/crdt 52cbf50 15/18: autoload; fix bug for cmuscheme
From: |
ELPA Syncer |
Subject: |
[elpa] externals/crdt 52cbf50 15/18: autoload; fix bug for cmuscheme |
Date: |
Thu, 9 Sep 2021 12:57:13 -0400 (EDT) |
branch: externals/crdt
commit 52cbf50ed7b6dc268ef92598053d14f8df6bc09b
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>
autoload; fix bug for cmuscheme
---
crdt.el | 69 +++++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 41 insertions(+), 28 deletions(-)
diff --git a/crdt.el b/crdt.el
index d690a04..52d8f73 100644
--- a/crdt.el
+++ b/crdt.el
@@ -459,15 +459,7 @@ Also set CRDT--PSEUDO-CURSOR-TABLE to NIL."
(widen)
(remove-overlays (point-min) (point-max) 'category
'crdt-visualize-author))))
-;;; Shared buffer utils
-
-(defsubst crdt--server-p (&optional session)
- "Tell if SESSION is running as a server.
-If SESSION is nil, use current CRDT--SESSION."
- (process-contact
- (crdt--session-network-process
- (or session crdt--session))
- :server))
+;;; Error recovery
(define-error 'crdt-sync-error "CRDT synchronization error")
@@ -497,6 +489,30 @@ NAME is included in the report."
(message "Killing the buffer because of error.")
(kill-buffer))))))
+(defun crdt--recover (&optional err)
+ "Try to recover from a synchronization failure.
+Current buffer is assmuned to be the one with synchronization error.
+If we are the server, ERR is the error we shall report to client."
+ (if (crdt--server-p)
+ (progn
+ (let ((message (crdt--format-message `(error
,crdt--buffer-network-name ,(car err) ,(crdt--readable-encode (cdr err))))))
+ (process-send-string crdt--process message)))
+ (ding)
+ (read-only-mode)
+ (message "Synchronization error detected, try recovering...")
+ (crdt--broadcast-maybe
+ (crdt--format-message `(get ,crdt--buffer-network-name)))))
+
+;;; Shared buffer utils
+
+(defsubst crdt--server-p (&optional session)
+ "Tell if SESSION is running as a server.
+If SESSION is nil, use current CRDT--SESSION."
+ (process-contact
+ (crdt--session-network-process
+ (or session crdt--session))
+ :server))
+
(defmacro crdt--with-buffer-name (name &rest body)
"Find CRDT shared buffer associated with NAME and evaluate BODY in it.
Any narrowing is temporarily disabled during evaluation of BODY.
@@ -1236,22 +1252,6 @@ Verify that CRDT IDs in a document follows ascending
order."
(setq pos next-pos)
(setq id next-id))))))
-;;; Recovery
-
-(defun crdt--recover (&optional err)
- "Try to recover from a synchronization failure.
-Current buffer is assmuned to be the one with synchronization error.
-If we are the server, ERR is the error we shall report to client."
- (if (crdt--server-p)
- (progn
- (let ((message (crdt--format-message `(error
,crdt--buffer-network-name ,(car err) ,(crdt--readable-encode (cdr err))))))
- (process-send-string crdt--process message)))
- (ding)
- (read-only-mode)
- (message "Synchronization error detected, try recovering...")
- (crdt--broadcast-maybe
- (crdt--format-message `(get ,crdt--buffer-network-name)))))
-
;;; Network protocol
(defun crdt--format-message (args)
@@ -1514,9 +1514,12 @@ CRDT--PROCESS should be bound to The network process for
the client connection."
(define-crdt-message-handler ready (buffer-name mode)
(unless (crdt--server-p) ; server shouldn't receive this
(crdt--with-buffer-name buffer-name
+ (unless (fboundp mode)
+ (when (get mode 'crdt-autoload)
+ (require (get mode 'crdt-autoload) nil t)))
(if (fboundp mode)
(unless (eq major-mode mode)
- (funcall mode) ; trust your server...
+ (funcall mode) ; trust your server...
(crdt-mode))
(message "Server uses %s, but not available locally." mode))
(when crdt--buffer-sync-callback
@@ -2181,6 +2184,12 @@ Join with DISPLAY-NAME."
(cl-loop for command in '(org-cycle org-shifttab)
do (advice-add command :around #'crdt--org-overlay-advice))
+;;; Auxillary autoload
+
+(defun crdt-register-autoload (mode feature)
+ "Register for autoloading FEATURE before CRDT enforce major MODE."
+ (put mode 'crdt-autoload feature))
+
;;; Remote Command
(defun crdt--assemble-state-list (states)
@@ -2470,8 +2479,7 @@ The result DIFF can be used in (CRDT--NAPPLY-DIFF OLD
DIFF) to reproduce NEW."
(if (symbolp scheme) (symbol-value scheme) scheme)))
(defun crdt-unregister-variable (variable)
- (delq variable crdt-variables)
- (cl-remprop variable 'crdt-variable-scheme))
+ (delq variable crdt-variables))
(defun crdt-register-variables (variable-entries)
(dolist (entry variable-entries)
@@ -2526,6 +2534,11 @@ The result DIFF can be used in (CRDT--NAPPLY-DIFF OLD
DIFF) to reproduce NEW."
(crdt-register-remote-commands crdt-comint-command-entries)
+(crdt-register-autoload 'shell-mode 'shell)
+(crdt-register-autoload 'inferior-scheme-mode 'cmuscheme)
+
+(put 'comint-input-ring 'crdt-variable-scheme crdt-variable-scheme-diff-server)
+
(defcustom crdt-comint-share-input-history 'censor
"Share comint input history.
If the value is censor,
- [elpa] externals/crdt updated (4797413 -> c1378c5), ELPA Syncer, 2021/09/09
- [elpa] externals/crdt f9a7ec9 01/18: update header, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt dcf1dd5 02/18: Update version number, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 605d8fa 07/18: initial experiment of xscheme.el integration, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt b6bcc8b 03/18: Merge branch 'master' into development, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt cc37dcd 04/18: add description of bridge protocol, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt bf1dc5d 09/18: typo, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt e4493e5 13/18: bug fix for comint integration, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 52cbf50 15/18: autoload; fix bug for cmuscheme,
ELPA Syncer <=
- [elpa] externals/crdt 3f6f566 11/18: lots of changes, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 38476da 05/18: Merge branch 'fix' into development, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt c08e21d 06/18: Refactors and remote command, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 936418c 14/18: Synchronize text property on changes, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt e175d65 08/18: Remote command, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 6b85d8a 10/18: refactor, replace cl-generic with hashtable of handlers, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt d7bc982 12/18: update README, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt 40bd5d4 16/18: document, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt b11bbc0 17/18: some more autoloads, ELPA Syncer, 2021/09/09
- [elpa] externals/crdt c1378c5 18/18: Merge branch 'development', ELPA Syncer, 2021/09/09