emacs-devel
[Top][All Lists]
Advanced

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

Lifting all buffer restrictions in indentation functions


From: Eli Zaretskii
Subject: Lifting all buffer restrictions in indentation functions
Date: Fri, 08 Dec 2017 18:51:55 +0200

Hi, Emacs.

The issue I raise here is a spin-off from discussing the changes on
the widen-less branch, but I think it is largely independent and has
more broad effect, so IMO it should be discussed separately.

The widen-less branch proposes to have indent-according-to-mode,
indent-for-tab-command, and indent-region call 'widen' before calling
indent-line-function.  This call is unconditional, so for example the
following

  (save-excursion
    (narrow-to-region START END)
    (indent-for-tab-command))

will not do what the caller expects, because indent-line-function will
not run restricted to the region bounds, but will instead be able to
access the whole buffer.

The rationale for this change seems to be twofold:

  . it is TRT for indentation operations
  . MMM and similar features need that, and will apply the restriction
    as appropriate before calling the mode-specific indentation
    function

I'm worried by widening unconditionally, because some strange mode
could need to run its indentation function restricted, and the
indentation function itself might not have enough context to narrow by
itself.

IOW, widening unconditionally seems to invalidate potentially
legitimate uses of this functionality, so I wonder whether we should
have some "fire escape", or maybe condition this widening only on MMM
and similar modes being active.

I'd like to hear opinions about this.  If I'm the only one who is
bothered by this, then I will defer to Stefan's and Dmitry's opinions.

TIA



reply via email to

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