[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How can I undo a change from a modification-hook?
From: |
Clément Pit--Claudel |
Subject: |
How can I undo a change from a modification-hook? |
Date: |
Wed, 26 Apr 2017 03:02:24 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Hey emacs-devel,
I'm using overlays to keep track of buffer regions that have been sent to a
subprocess. Edits in a previously sent ("processed") region are generally
forbidden — the only two permissible kinds of changes in processed regions are
editing a comment and adding or removing of space at the end of a line.
Adding a modification-hook to my overlays makes it easy to disallow changes (by
raising an error), and to allow changes when in a comment. I can't find a good
way to allow whitespace edits at the end of a line, though. I can detect such
changes from the second call to the modification hook (during which it's easy
to know whether the change is only adding or removing space at the end of a
line), but I can't easily undo the changes and error out if they involve more
than whitespace, can I?
What's the right way do disallow certain modifications in text covered by an
overlay, in particular when the determination of whether to allow a given
modification cannot be made during the first call to the overlay's modification
hook? For example, how can I make an overlay that allows insertion or deletion
of space at the end of the lines that it covers, but no other modifications?
Thanks!
Clément.
smime.p7s
Description: S/MIME Cryptographic Signature
- How can I undo a change from a modification-hook?,
Clément Pit--Claudel <=
- Re: How can I undo a change from a modification-hook?, Stefan Monnier, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Clément Pit-Claudel, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Stefan Monnier, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Clément Pit-Claudel, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Stefan Monnier, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Clément Pit-Claudel, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Stefan Monnier, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Clément Pit-Claudel, 2017/04/26
- Re: How can I undo a change from a modification-hook?, Stefan Monnier, 2017/04/27
- Re: How can I undo a change from a modification-hook?, Clément Pit-Claudel, 2017/04/27