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

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

bug#46621: Copy line


From: Eli Zaretskii
Subject: bug#46621: Copy line
Date: Sat, 20 Feb 2021 16:15:35 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: mardani29@yahoo.es,  46621@debbugs.gnu.org,  juri@linkov.net
> Date: Sat, 20 Feb 2021 14:18:06 +0100
> 
> >   b M-/
> >   f M-/
> >   f M-/ M-/ M-/
> >
> > etc.
> 
> Ah, I see.  I've never used that command before.

It's a great means to type much less, and not just in programming
modes.  When writing email as well, for example.

> However, this just copies a single word, and not a line?

I mentioned M-/ because of this rationale:

> > In programming modes, if you need to declare a bunch of variables, you
> > may duplicate the current line several times and then proceed to rename
> > them.

> In programming modes, if you need to declare a bunch of variables, you
> may duplicate the current line several times and then proceed to rename
> them.

So assume you have this:

  ptrdiff_t foobar;

and you want to add this:

  ptrdiff_t bazquux;

Instead of copying the "foobar" line and then editing "foobar" into
"bazquux", you can do

  p M-/ bazquux;

IOW, instead of copying lines, it usually makes more sense in PL modes
to be able to easily repeat what has been typed recently, because
source lines are rarely exact copies of some other line.

So that use case I think is not the best one to justify this new
command.  Which is not to say I object to adding it, just that at
least some people may think they need it because they aren't aware of
some Emacs feature.  Because I _never_ in all the years of writing
code felt the need to have such a command.





reply via email to

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