GNU bug report logs - #70396
30.0.50; Eglot, rust-analyzer buffer formatting, and track changes errors

Previous Next

Package: emacs;

Reported by: Steven Allen <steven <at> stebalien.com>

Date: Mon, 15 Apr 2024 13:37:06 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 70396 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Steven Allen <steven <at> stebalien.com>
Cc: 70396 <at> debbugs.gnu.org
Subject: Re: bug#70396: 30.0.50; Eglot, rust-analyzer buffer formatting, and
 track changes errors
Date: Mon, 15 Apr 2024 16:01:21 -0400
>> * Track changes errors (below).
>> * An `args-out-of-range` error in `replace-buffer-contents`.
>>
>> To reproduce:
>>
>> 1. Checkout `https://github.com/Stebalien/xattr/`. I can try for a
>>    minimal reproducer if necessary.
>> 2. Install rust-analyzer.
>> 2. Run `emacs -Q`
>> 3. `M-x find-file "src/sys/linux_macos.rs"`
>>    (https://github.com/Stebalien/xattr/blob/master/src/sys/linux_macos.rs).
>> 4. `M-x rust-ts-mode`
>> 5. `M-x eglot`
>> 6. `M-x eglot-format-buffer`

I could reproduce this in a C mode buffer (and hence save me the
trouble of installing more tools).
I pushed the patch below to `master` which should fix the problem.
Can you confirm it's fixed in your side as well?


        Stefan


diff --git a/lisp/emacs-lisp/track-changes.el b/lisp/emacs-lisp/track-changes.el
index 1bab7ca38fd..df4aad0d596 100644
--- a/lisp/emacs-lisp/track-changes.el
+++ b/lisp/emacs-lisp/track-changes.el
@@ -481,12 +481,12 @@
                 (funcall signal-if-disjoint end track-changes--before-beg)
               (funcall signal-if-disjoint track-changes--before-end beg)))
           (funcall reset))
-      (cl-assert (save-restriction
+      (save-restriction
                    (widen)
-                   (<= (point-min)
+        (cl-assert (<= (point-min)
                        track-changes--before-beg
                        track-changes--before-end
-                       (point-max))))
+                       (point-max)))
       (when (< beg track-changes--before-beg)
         (if (and track-changes--disjoint-trackers
                  (funcall signal-if-disjoint end track-changes--before-beg))
@@ -517,6 +517,6 @@
             (setf track-changes--before-end new-bend)
             (cl-callf concat track-changes--before-string
-              (buffer-substring-no-properties old-bend new-bend))))))))
+                (buffer-substring-no-properties old-bend new-bend)))))))))
 
 (defun track-changes--after (beg end len)
   (cl-assert track-changes--state)





This bug report was last modified 1 year and 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.