mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-18 09:55:42 +00:00
; Clarify in-code commentary of eglot--after-change
* lisp/progmodes/eglot.el (eglot--after-change): Minor clarification to commentary.
This commit is contained in:
parent
5bbbd70f56
commit
61d571760b
1 changed files with 14 additions and 16 deletions
|
@ -2375,25 +2375,23 @@ THINGS are either registrations or unregisterations (sic)."
|
||||||
"Hook onto `after-change-functions'.
|
"Hook onto `after-change-functions'.
|
||||||
Records BEG, END and PRE-CHANGE-LENGTH locally."
|
Records BEG, END and PRE-CHANGE-LENGTH locally."
|
||||||
(cl-incf eglot--versioned-identifier)
|
(cl-incf eglot--versioned-identifier)
|
||||||
(pcase (and (listp eglot--recent-changes)
|
(pcase (car-safe eglot--recent-changes)
|
||||||
(car eglot--recent-changes))
|
|
||||||
(`(,lsp-beg ,lsp-end
|
(`(,lsp-beg ,lsp-end
|
||||||
(,b-beg . ,b-beg-marker)
|
(,b-beg . ,b-beg-marker)
|
||||||
(,b-end . ,b-end-marker))
|
(,b-end . ,b-end-marker))
|
||||||
;; github#259 and github#367: With `capitalize-word' or somesuch,
|
;; github#259 and github#367: with `capitalize-word' & friends,
|
||||||
;; `before-change-functions' always records the whole word's
|
;; `before-change-functions' records the whole word's `b-beg' and
|
||||||
;; `b-beg' and `b-end'. Similarly, when coalescing two lines
|
;; `b-end'. Similarly, when `fill-paragraph' coalesces two
|
||||||
;; into one, `fill-paragraph' they mark the end of the first line
|
;; lines, `b-beg' and `b-end' mark end of first line and end of
|
||||||
;; up to the end of the second line. In both situations, args
|
;; second line, resp. In both situations, `beg' and `end'
|
||||||
;; received here contradict that information: `beg' and `end'
|
;; received here seemingly contradict that: they will differ by 1
|
||||||
;; will differ by 1 and will likely only encompass the letter
|
;; and encompass the capitalized character or, in the coalescing
|
||||||
;; that was capitalized or, in the sentence-joining situation,
|
;; case, the replacement of the newline with a space. We keep
|
||||||
;; the replacement of the newline with a space. That's we keep
|
;; both markers and positions to detect and correct this. In
|
||||||
;; markers _and_ positions so we're able to detect and correct
|
;; this specific case, we ignore `beg', `len' and
|
||||||
;; this. We ignore `beg', `len' and `pre-change-len' and send
|
;; `pre-change-len' and send richer information about the region
|
||||||
;; "fuller" information about the region from the markers. I've
|
;; from the markers. I've also experimented with doing this
|
||||||
;; also experimented with doing this unconditionally but it seems
|
;; unconditionally but it seems to break when newlines are added.
|
||||||
;; to break when newlines are added.
|
|
||||||
(if (and (= b-end b-end-marker) (= b-beg b-beg-marker)
|
(if (and (= b-end b-end-marker) (= b-beg b-beg-marker)
|
||||||
(or (/= beg b-beg) (/= end b-end)))
|
(or (/= beg b-beg) (/= end b-end)))
|
||||||
(setcar eglot--recent-changes
|
(setcar eglot--recent-changes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue