summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-03-19 01:03:47 +0000
committerJoão Távora <joaotavora@gmail.com>2023-03-19 19:53:48 +0000
commit61d571760b3342c25a767c92da88ca7940156374 (patch)
tree4e94637b48f37af76048629cc31aefd27eeba1a7
parent5bbbd70f56e703a18a28666cf12b28e02ffc241f (diff)
downloademacs-61d571760b3342c25a767c92da88ca7940156374.tar.gz
; Clarify in-code commentary of eglot--after-change
* lisp/progmodes/eglot.el (eglot--after-change): Minor clarification to commentary.
-rw-r--r--lisp/progmodes/eglot.el30
1 files changed, 14 insertions, 16 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index ccae764c130..dbd3eff67d1 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2375,25 +2375,23 @@ THINGS are either registrations or unregisterations (sic)."
"Hook onto `after-change-functions'.
Records BEG, END and PRE-CHANGE-LENGTH locally."
(cl-incf eglot--versioned-identifier)
- (pcase (and (listp eglot--recent-changes)
- (car eglot--recent-changes))
+ (pcase (car-safe eglot--recent-changes)
(`(,lsp-beg ,lsp-end
(,b-beg . ,b-beg-marker)
(,b-end . ,b-end-marker))
- ;; github#259 and github#367: With `capitalize-word' or somesuch,
- ;; `before-change-functions' always records the whole word's
- ;; `b-beg' and `b-end'. Similarly, when coalescing two lines
- ;; into one, `fill-paragraph' they mark the end of the first line
- ;; up to the end of the second line. In both situations, args
- ;; received here contradict that information: `beg' and `end'
- ;; will differ by 1 and will likely only encompass the letter
- ;; that was capitalized or, in the sentence-joining situation,
- ;; the replacement of the newline with a space. That's we keep
- ;; markers _and_ positions so we're able to detect and correct
- ;; this. We ignore `beg', `len' and `pre-change-len' and send
- ;; "fuller" information about the region from the markers. I've
- ;; also experimented with doing this unconditionally but it seems
- ;; to break when newlines are added.
+ ;; github#259 and github#367: with `capitalize-word' & friends,
+ ;; `before-change-functions' records the whole word's `b-beg' and
+ ;; `b-end'. Similarly, when `fill-paragraph' coalesces two
+ ;; lines, `b-beg' and `b-end' mark end of first line and end of
+ ;; second line, resp. In both situations, `beg' and `end'
+ ;; received here seemingly contradict that: they will differ by 1
+ ;; and encompass the capitalized character or, in the coalescing
+ ;; case, the replacement of the newline with a space. We keep
+ ;; both markers and positions to detect and correct this. In
+ ;; this specific case, we ignore `beg', `len' and
+ ;; `pre-change-len' and send richer information about the region
+ ;; from the markers. I've also experimented with doing this
+ ;; unconditionally but it seems to break when newlines are added.
(if (and (= b-end b-end-marker) (= b-beg b-beg-marker)
(or (/= beg b-beg) (/= end b-end)))
(setcar eglot--recent-changes