[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:04:02 +0000 |
Bottom line, if we want to consider this command, we should somehow come
up with the relevant use cases, and then weigh them against the added
complexity and maintenance costs. I therefore urge people who think
they know these details to please speak up and contribute to this
discussion.
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;
}
Another typical case:
import java.util.Set;
import java.util.TreeSet;
import java.util.HashSet;
import java.util.LinkedHashSet;
I agree with Richard that this can be done with C-a C-k C-k C-y..., which
is what I've been using in such cases, but that doesn't mean that the
proposed command wouldn't be welcome. I agree with Juri that Richard's
solution "pollutes" the kill-ring with something that the user actually
did not want to kill. I would suggest the following (based on Juri's
code):
(defun duplicate-line (&optional arg)
(interactive "p")
(save-mark-and-excursion
(dotimes (_ arg)
(forward-line 1)
(insert "\n")
(forward-line -1)
(copy-from-above-command))))
(global-set-key (kbd "C-x r z") 'duplicate-line)
- bug#46621: Copy line, (continued)
- bug#46621: Copy line, Juri Linkov, 2021/02/22
- bug#46621: Copy line, Eli Zaretskii, 2021/02/22
- bug#46621: Copy line, Helmut Eller, 2021/02/22
- bug#46621: Copy line, Andreas Schwab, 2021/02/22
- bug#46621: Copy line, Helmut Eller, 2021/02/22
- bug#46621: Copy line, Howard Melman, 2021/02/22
- bug#46621: [External] : bug#46621: Copy line, Drew Adams, 2021/02/22
- bug#46621: [External] : bug#46621: Copy line, Dmitry Gutov, 2021/02/23
- bug#46621: Copy line, Eli Zaretskii, 2021/02/22
- bug#46621: Copy line, Helmut Eller, 2021/02/22
- bug#46621: Copy line,
Gregory Heytings <=
- bug#46621: Copy line, Eli Zaretskii, 2021/02/22
- bug#46621: Copy line, Gregory Heytings, 2021/02/22
- bug#46621: Copy line, Stephen Berman, 2021/02/22
- bug#46621: Copy line, Lars Ingebrigtsen, 2021/02/21