[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/crdt e4493e5 13/18: bug fix for comint integration
From: |
ELPA Syncer |
Subject: |
[elpa] externals/crdt e4493e5 13/18: bug fix for comint integration |
Date: |
Thu, 9 Sep 2021 12:57:13 -0400 (EDT) |
branch: externals/crdt
commit e4493e5a0d8a9ccfd091dc33c7a649caa15bc525
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>
bug fix for comint integration
input ring history
---
crdt.el | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/crdt.el b/crdt.el
index f5c12c0..a8f8ecb 100644
--- a/crdt.el
+++ b/crdt.el
@@ -2335,7 +2335,7 @@ Stop allowing remote calls to FUNCTION-SYMBOL."
;;; Buffer local variables
-(defvar crdt-variables nil)
+(defvar-local crdt-variables nil)
(cl-defun crdt--send-variables-maybe (&optional (incremental t))
(dolist (var crdt-variables)
@@ -2464,17 +2464,22 @@ The result DIFF can be used in (CRDT--NAPPLY-DIFF OLD
DIFF) to reproduce NEW."
(defvar crdt-variable-scheme-diff-server (cons
#'crdt--diff-server-variable-sender #'crdt--diff-server-variable-receiver))
+(defun crdt-register-variable (variable scheme)
+ (add-to-list 'crdt-variables variable)
+ (put variable 'crdt-variable-scheme
+ (if (symbolp scheme) (symbol-value scheme) scheme)))
+
+(defun crdt-unregister-variable (variable)
+ (delq variable crdt-variables)
+ (cl-remprop variable 'crdt-variable-scheme))
+
(defun crdt-register-variables (variable-entries)
(dolist (entry variable-entries)
- (cl-destructuring-bind (var scheme) entry
- (cl-pushnew var crdt-variables)
- (put var 'crdt-variable-scheme (symbol-value scheme)))))
+ (apply #'crdt-register-variable entry)))
(defun crdt-unregister-variables (variable-entries)
(dolist (entry variable-entries)
- (cl-destructuring-bind (var _scheme) entry
- (delq var crdt-variables)
- (cl-remprop var 'crdt-variable-scheme))))
+ (crdt-unregister-variable (car entry))))
;;; Built-in package integrations
@@ -2518,12 +2523,7 @@ The result DIFF can be used in (CRDT--NAPPLY-DIFF OLD
DIFF) to reproduce NEW."
'((comint-send-input (point) (point))
(comint-send-region (region) (region))))
-;; We also synchronize some buffer local variables to improve client side
completion.
-(defvar crdt-comint-variable-entries
- '((comint-input-ring crdt-variable-scheme-diff-server)))
-
(crdt-register-remote-commands crdt-comint-command-entries)
-(crdt-register-variables crdt-comint-variable-entries)
(defcustom crdt-comint-share-input-history 'censor
"Share comint input history.
@@ -2535,6 +2535,9 @@ Merge with history generated before the session after the
buffer is no longer sh
(defvar-local crdt--comint-saved-input-ring nil)
(defun crdt--merge-ring (old-ring delta-ring nodups)
+ "Construct a new ring by merging OLD-RING and DELTA-RING.
+If NODUPS is non-nil, don't duplicate existing items in OLD-RING.
+This procedure is non-destructive."
(if delta-ring
(let ((old-ring (copy-tree old-ring t)))
(cl-loop for i from (1- (ring-length delta-ring)) downto 0
@@ -2544,7 +2547,8 @@ Merge with history generated before the session after the
buffer is no longer sh
(when index
(ring-remove old-ring index))
(ring-insert old-ring item))
- (ring-insert old-ring item))))
+ (ring-insert old-ring item)))
+ old-ring)
old-ring))
(defsubst crdt--comint-effective-ring ()
@@ -2559,7 +2563,14 @@ Merge with history generated before the session after
the buffer is no longer sh
(add-to-list 'crdt--enabled-text-properties 'field)
(add-to-list 'crdt--enabled-text-properties 'front-sticky)
(add-to-list 'crdt--enabled-text-properties 'rear-nonsticky)
- (cl-shiftf crdt--comint-saved-input-ring comint-input-ring
(make-ring comint-input-ring-size)))
+ (if (crdt--server-p)
+ (when crdt-comint-share-input-history
+ (crdt-register-variable 'comint-input-ring
crdt-variable-scheme-diff-server)
+ (when (eq crdt-comint-share-input-history 'censor)
+ (cl-shiftf crdt--comint-saved-input-ring comint-input-ring
+ (make-ring comint-input-ring-size))))
+ (crdt-register-variable 'comint-input-ring
crdt-variable-scheme-diff-server)
+ (setq comint-input-ring-file-name nil)))
(setq comint-input-ring (crdt--comint-effective-ring)
crdt--comint-saved-input-ring nil))))
- [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 <=
- [elpa] externals/crdt 52cbf50 15/18: autoload; fix bug for cmuscheme, ELPA Syncer, 2021/09/09
- [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