all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Lifting all buffer restrictions in indentation functions
Date: Fri, 08 Dec 2017 16:40:27 -0600	[thread overview]
Message-ID: <86609g9738.fsf@stephe-leake.org> (raw)
In-Reply-To: <83wp1xupqs.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Dec 2017 18:51:55 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

> 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

As I understand it, what MMM will do in these functions is change the
buffer bounds to the current chunk.

Since MMM needs to change the buffer bounds, why can't it just disregard
the current bounds, instead of relying on the caller to widen first?

-- 
-- Stephe



  parent reply	other threads:[~2017-12-08 22:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-12-08 22:49   ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86609g9738.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.