unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Lifting all buffer restrictions in indentation functions
@ 2017-12-08 16:51 Eli Zaretskii
  2017-12-08 17:03 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eli Zaretskii @ 2017-12-08 16:51 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-12-09 15:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08 16:51 Lifting all buffer restrictions in indentation functions Eli Zaretskii
2017-12-08 17:03 ` Stefan Monnier
2017-12-08 20:02   ` Eli Zaretskii
2017-12-08 20:47     ` Stefan Monnier
2017-12-09  8:24       ` Eli Zaretskii
2017-12-09 15:19         ` Stefan Monnier
2017-12-08 17:38 ` Robert Weiner
2017-12-08 17:50   ` Stefan Monnier
2017-12-08 22:40 ` Stephen Leake
2017-12-08 22:49   ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).