GNU bug report logs -
#40338
27.0.60; c-fill-paragraph and after-change-functions
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Tue, 31 Mar 2020 01:28:02 UTC
Severity: normal
Found in version 27.0.60
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 40338-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Begin forwarded message:
>
> From: Yuan Fu <casouri <at> gmail.com>
> Subject: Re: bug#40338: 27.0.60; c-fill-paragraph and after-change-functions
> Date: March 31, 2020 at 11:27:23 AM GMT-4
> To: Noam Postavsky <npostavs <at> gmail.com>
> Cc: 40338 <at> debbugs.gnu.org
>
>
>
>> On Mar 30, 2020, at 9:56 PM, Noam Postavsky <npostavs <at> gmail.com> wrote:
>>
>> Yuan Fu <casouri <at> gmail.com> writes:
>>
>>> (defun mytrack-hook (beg end len)
>>> (if (> len 0)
>>> ;; delete
>>> (with-current-buffer trackbuf
>>> (delete-region beg (+ beg len)))
>>> ;; insert
>>> (let ((content (buffer-substring beg end)))
>>> (with-current-buffer trackbuf
>>> (goto-char beg)
>>> (insert content)))))
>>
>> I'm not very familiar with either eglot or cc-mode, but I can say the
>> problem in your example lies with mytrack-hook: there can be kinds of
>> changes other than just pure delete or insert (replace, for example).
>> It can be fixed like this:
>>
>> (defun mytrack-hook (beg end len)
>> (when (> len 0)
>> ;; Delete old text.
>> (with-current-buffer "trackbuf"
>> (delete-region beg (+ beg len))))
>> ;; Insert new text.
>> (let ((content (buffer-substring beg end)))
>> (with-current-buffer "trackbuf"
>> (goto-char beg)
>> (insert content))))
>>
>
> Thank you. Indeed this works. Maybe the problem is not in c-fill-paragraph.
>
> Yuan
[Message part 2 (text/html, inline)]
This bug report was last modified 5 years and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.