emacs-devel
[Top][All Lists]
Advanced

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

Getting rid of prog-indentation-context


From: Stefan Monnier
Subject: Getting rid of prog-indentation-context
Date: Mon, 11 Dec 2017 09:18:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> Could we just mark them as obsolete in Emacs-26?
> Doesn't sound like a good idea to me: something that was introduced
> recently and barely had any chance to be used doesn't fall under the
> "obsolete" label for me.

Eli, I fail to understand what you expect prog-indentation-context will
be used for.

Here's what I'd like to see happen for Emacs-26:
- document the way major modes should behave in order to work properly
  in MMM contexts like mhtml-mode and mmm-mode.  Part of this doc says
  that indent-line-functions can assume that the buffer is already
  widened (to the current chunk or the whole buffer).
- change indent-according-to-mode to widen before calling
  indent-line-function (such that the above documentation is actually
  valid).
- get rid of prog-indentation-context or at least mark it as obsolete,
  since its 2nd element competes with the above changes and its 3rd
  element, while potentially useful, lacks even a proof-of-concept
  demonstration that it does what it purports to do.
- get rid of prog-widen.

To be honest, I could live with a version of prog-indentation-context
stripped down to its first element (which means: change its docstring
to say something like:

      "When non-nil, provides context for indenting embedded code chunks.
    
    There are languages where part of the code is actually written in
    a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists
    of plain C code.  This variable enables the major mode of the
    main language to use the indentation engine of the sub-mode for
    lines in code chunks written in the sub-mode's language.
    
    When a major mode of such a main language decides to delegate the
    indentation of a line/region to the indentation engine of the sub
    mode, it should bind this variable to non-nil around the call.
    
    The non-nil value should be a list of the form:
    
       (FIRST-COLUMN . REST)
    
    FIRST-COLUMN is the column the indentation engine of the sub-mode
    should use for top-level language constructs inside the code
    chunk (instead of 0).
    
    REST is currently unused.")

We could also keep prog-widen as

    (defalias prog-widen #'ignore)

or a more verbose version of the same, if you insist.


        Stefan




reply via email to

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