unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88)
       [not found] ` <20161012191324.8A15C220170@vcs.savannah.gnu.org>
@ 2016-10-12 19:48   ` Stefan Monnier
  2016-10-12 21:05     ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-10-12 19:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: Xairi

> --- a/aggressive-indent.el
> +++ b/aggressive-indent.el
> @@ -136,6 +136,7 @@ Please include this in your report!"
>      netcmd-mode
>      python-mode
>      sass-mode
> +    scala-mode
>      slim-mode
>      special-mode
>      shell-mode

Isn't aggressive-indent-excluded-modes a bit blunt/arbitrary?

I mean, shouldn't we argue for each mode *why* it shouldn't use
aggressive-indent, and then maybe come up with a way to make this
variable unnecessary (because we can determine it automatically)?

E.g. maybe some of those modes shouldn't use aggressive-indent simply
because auto-reindentation can't be done reliably (in which case,
aggressive-indent could check something like electric-indent-inhibit
which was introduced for the same kind of needs)...


        Stefan



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

* Re: [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88)
  2016-10-12 19:48   ` [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88) Stefan Monnier
@ 2016-10-12 21:05     ` Artur Malabarba
  2016-10-12 22:07       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2016-10-12 21:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Xairi, emacs-devel

On 12 October 2016 at 16:48, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> --- a/aggressive-indent.el
>> +++ b/aggressive-indent.el
>> @@ -136,6 +136,7 @@ Please include this in your report!"
>>      netcmd-mode
>>      python-mode
>>      sass-mode
>> +    scala-mode
>>      slim-mode
>>      special-mode
>>      shell-mode
>
> Isn't aggressive-indent-excluded-modes a bit blunt/arbitrary?

Indeed. :-(

> I mean, shouldn't we argue for each mode *why* it shouldn't use
> aggressive-indent, and then maybe come up with a way to make this
> variable unnecessary (because we can determine it automatically)?

Scala-mode was added because it takes the liberty of doing some
whitespace cleanup during indent-region, so it was preventing users
from typing properly. See:
https://github.com/Malabarba/aggressive-indent-mode/issues/87

I didn't have time to look for a config option to disable that, (and
even then, I don't think I want aggressive-indent to go around
changing semi-unrelated) so I disabled it in scala-mode.

> E.g. maybe some of those modes shouldn't use aggressive-indent simply
> because auto-reindentation can't be done reliably (in which case,
> aggressive-indent could check something like electric-indent-inhibit
> which was introduced for the same kind of needs)...

Yes. A lot of these are there for this reason, and we could use
`electric-indent-inhibit` for that (I didn't know about it).

Other modes are there because indentation makes no sense for them at
all. Such as shell-mode, which I see doesn't set
electric-indent-inhibit. We can't avoid these modes simply by
restricting ourselves to modes derived from prog-mode, because some
modes (like html or xml) do make sense to indent but are not derived
from prog-mode. Now that I have the advantage of hindsight, I see it
would have been easier to restrict to prog-mode and implement a
white-list, instead of taking everything and implementing a
black-list.



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

* Re: [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88)
  2016-10-12 21:05     ` Artur Malabarba
@ 2016-10-12 22:07       ` Stefan Monnier
  2016-10-13  1:02         ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-10-12 22:07 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: Xairi, emacs-devel

> Scala-mode was added because it takes the liberty of doing some
> whitespace cleanup during indent-region, so it was preventing users
> from typing properly. See:
> https://github.com/Malabarba/aggressive-indent-mode/issues/87

BTW, another way to avoid this problem is to skip reindentation if
(and (eolp) (memq (char-before) '(?\s ?\t))).

>> E.g. maybe some of those modes shouldn't use aggressive-indent simply
>> because auto-reindentation can't be done reliably (in which case,
>> aggressive-indent could check something like electric-indent-inhibit
>> which was introduced for the same kind of needs)...
> Yes.  A lot of these are there for this reason, and we could use
> `electric-indent-inhibit` for that (I didn't know about it).

Maybe we should have another variable that's not bound to
electric-indent, something like `indent-is-not-reliable'.

> Other modes are there because indentation makes no sense for them at
> all.  Such as shell-mode, which I see doesn't set
> electric-indent-inhibit.

AFAIK shell-mode's indentation works just fine and reliably.  Maybe you
don't need it when you write 2-line scripts, but for larger scripts
(such as https://gitlab.com/monnier/bugit/blob/master/bugit), it makes
just as much sense as for any other programming language.

> from prog-mode.  Now that I have the advantage of hindsight, I see it
> would have been easier to restrict to prog-mode and implement a
> white-list, instead of taking everything and implementing a
> black-list.

electric-indent does OK with a black list, so maybe it was not such
a bad decision.


        Stefan



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

* Re: [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88)
  2016-10-12 22:07       ` Stefan Monnier
@ 2016-10-13  1:02         ` Artur Malabarba
  2016-10-13  3:25           ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2016-10-13  1:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Xairi, emacs-devel

> AFAIK shell-mode's indentation works just fine and reliably.  Maybe you
> don't need it when you write 2-line scripts, but for larger scripts
> (such as https://gitlab.com/monnier/bugit/blob/master/bugit), it makes
> just as much sense as for any other programming language.

You're thinking of sh-mode. `shell-mode' is the one you get with `M-x shell'.



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

* Re: [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88)
  2016-10-13  1:02         ` Artur Malabarba
@ 2016-10-13  3:25           ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2016-10-13  3:25 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: Xairi, emacs-devel

>> AFAIK shell-mode's indentation works just fine and reliably.  Maybe you
>> don't need it when you write 2-line scripts, but for larger scripts
>> (such as https://gitlab.com/monnier/bugit/blob/master/bugit), it makes
>> just as much sense as for any other programming language.
> You're thinking of sh-mode. `shell-mode' is the one you get with `M-x shell'.

Duh!  comint-derived modes don't make much sense there, indeed.
But you don't need to list it: just check the value of
indent-line-function and weed out the `indent-relative' case.


        Stefan



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

end of thread, other threads:[~2016-10-13  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20161012191324.23934.59986@vcs.savannah.gnu.org>
     [not found] ` <20161012191324.8A15C220170@vcs.savannah.gnu.org>
2016-10-12 19:48   ` [elpa] master 6c3842e 2/6: Add scala-mode to excluded-modes (#88) Stefan Monnier
2016-10-12 21:05     ` Artur Malabarba
2016-10-12 22:07       ` Stefan Monnier
2016-10-13  1:02         ` Artur Malabarba
2016-10-13  3:25           ` Stefan Monnier

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).