Skip to content
Snippets Groups Projects
Commit 5719de1c authored by Jimmy Miller's avatar Jimmy Miller
Browse files

Check if the process-mark is non-nil and if mark-pos is non-nil to prevent errors

parent c427979e
No related branches found
No related tags found
1 merge request!1Check if the process-mark is non-nil and if mark-pos is non-nil to prevent errors
......@@ -2596,14 +2596,17 @@ The result DIFF can be used in (CRDT--NAPPLY-DIFF OLD DIFF) to reproduce NEW."
(cl-defun crdt--send-process-mark-maybe (&optional (lazy t))
(let ((buffer-process (get-buffer-process (current-buffer))))
(when buffer-process
(let* ((mark-pos (marker-position (process-mark buffer-process)))
(current-id (crdt--get-id mark-pos)))
(unless (and lazy (string-equal crdt--last-process-mark-id current-id))
(setq crdt--last-process-mark-id current-id)
(crdt--broadcast-maybe
(crdt--format-message
`(process-mark ,crdt--buffer-network-name
,current-id ,mark-pos))))))))
(let* ((mark (process-mark buffer-process)))
(when mark
(let* ((mark-pos (marker-position mark)))
(when mark-pos
(let* ((current-id (crdt--get-id mark-pos)))
(unless (and lazy (string-equal crdt--last-process-mark-id current-id))
(setq crdt--last-process-mark-id current-id)
(crdt--broadcast-maybe
(crdt--format-message
`(process-mark ,crdt--buffer-network-name
,current-id ,mark-pos))))))))))))
(defun crdt--process-status-advice (orig-func process)
(if (crdt--pseudo-process-p process)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment