bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1396: Idea: unify *newline(-and-indent)


From: Lars Ingebrigtsen
Subject: bug#1396: Idea: unify *newline(-and-indent)
Date: Mon, 30 Sep 2019 09:19:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Daniel Colascione <danc@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]