From: Noam Postavsky <npostavs@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: 40338@debbugs.gnu.org
Subject: bug#40338: 27.0.60; c-fill-paragraph and after-change-functions
Date: Mon, 30 Mar 2020 21:56:56 -0400 [thread overview]
Message-ID: <87lfnhi8wn.fsf@gmail.com> (raw)
In-Reply-To: <A1AE86DE-CBAD-4347-88D0-FB08E9B422B8@gmail.com> (Yuan Fu's message of "Mon, 30 Mar 2020 21:27:33 -0400")
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))))
next prev parent reply other threads:[~2020-03-31 1:56 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 [this message]
2020-03-31 15:27 ` Yuan Fu
2020-03-31 17:09 ` bug#40338: Fwd: " Yuan Fu
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=87lfnhi8wn.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=40338@debbugs.gnu.org \
--cc=casouri@gmail.com \
/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.