[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: antlr-mode.el - need some support by python.el
From: |
Stefan Monnier |
Subject: |
Re: antlr-mode.el - need some support by python.el |
Date: |
Mon, 08 Jun 2015 16:50:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>> Maybe we should simply document that it's valid&expected for the inner
>> mode to add text-properties to the string.
> Which string?
IIUC we were talking about the case where PREVIOUS-CHUNKS is a string.
So: *the* string.
> Suppose an inner chunk A is followed by an "external" region,
> and then an inner chunk B. When we work on the contents of the chunk A, the
> new variable clearly won't include the contents of that chunk in the
> PREVIOUS-CHUNKS field.
What new variable? You mean prog-indentation-context?
I think in the case you describe, the outer mode wouldn't pass a string
in PREVIOUS-CHUNKS but would instead pass a function that gives access
to the chunk A.
> Thus, it's not possible for the code working in A to
> cache some state in a way accessible to the chunk B (to anny code running
> when it's current).
The inner mode can keep track of its state via text-properties applied
to the actual buffer text. So while working on chunk A, it could add
properties there, and while working on chunk B it would get access to
those properties via the region-bounds returned by the
PREVIOUS-CHUNKS function.
> Making PREVIOUS-CHUNKS store a list of position pairs (regions), or making
> it function, both sound better to me.
The intended use case where PREVIOUS-CHUNKS is a string is when this
"context" is a fixed short string, e.g. in a tool like yacc/bison, each
C chunk would use a PREVIOUS-CHUNKS along the lines of "void
pseudofunction () {" so as to make it clear that the chunk's content is
expected to be a function body rather than a top-level declaration.
Stefan
- RE: antlr-mode.el - need some support by python.el, Wedler, Christoph, 2015/06/03
- Re: antlr-mode.el - need some support by python.el, Stefan Monnier, 2015/06/03
- RE: antlr-mode.el - need some support by python.el, Wedler, Christoph, 2015/06/05
- Re: antlr-mode.el - need some support by python.el, Dmitry Gutov, 2015/06/05
- RE: antlr-mode.el - need some support by python.el, Wedler, Christoph, 2015/06/08
- Re: antlr-mode.el - need some support by python.el, Stefan Monnier, 2015/06/08
- Re: antlr-mode.el - need some support by python.el, Dmitry Gutov, 2015/06/08
- Re: antlr-mode.el - need some support by python.el,
Stefan Monnier <=
- Re: antlr-mode.el - need some support by python.el, Dmitry Gutov, 2015/06/08
- RE: antlr-mode.el - need some support by python.el, Wedler, Christoph, 2015/06/09
- Re: antlr-mode.el - need some support by python.el, Stefan Monnier, 2015/06/09
- Re: antlr-mode.el - need some support by python.el, Wedler, Christoph, 2015/06/09
- Re: antlr-mode.el - need some support by python.el, Dmitry Gutov, 2015/06/15
- Re: antlr-mode.el - need some support by python.el, Stefan Monnier, 2015/06/08