From: Dmitry Gutov <dgutov@yandex.ru>
To: Alan Mackenzie <acm@muc.de>
Cc: Stefan <monnier@IRO.UMontreal.CA>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Thu, 27 Mar 2014 10:02:49 +0200 [thread overview]
Message-ID: <5333DB29.7030403@yandex.ru> (raw)
In-Reply-To: <20140326205330.GA3787@acm.acm>
Hi Alan,
On 26.03.2014 22:53, Alan Mackenzie wrote:
> Indentation (in the sense of what `indent-line-function' does) only makes
> sense in programming (etc.) modes. In text modes, and the like,
> indentation is, in practice, done with adaptive fill prefices.
This could be considered a reason to improve the indent-line-function in
text-mode. `indent-relative' offers behavior that's pretty close. Maybe
it could be made to follow the behavior of auto-fill even closer.
> Having RET do `newline-and-indent' in Emacs Lisp Mode while doing
> `newline' in Text Mode makes a lot of sense to me. A trickier question
> is to identify which of the non-programming modes really want this sort
> of indentation.
I'd rather make exceptions for specific "non-programming modes", where
indentation of the next line is really hard to guess.
Many modes that don't inherit from prog-mode have something to do with
structured content, and often define their own specific indentation
functions (sgml-mode, markdown-mode inherit from text-mode, css-mode and
yaml-mode inherit from fundamental-mode).
I'd really expect typing <div> and pressing RET in html-mode to offer
hard +2 indentation on the next line, but I wouldn't call it a
programming mode.
In Markdown, I'm often typing code blocks, and I expect RET to bring me
to the column which the previous line was indented to, so I don't have
to press TAB each time. And if I'm outside of a code block, the lines
usually either have no indentation (then indent-relative indents to the
0th column as well), or they serve as continuation of a paragraph, and I
want each next line to have the same extra indentation until the
paragraph ends (and indent-relative does that well enough).
The last time I used text-mode, it was for a similar purpose (a couple
of code blocks, and the rest of the text is indented to column 0).
`M-x fill-paragraph' would slaughter the code blocks, and it wouldn't
improve the indentation anywhere else.
It also eats line breaks that were put in manually. A good example is
ChangeLog files: we often see cleanup commits in Emacs that change the
places where the lines are broken, for better readability, in ways that
fill-paragraph is unable to do automatically.
And if ChangeLog files didn't always magically have the right
indentation (one tab), and one had to fix it with `fill-paragraph', all
the manual line breaks would be mangled, each time. It still happens
when I fix lines that are too long this way.
>> There's a certain class of users who've been binding RET to
>> `newline-and-indent' for a long time (myself included), and I haven't
>> seen anyone mention only doing that in prog-mode, instead of globally.
>
> That was what we collectively decided last Autumn when the topic came up.
Okay: I haven't seen anyone mention doing it outside of emacs-devel.
> Richard Stallman alluded to it in his disgust at bug #16156, when what
> was bound to RET at the time zapped his indentation.
>
> I personally would not be unhappy at leaving the traditional binding in
> place for RET and C-j, but wouldn't mind them swapping in "indenting"
> modes. I'd object strongly to RET in text mode messing around with
> indentation.
Maybe text-mode by itself should be a special case. I don't use it often
enough to have a strong opinion.
>> How hard can it be for a user to change the key bindings without a mode?
>
> Middling, not very. Such a minor mode might serve to damp down the
> inevitable complaints the change in defaults will provoke.
As long as this new mode is divorced from electric-indent-mode, I'd be
happy.
> By "makes sense" I think you mean "seems a sensible thing to do". I take
> issue with you here and say that, in Text Mode, it's a bizarre thing to
> do. I can't think of any normal circumstances where this behaviour would
> be commonly desired; just how often in Text Mode do you not want RET just
> to insert a new line when you type it at the beginning of a line?
This specific behavior is a consequence of using `newline-and-indent'.
One answer may be "Don't want that? Use `open-line'", which I sometimes
do, but special-casing indent-line-function in text-mode not to reindent
on the first invocation (when point is at bol followed by whitespace and
then non-whitespace on the same line) could well be another option.
What makes sense to me, is using `newline-and-indent' itself. Richard
doesn't like
foo
| bar
turning into
foo
|bar
I can understand that, but I don't like
foo
bar|baz
turning into
foo
bar
|baz (note the missing indentation)
Which situation do you think occurs more frequently?
next prev parent reply other threads:[~2014-03-27 8:02 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1WFSpO-0001e7-Gm@vcs.savannah.gnu.org>
2014-02-18 0:11 ` [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478 Stefan Monnier
2014-02-22 18:27 ` Alan Mackenzie
2014-02-25 3:24 ` Stefan Monnier
2014-02-28 19:50 ` Alan Mackenzie
2014-03-01 15:57 ` Stefan Monnier
2014-03-02 11:51 ` Alan Mackenzie
2014-03-04 3:48 ` Stefan Monnier
2014-03-08 22:58 ` Alan Mackenzie
2014-03-09 1:57 ` Stefan Monnier
2014-03-09 12:37 ` Alan Mackenzie
2014-03-10 3:37 ` Stefan Monnier
2014-03-10 6:59 ` Glenn Morris
2014-03-10 12:24 ` João Távora
2014-03-10 18:30 ` Stefan Monnier
2014-03-16 22:35 ` Alan Mackenzie
2014-03-17 15:48 ` Stefan
2014-03-19 22:42 ` Alan Mackenzie
2014-03-20 1:46 ` Stefan
2014-03-20 8:35 ` Thien-Thi Nguyen
2014-03-21 8:24 ` João Távora
2014-03-22 13:13 ` Alan Mackenzie
2014-03-22 16:14 ` Stefan
2014-03-22 20:19 ` David Caldwell
2014-03-22 22:05 ` David Kastrup
2014-03-22 22:32 ` David Caldwell
2014-03-24 1:13 ` Stefan
2014-03-22 22:34 ` Alan Mackenzie
2014-03-24 1:37 ` Stefan
2014-03-24 22:40 ` Alan Mackenzie
2014-03-25 1:37 ` Dmitry Gutov
2014-03-26 20:53 ` Alan Mackenzie
2014-03-27 8:02 ` Dmitry Gutov [this message]
2014-03-30 14:57 ` Alan Mackenzie
2014-03-31 17:11 ` Dmitry Gutov
2014-04-03 21:53 ` Alan Mackenzie
2014-03-25 1:54 ` Stefan
2014-03-26 21:21 ` Alan Mackenzie
2014-03-27 14:49 ` Stefan Monnier
2014-03-30 11:37 ` Alan Mackenzie
2014-03-30 16:46 ` Stefan Monnier
2014-03-22 23:10 ` Alan Mackenzie
2014-03-24 1:39 ` Stefan
2014-03-24 6:59 ` Stephen J. Turnbull
2014-03-24 9:08 ` Dmitry Gutov
2014-03-24 17:19 ` Eli Zaretskii
2014-03-24 17:29 ` David Kastrup
2014-03-24 17:39 ` David Kastrup
2014-03-24 17:38 ` Dmitry Gutov
2014-03-24 17:52 ` Eli Zaretskii
2014-03-25 1:53 ` Dmitry Gutov
2014-03-25 3:49 ` Eli Zaretskii
2014-03-24 18:32 ` Stefan
2014-03-25 1:49 ` Dmitry Gutov
2014-03-25 7:44 ` Stephen J. Turnbull
2014-03-25 8:08 ` Steinar Bang
2014-03-25 16:49 ` Stephen J. Turnbull
2014-03-25 17:08 ` Steinar Bang
2014-03-25 17:31 ` Dmitry Gutov
2014-03-25 19:28 ` Steinar Bang
2014-03-25 19:49 ` David Kastrup
2014-03-25 19:54 ` Dmitry Gutov
2014-03-25 13:26 ` Stefan Monnier
2014-03-27 7:51 ` Stephen J. Turnbull
2014-03-24 21:12 ` Alan Mackenzie
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=5333DB29.7030403@yandex.ru \
--to=dgutov@yandex.ru \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.