GNU bug report logs -
#1396
Idea: unify *newline(-and-indent)
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1396 in the body.
You can then email your comments to 1396 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Message #3 received at quiet <at> emacsbugs.donarmstrong.com (full text, mbox):
Severity: wishlist
[ resent from
http://lists.gnu.org/archive/html/emacs-devel/2008-08/msg01461.html ]
The newline situation has annoyed me for a long time. Before fixing
it, I figure I'll float the idea here and see what kind of reception I
get.
In emacs CVS, I found these functions:
ada-indent-newline-indent-conditional
align-newline-and-indent
c-context-line-break
c-newline-and-indent
electric-pascal-terminate-line
electric-verilog-terminate-and-indent
electric-verilog-terminate-line
html-paragraph
idlwave-newline
m2-newline
message-newline-and-reformat
newline
newline-and-indent
octave-reindent-then-newline-and-indent
reindent-then-newline-and-indent
table--cell-newline-and-indent
vera-electric-return
vhdl-electric-return
I'm not even counting all the modes that aren't in CVS, or all the
(reindent-)newline(-and-indent) functions grep couldn't find. Why do
we need so many functions for essentially the same thing? Recently, I
tried seeing whether I could make newline not kill trailing
whitespace. I'd have to rewrite the newline function quite a few major
modes, and the solution would still be brittle.
Why not unify all the newline-and-friends functions?
- Cull the above list to three functions
interactive-newline (new function)
newline-and-indent
reindent-then-newline-and-indent
- Change the C-m binding in bindings.el to interactive-newline.
- Define a new variable, interactive-newline-function, which defaults
to #'newline.
(The existing #'newline would stay the same for backward
compatibility. I see 122 direct calls to (newline) in current CVS, and
I bet the callers wouldn't like new behavior.)
Change newline-and-indent and reindent-then-newline-and-indent to call
interactive-newline instead of newline. Have interactive-newline call
interactive-newline-function. (Which is plain old #'newline by
default, remember.)
Then, take all the functions above and convert them to functions that
can be plugged into interactive-newline-function. The situation we end
up with something like indent-for-tab-command and indent-line-function.
Is it worth writing the patch?
Thanks,
Dan
(Also – any objections to making cc-mode and lisp-mode use indent-for-
tab-command? The lisp tab command
has an indent-whole-sexp feature, but that be handled by passing the
prefix argument to indent-line-function. The cc-mode indent function
has some tab-or-indent DWIM feature, but isn't it better to put that
in indent-for-tab-command by extending tab-always-indent?)
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1396
; Package
emacs
.
(Thu, 19 Feb 2009 09:35:06 GMT)
Full text and
rfc822 format available.
View this message in rfc822 format
Daniel Colascione <danc <at> merrillpress.com> writes:
> The newline situation has annoyed me for a long time. Before fixing
> it, I figure I'll float the idea here and see what kind of reception I
> get.
>
> In emacs CVS, I found these functions:
>
> ada-indent-newline-indent-conditional
> align-newline-and-indent
> c-context-line-break
> c-newline-and-indent
> electric-pascal-terminate-line
> electric-verilog-terminate-and-indent
> electric-verilog-terminate-line
> html-paragraph
> idlwave-newline
> m2-newline
> message-newline-and-reformat
> newline
> newline-and-indent
> octave-reindent-then-newline-and-indent
> reindent-then-newline-and-indent
> table--cell-newline-and-indent
> vera-electric-return
> vhdl-electric-return
>
> I'm not even counting all the modes that aren't in CVS, or all the
> (reindent-)newline(-and-indent) functions grep couldn't find. Why do
> we need so many functions for essentially the same thing?
I had a look at a handful, and they don't really do the same thing. For
instance octave-reindent-then-newline-and-indent does some upcasing, and
message-newline-and-reformat inserts four newlines.
> Recently, I tried seeing whether I could make newline not kill
> trailing whitespace. I'd have to rewrite the newline function quite a
> few major modes, and the solution would still be brittle.
They all call `newline' in the end (as far as I can see), so the fix
could be done there.
> Then, take all the functions above and convert them to functions that
> can be plugged into interactive-newline-function. The situation we end
> up with something like indent-for-tab-command and indent-line-function.
>
> Is it worth writing the patch?
I think the use case is a bit iffy. I do see the attraction of doing
something like indent-for-tab-command, but for newline, but...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1396
; Package
emacs
.
(Thu, 03 Jun 2021 10:11:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 1396 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> I'm not even counting all the modes that aren't in CVS, or all the
>> (reindent-)newline(-and-indent) functions grep couldn't find. Why do
>> we need so many functions for essentially the same thing?
>
> I had a look at a handful, and they don't really do the same thing. For
> instance octave-reindent-then-newline-and-indent does some upcasing, and
> message-newline-and-reformat inserts four newlines.
So I'm closing this bug report. It may be that some of these functions
should be unified, but that has to be done on a case-to-case basis.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
1396 <at> debbugs.gnu.org and Daniel Colascione <danc <at> merrillpress.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 03 Jun 2021 10:11:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 01 Jul 2021 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.