unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* before-change-functions: Getting the changed text?
@ 2017-10-02 13:14 Vibhav Pant
  2017-10-02 14:57 ` Phillip Lord
  0 siblings, 1 reply; 2+ messages in thread
From: Vibhav Pant @ 2017-10-02 13:14 UTC (permalink / raw)
  To: emacs-devel@gnu.org

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

-- 
Vibhav Pant
vibhavp@gmail.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: before-change-functions: Getting the changed text?
  2017-10-02 13:14 before-change-functions: Getting the changed text? Vibhav Pant
@ 2017-10-02 14:57 ` Phillip Lord
  0 siblings, 0 replies; 2+ messages in thread
From: Phillip Lord @ 2017-10-02 14:57 UTC (permalink / raw)
  To: Vibhav Pant; +Cc: emacs-devel@gnu.org


Vibhav Pant <vibhavp@gmail.com> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-02 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 13:14 before-change-functions: Getting the changed text? Vibhav Pant
2017-10-02 14:57 ` Phillip Lord

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).