From: Yuan Fu <casouri@gmail.com>
To: 40338-done@debbugs.gnu.org
Subject: bug#40338: Fwd: bug#40338: 27.0.60; c-fill-paragraph and after-change-functions
Date: Tue, 31 Mar 2020 13:09:18 -0400 [thread overview]
Message-ID: <C1C8119A-0F9F-495D-B55E-F116575EAA60@gmail.com> (raw)
In-Reply-To: <A1AE86DE-CBAD-4347-88D0-FB08E9B422B8@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]
> Begin forwarded message:
>
> From: Yuan Fu <casouri@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@gmail.com>
> Cc: 40338@debbugs.gnu.org
>
>
>
>> On Mar 30, 2020, at 9:56 PM, Noam Postavsky <npostavs@gmail.com> wrote:
>>
>> Yuan Fu <casouri@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
[-- Attachment #2: Type: text/html, Size: 4570 bytes --]
prev parent reply other threads:[~2020-03-31 17:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 1:27 bug#40338: 27.0.60; c-fill-paragraph and after-change-functions Yuan Fu
2020-03-31 1:56 ` Noam Postavsky
2020-03-31 15:27 ` Yuan Fu
2020-03-31 17:09 ` Yuan Fu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C1C8119A-0F9F-495D-B55E-F116575EAA60@gmail.com \
--to=casouri@gmail.com \
--cc=40338-done@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.