unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Stefan <monnier@IRO.UMontreal.CA>
Cc: Alan Mackenzie <acm@muc.de>,
	emacs-devel@gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Tue, 25 Mar 2014 16:44:38 +0900	[thread overview]
Message-ID: <87ior2rac9.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <jwvtxane9tf.fsf-monnier+emacsdiffs@gnu.org>

Stefan writes:

 > > FWIW, effectively doing `reindent-then-newline-and-indent' on RET also
 > > seems gratuitous to me. When I reach the end of a line, usually text on
 > > that line is already indented correctly (automatically, or through me
 > > typing TAB manually),
 > 
 > You might get used to "RET reindents" and stop hitting TAB that often ;-)

I'm very unlikely to get used to it.  Specifically, in the very
annoying case where unconventional indentation gets blown away by it
(TAB won't fix that!)

 > For me one of the reasons why it's not gratuitous is because of things like:
 > 
 >        begin
 >          blabla
 >          blibli
 >        end
 > 
 > Go to just before "blibli" and type "end RET": notice that hitting TAB
 > just before RET won't help you, because you need to reindent the line
 > after the newline is inserted.

I wouldn't do that, because the right indentation for "blibli" depends
on intended semantics.  That is, if I started from syntactically valid
code, after inserting "end" I now have invalid code ("end without
begin").  Non-trivial edits are required to return the buffer to
"well-formed" state, and I personally prefer the now-orphaned fragment
to retain its indentation, indicating its previous semantics.

Therefore I would go to the end of "blabla", and hit RET.  Why would I
care about the "no-op" reindent?  Because it might not be a no-op.
("blabla" might not be conventionally indented.)

 > This is admittedly less serious for interactive editing than for
 > keyboard macros (and templates/skeletons/snippets), but I find the
 > behavior to be handy.

In case of such things, I'd want to do

    C-x ( C-SPC ... macro keys ... C-x C-x M-x indent-region C-x )

(except in Python, where you're screwed because block structure is
determined by indentation, so situations where determining the
appropriate number of dedents requires knowing the intended semantics
are common).

 > > For all others, just swapping C-j and RET bindings would've worked just
 > > as well, and I think it would result in simpler code.
 > 
 > Again "just swapping" sounds simple, but I'm not sure what patch you
 > have in mind.  I think it's important for the user to be able to easily
 > say something like (electric-indent-mode -1) (and/or its buffer-local
 > equivalent) to recover the Emacs-23 behavior.

"Just swapping" is entirely independent of electric-indent-mode.  It
wouldn't change the Emacs-23 behavior, just have it on different keys.




  parent reply	other threads:[~2014-03-25  7:44 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87ior2rac9.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=acm@muc.de \
    --cc=dgutov@yandex.ru \
    --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 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).