-1

Is there any function that would tell me what changes were made to buffer?

I know i can use change hooks to detect changes, but i can't find how to get output of changes.

More specifically I would try to detect if any changes were made for headlines under headline x, if so activate function y.

  • Your question is confusing. Can you please detail an example, showing the original text, and the specific types of changes which you are wanting to detect (and preferably also detailing the types of changes which you are not interested in, because the subject is quite broad and your requirement isn't clear), and exactly what information needs to be provided to the function you want to be called. – phils Dec 28 '18 at 5:03
1

Not clear exactly what you mean by "get output of changes".

Also "what changes were made to buffer" is necessarily relative to some point in time.

A common approach is to use an after-change-function where you somehow record the place(s) where changes occurred. Either by placing text-properties on the modified text, or by stashing in a buffer-local variable the start and end position of the first and last positions modified.

Another possibility is to look at the buffer-undo-list which records all the changes that occurred in order to be able to undo them later on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.