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

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

bug#46621: Copy line


From: Gregory Heytings
Subject: bug#46621: Copy line
Date: Mon, 22 Feb 2021 17:54:56 +0000


My 2 cents: a typical case where this could be useful is:

switch (foobar) {
case long_enum_value_name_a: printf ("a"); break;
case long_enum_value_name_b: printf ("b"); break;
case long_enum_value_name_c: printf ("c"); break;
case long_enum_value_name_d: printf ("d"); break;
case long_enum_value_name_e: printf ("e"); break;
case long_enum_value_name_f: printf ("f"); break;
case long_enum_value_name_g: printf ("g"); break;
case long_enum_value_name_h: printf ("h"); break;
case long_enum_value_name_i: printf ("i"); break;
default: printf ("?"); break;
}

Here's how I'd type this:

 case long_enum_value_name_a: printf ("a"); break;
 c M-/ DEL b : p M-/ ("b"); b M-/
 c M-/ DEL c : p M-/ ("c"); b M-/
 c M-/ M-/ DEL d : p M-/ ("d"); b M-/

etc. (And if the series are indeed longer than a couple of lines, a rare case indeed, then a keyboard macro is in order.)


Yes, that's one way to do it, perhaps the most "emacsish" way to do it. But it takes more keystrokes than what you write:

case long_enum_value_name_a: printf ("a"); break; RET
c M-/ SPC l M-/ DEL DEL b : SPC p M-/ SPC ("b"); b M-/ ; RET
c M-/ SPC l M-/ DEL DEL c : SPC p M-/ SPC ("c"); b M-/ ; RET
...

And yes, keyboard macros can also be used.

That doesn't mean that the proposed feature wouldn't be useful; I'd say it's more intuitive:

case long_enum_value_name_a: printf ("a"); break; RET
C-u 8 C-x r z
C-s a : RET
C-b C-b C-d b
C-n C-b C-d c
C-n C-b C-d d
...

reply via email to

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