emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: before-change-functions: Getting the changed text?


From: Phillip Lord
Subject: Re: before-change-functions: Getting the changed text?
Date: Mon, 02 Oct 2017 15:57:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Vibhav Pant <address@hidden> writes:

> Is is possible to retrieve the newly changed text string in a
> before-change-functions hook? This is an issue with lsp-mode, where we need 
> the
> line and column numbers of the old text in order to signal changes in files to
> the language server: https://github.com/emacs-lsp/lsp-mode/issues/114


Yep, because before-change-functions are called before the change. So,
you just get the text that is in the buffer.

You cannot get what the buffer is going to look like after the change
until it has changed. If you need both pieces of information, you have
to store it somewhere before, and then use it after.

Phil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]