emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: antlr-mode.el - need some support by python.el


From: Dmitry Gutov
Subject: Re: antlr-mode.el - need some support by python.el
Date: Thu, 19 Feb 2015 04:43:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Thunderbird/36.0

On 02/18/2015 07:56 PM, Stefan Monnier wrote:

They can choose to do so if it doesn't break some of the things they do,
of course, but forcing it upon them will lead to trouble.

Can you think of a situation when _actually_ forcing it (with an un-widen-able narrowing) can lead to trouble here?

I think I'd rather change the indent-line-function API, to return the column
offset.  Or add a new one, like `line-indentation-function'.

Agreed, but someone's got to do it.  FWIW I've appended code I've had in
my prog-mode.el for many years (e.g. long before add-function came
along ;-).

This looks appealing, but way beyond my suggestion. :)

I'd omit `prog-indent-calculate-functions' for now, but otherwise `prog-indent-line' is mostly in line with what I'd imagined.

Anyway, I'll look into it if nobody else does, before 25 release.

BTW, I consider any mode which needs auto-indentation to be
a "programming mode".  That includes LaTeX, XML, ... (which are also
text-modes, but I don't think the two are mutually exclusive).

Okay, that's a reasonable interpretation. We don't have multiple inheritance, though. But if prog-mode inherited from text-mode...

Furthermore, I can imagine some cases where the inner mode may still
want to indent to a column smaller than LEFTMOST-COL for good reasons.
I wonder what that is.

E.g. in latex-mode, a "\begin{verbatim}" has to go to column 0, no
matter what the context.

Are there important cases like this where we can't "flip" the modes and consider latex the "primary" mode instead?

But anyway, line-indentation-function would
return a negative value in that case.

How would it know it has to do that (and how negative should it be) if
it's not told about LEFTMOST-COL?

Hmm, maybe it would return nil when at the top level. And when it returns non-nil, that would be interpreted as the indentation was calculated using some preceding buffer text.

So the multi-mode package would replace nil with LEFTMOST-COL, but otherwise obey the returned value. The value 0 will be obeyed, too.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]