[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: |
Wed, 03 Jun 2015 11:31:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> +FIRST-COLUMN is the column the indentation engine of the sub mode
> +should usually choose for top-level language constructs inside
> +the code chunk (instead of 0).
> +
> +START to END is the region of the code chunk. See function
> +`prog-widen' for additional info.
These depends on the surrounding outer mode, so that's fine.
> +PREVIOUS-CHUNKS, if non-nil, provides the indentation engine of
> +the sub mode with the virtual context of the code chunk. Valid
> +values are:
> +
> + - A string containing code which the indentation engine can
> + consider as standing in front of the code chunk. For example,
> + it can contain a function header to make the code chunk
> + being correctly indented as a function body.
> +
> + - A function called with the start position of the current
> + chunk. It will return either the region of the previous chunk
> + as \(PREV-START . PREV-END) or nil if there is no further
> + previous chunk.")
This is very unclear, so I'm not sure how an inner-mode could make use
of it. Who (and how) decides what the values will be? The outer-mode
or the inner-mode?
> +(defun prog-widen ()
> + "Remove restrictions (narrowing) from current code chunk or buffer.
> +This function should be used instead of `widen' in any function
> +used by the indentation engine to make it respect the value
> +`prog-indentation-context'.
I don't see a need for "should" here.
> + (widen)
> + (let ((chunk (cadr prog-indentation-context)))
> + (when chunk
> + (narrow-to-region (car chunk) (or (cdr chunk) (point-max))))))
Better do
(let ((chunk (cadr prog-indentation-context)))
(if chunk
(narrow-to-region (car chunk) (or (cdr chunk) (point-max)))
(widen))))
-- 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 <=
- 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, 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, 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