[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/crdt b5a8a28 71/80: Don't enable buffer process related
From: |
ELPA Syncer |
Subject: |
[elpa] externals/crdt b5a8a28 71/80: Don't enable buffer process related advices by default. |
Date: |
Sat, 28 Aug 2021 10:57:44 -0400 (EDT) |
branch: externals/crdt
commit b5a8a28cf673aaeb0308610cb4d5163242d23554
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>
Don't enable buffer process related advices by default.
---
crdt.el | 59 ++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/crdt.el b/crdt.el
index 86e31fb..5169a42 100644
--- a/crdt.el
+++ b/crdt.el
@@ -864,6 +864,11 @@ Start the search around POSITION-HINT."
;; (crdt--verify-buffer)
)
+(defsubst crdt--changed-string (beg length)
+ "Retrieve part of CRDT--CHANGED-STRING starting at BEG with LENGTH before
change."
+ (let ((from (- beg crdt--changed-start)))
+ (substring crdt--changed-string from (+ from length))))
+
(defun crdt--local-delete (beg end length)
"Handle local deletion event and return a message to be sent to other peers.
The deletion happens between BEG and END, and have LENGTH."
@@ -918,11 +923,6 @@ It saves the content to be changed (between BEG and END)
into CRDT--CHANGED-STRI
(setq crdt--changed-string (buffer-substring beg end))
(setq crdt--changed-start beg)))
-(defsubst crdt--changed-string (beg length)
- "Retrieve part of CRDT--CHANGED-STRING starting at BEG with LENGTH before
change."
- (let ((from (- beg crdt--changed-start)))
- (substring crdt--changed-string from (+ from length))))
-
(defsubst crdt--crdt-id-assimilate (template beg &optional object)
"Make the CRDT-ID property after BEG in OBJECT the same as TEMPLATE.
TEMPLATE should be a string. If OBJECT is NIL, use current buffer."
@@ -1944,7 +1944,7 @@ Join with DISPLAY-NAME."
(invalid-read-syntax)))))))
(funcall orig-fun ov prop value)))
-(cl-defmethod crdt-process-message ((message (head overlay-put)) process)
+(cl-defmethod crdt-process-message ((message (head overlay-put)) _process)
(cl-destructuring-bind (buffer-name site-id logical-clock prop value) (cdr
message)
(crdt--with-buffer-name
buffer-name
@@ -2034,7 +2034,7 @@ Join with DISPLAY-NAME."
process
(funcall orig-func process)))
-(cl-defmethod crdt-process-message ((message (head process-mark)) process)
+(cl-defmethod crdt-process-message ((message (head process-mark)) _process)
(cl-destructuring-bind (buffer-name crdt-id position-hint) (cdr message)
(crdt--with-buffer-name
buffer-name
@@ -2091,22 +2091,35 @@ Join with DISPLAY-NAME."
nil
(funcall orig-func process func)))
-(advice-add 'process-send-string :around #'crdt--process-send-string-advice)
-(advice-add 'process-send-region :around #'crdt--process-send-region-advice)
-(advice-add 'processp :around #'crdt--processp-advice)
-(advice-add 'get-buffer-process :around #'crdt--get-buffer-process-advice)
-(advice-add 'get-process :around #'crdt--get-process-advice)
-(advice-add 'process-status :around #'crdt--process-status-advice)
-(advice-add 'process-buffer :around #'crdt--process-buffer-advice)
-(advice-add 'process-mark :around #'crdt--process-mark-advice)
-(advice-add 'delete-process :around #'crdt--delete-process-advice)
-(advice-add 'process-name :around #'crdt--process-name-advice)
-(advice-add 'process-sentinel :around #'crdt--process-sentinel/filter-advice)
-(advice-add 'process-filter :around #'crdt--process-sentinel/filter-advice)
-(advice-add 'set-process-sentinel :around
#'crdt--set-process-sentinel/filter-advice)
-(advice-add 'set-process-filter :around
#'crdt--set-process-sentinel/filter-advice)
-
-(cl-defmethod crdt-process-message ((message (head process)) process)
+(defvar crdt--process-advice-alist
+ '((process-send-string . crdt--process-send-string-advice)
+ (process-send-region . crdt--process-send-region-advice)
+ (processp . crdt--processp-advice)
+ (get-buffer-process . crdt--get-buffer-process-advice)
+ (get-process . crdt--get-process-advice)
+ (process-status . crdt--process-status-advice)
+ (process-buffer . crdt--process-buffer-advice)
+ (process-mark . crdt--process-mark-advice)
+ (delete-process . crdt--delete-process-advice)
+ (process-name . crdt--process-name-advice)
+ (process-sentinel . crdt--process-sentinel/filter-advice)
+ (process-filter . crdt--process-sentinel/filter-advice)
+ (set-process-sentinel . crdt--set-process-sentinel/filter-advice)
+ (set-process-filter . crdt--set-process-sentinel/filter-advice)))
+
+(defun crdt--install-process-advices ()
+ "Globally enable advices for simulating remote buffer process.
+We don't install them by default because those advices sometimes seem to
interfere with other packages."
+ (mapcar (lambda (pair)
+ (advice-add (car pair) :around (cdr pair)))
+ crdt--process-advice-alist))
+
+(defun crdt--uninstall-process-advices ()
+ (mapcar (lambda (pair)
+ (advice-remove (car pair) (cdr pair)))
+ crdt--process-advice-alist))
+
+(cl-defmethod crdt-process-message ((message (head process)) _process)
(cl-destructuring-bind (buffer-name string) (cdr message)
(crdt--with-buffer-name
buffer-name
- [elpa] externals/crdt 1a08765 51/80: slightly cleanup protocol and doc, (continued)
- [elpa] externals/crdt 1a08765 51/80: slightly cleanup protocol and doc, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt efdafb9 52/80: fix bug on emacs 25, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 8457254 47/80: fix cursor movement when remote insert/delete, add URL parsing, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 817c265 49/80: fix document, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt bdada96 57/80: Disconnect user command for the server, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 7c9d7ee 64/80: avoid spitting error when POSITION-HINT out of range, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt dc72997 66/80: add mouse alias for RETs in menus, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 2889cae 67/80: change order of READY and OVERLAY-* during initial sync. not sure if this creates more problem, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 93af8b0 68/80: PoC visualize author, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 7875e6a 70/80: remove family for ipv6, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt b5a8a28 71/80: Don't enable buffer process related advices by default.,
ELPA Syncer <=
- [elpa] externals/crdt 96fbbf3 73/80: Change my email to the permanent one., ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 6363427 79/80: Add indentation and debugging information to macros, ELPA Syncer, 2021/08/28