Comments (8)
Here is some code that runs correctly before stripping trailing spaces, but fails after stripping them:
Require Import Coq.Strings.String.
Definition foo := "
"%string.
Check eq_refl : String.length foo = 5.
from pg.
Let us try this for a while and see.
While you ar at it, indenting should not rewind either.
Spaces are (very) significant when following a dot ([Foo. bar] is different
than [Foo.bar]). To my knoledge (and excepting strange stuff with notation
maybe) this is the only significant space.
P.
2015-10-09 1:06 GMT+02:00 Clément Pit--Claudel [email protected]:
In most cases (in all?), removing extra whitespace at the end of a line
shouldn't require rewinding; even outside of comments. Yet at the moment
calling whitespace-cleanup will cause PG to rewind to the earliest point
where some space was removed.This is a bit frustrating, so I'd like to push a patch to suppress the
rewinding behaviour when removing space at the end of the line. Are there
objections?Also, what should be the proper behaviour? Do we allow insertion of spaces
as well? Only at the end of lines? Or anywhere outside of strings and
outside of symbols? (is space significant anywhere in Coq?)—
Reply to this email directly or view it on GitHub
#4.
from pg.
Some notes after having a quick look: this isn't trivial, because retracting is implemented as a before-change hook, which doesn't convey information on the text about to be inserted or deleted. Using an after-change-hook would work better.
Interesting functions to look at: span-write-warning
and proof-span-read-only
and proof-retract-before-change
.
from pg.
Writing seems more difficult before setting readonly off than before indeed!
P.
Le lundi 23 novembre 2015, Clément Pit--Claudel [email protected]
a écrit :
Some notes after having a quick look: this isn't trivial, because
retracting is implemented as a before-change hook, which doesn't convey
information on the text about to be inserted or deleted. Using an
after-change-hook would work better.Interesting functions to look at: span-write-warning and
proof-span-read-only and proof-retract-before-change.—
Reply to this email directly or view it on GitHub
#4 (comment).
from pg.
Outside of string literals, I believe that Coq treats one whitespace character the same as any positive number of whitespace characters. So adding or removing whitespace at a location bordered by whitespace (and a newline counts as whitespace) should be safe as long as you're not in the middle of a string literal (and these are used in format
modifiers for notations, too). (Dots are not special in that whitespace around them matters (in some sense, other characters are special in that whitespace around them usually does not matter); e.g., f oo
is very different from foo
.)
from pg.
Spaces in strings are a good point, thanks! There are technical challenges with this due to the way retraction is implemented though, so I'm not sure when or if it will happen.
from pg.
Note that undo (C-/
) edits arbitrary regions without retraction (incorrectly!), so, in some sense, there must be a way to bypass retraction, no?
from pg.
Undo reverts fine for me. Are you using an undo package? If not, can you post a recipe?
There's definitely a way to bypass restriction (it's used, for example, when you edit text inside a comment); the hard part is deciding when to bypass it.
from pg.
Related Issues (20)
- Update https://proofgeneral.github.io/ HOT 2
- `coq-accept-proof-using-suggestion 'always` incorrectly believes that `proof` is a proof directive HOT 4
- Hitting 'tab' to indent just throws an error HOT 6
- Broken link in Ch. 11 of User's Manual
- ProofGeneral does not handle "Proof term." directives HOT 11
- Feature request: sparate commands for jumping to current point with/without omitting proofs HOT 7
- *response* buffer only showing last output HOT 3
- Tons of warnings when using certain PG features HOT 11
- "Omit proof" on a Let in a section leads to warning HOT 14
- "Omit proofs" breaks other proofs because it also skips hints HOT 14
- whitelist for admissible commands inside proofs HOT 17
- PG incorrectly interprets `}.` as a single token, which results in incorrectly accepting files that coqc rejects
- test_wholefile.v incompatible with 8.17 HOT 1
- Scheme ... with is indented improperly HOT 1
- Merging the Abella fork of PG HOT 9
- Automatic indenting for Easycrypt HOT 1
- generic/pg-goals.el shouldn't be executable HOT 1
- confusing error on incorrect _CoqProject file
- Colors don't work in emacs-nox HOT 1
- Compile-before-require setting does not presist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pg.