* bug#739: Suggested small functions to plug symmetry gaps @ 2008-08-19 12:51 Reuben Thomas 2012-04-11 12:23 ` Lars Magne Ingebrigtsen 0 siblings, 1 reply; 20+ messages in thread From: Reuben Thomas @ 2008-08-19 12:51 UTC (permalink / raw) To: bug-emacs Hi, I have a couple of functions in my ~/.emacs that are useful, tiny, and plug obvious "symmetry gaps" in the standard functions. They're not even original; one at least has been discussed on the list before. For simple.el: (defun goto-column (n) "Goto column COLUMN, counting from column 1 at beginning of line." (interactive "nGoto column: ") (move-to-column n)) For rect.el: (defun copy-rectangle-as-kill (start end) "Copy the region-rectangle and save it as the last killed one." (interactive "r") (setq killed-rectangle (extract-rectangle start end))) goto-column fills an obvious gap left between goto-char and goto-line, while copy-rectangle-as-kill mirrors copy-region-as-kill (and has been requested and suggested before on more than one Emacs mailing list). Is there some reason not to put these functions in Emacs? I'd be happy to supply the other obvious missing part (documentation for the manual) if that helped. -- http://rrt.sc3d.org/ | resolute, a. obstinate in a good cause (Bierce) ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2008-08-19 12:51 bug#739: Suggested small functions to plug symmetry gaps Reuben Thomas @ 2012-04-11 12:23 ` Lars Magne Ingebrigtsen 2012-04-11 13:46 ` Stefan Monnier ` (3 more replies) 0 siblings, 4 replies; 20+ messages in thread From: Lars Magne Ingebrigtsen @ 2012-04-11 12:23 UTC (permalink / raw) To: Reuben Thomas; +Cc: 739 Reuben Thomas <rrt@sc3d.org> writes: > For simple.el: > > (defun goto-column (n) > "Goto column COLUMN, counting from column 1 at beginning of line." > (interactive "nGoto column: ") > (move-to-column n)) This doesn't really seem that useful to me. `C-u 9 <right>' does that already. > For rect.el: > > (defun copy-rectangle-as-kill (start end) > "Copy the region-rectangle and save it as the last killed one." > (interactive "r") > (setq killed-rectangle (extract-rectangle start end))) > > goto-column fills an obvious gap left between goto-char and goto-line, > while copy-rectangle-as-kill mirrors copy-region-as-kill (and has been > requested and suggested before on more than one Emacs mailing list). This is a good idea, especially in read-only buffers. What would the keystroke be, though? `C-x r c' is already taken... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-11 12:23 ` Lars Magne Ingebrigtsen @ 2012-04-11 13:46 ` Stefan Monnier 2012-04-12 16:06 ` Lars Magne Ingebrigtsen 2012-04-11 16:04 ` Reuben Thomas ` (2 subsequent siblings) 3 siblings, 1 reply; 20+ messages in thread From: Stefan Monnier @ 2012-04-11 13:46 UTC (permalink / raw) To: Lars Magne Ingebrigtsen; +Cc: 739, Reuben Thomas >> (defun goto-column (n) >> "Goto column COLUMN, counting from column 1 at beginning of line." >> (interactive "nGoto column: ") >> (move-to-column n)) > This doesn't really seem that useful to me. `C-u 9 <right>' does that > already. No, C-u 9 <right> only works if you're at BOL and if all chars occupy a single column (e.g. any TAB will throw you off). But, please don't define a new function/command, just put a interactive property on `move-to-column' instead. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-11 13:46 ` Stefan Monnier @ 2012-04-12 16:06 ` Lars Magne Ingebrigtsen 2012-04-12 16:17 ` Reuben Thomas 0 siblings, 1 reply; 20+ messages in thread From: Lars Magne Ingebrigtsen @ 2012-04-12 16:06 UTC (permalink / raw) To: Stefan Monnier; +Cc: 739, Reuben Thomas Stefan Monnier <monnier@iro.umontreal.ca> writes: > But, please don't define a new function/command, just put a interactive > property on `move-to-column' instead. `move-to-column' already has an interactive spec. :-) But what did you think about `copy-rectangle-as-kill'? Seems useful to me. (On `C-x r v' as suggested.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 16:06 ` Lars Magne Ingebrigtsen @ 2012-04-12 16:17 ` Reuben Thomas 2012-04-12 18:19 ` Stefan Monnier 0 siblings, 1 reply; 20+ messages in thread From: Reuben Thomas @ 2012-04-12 16:17 UTC (permalink / raw) To: Lars Magne Ingebrigtsen; +Cc: 739 2012/4/12 Lars Magne Ingebrigtsen <larsi@gnus.org>: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >> But, please don't define a new function/command, just put a interactive >> property on `move-to-column' instead. > > `move-to-column' already has an interactive spec. :-) It does, but it could still be extended to prompt for a number if one isn't given; at the moment, as I originally noted, there is no columnar equivalent to goto-char and goto-line. If it's not appropriate to add this behavior to move-to-column, it could be a new function, as I suggested; this also has the advantage that users might reasonably infer the existence of goto-column from the other goto- functions, and be surprised (as I was!) when they don't find it. -- http://rrt.sc3d.org ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 16:17 ` Reuben Thomas @ 2012-04-12 18:19 ` Stefan Monnier 2012-04-12 20:47 ` Reuben Thomas 2012-04-14 11:32 ` Lars Ingebrigtsen 0 siblings, 2 replies; 20+ messages in thread From: Stefan Monnier @ 2012-04-12 18:19 UTC (permalink / raw) To: Reuben Thomas; +Cc: Lars Magne Ingebrigtsen, 739 >>> But, please don't define a new function/command, just put a interactive >>> property on `move-to-column' instead. >> `move-to-column' already has an interactive spec. :-) > It does, but it could still be extended to prompt for a number if one > isn't given; Agreed. Patch welcome. > at the moment, as I originally noted, there is no > columnar equivalent to goto-char and goto-line. If it's not > appropriate to add this behavior to move-to-column, it could be a new > function, as I suggested; this also has the advantage that users might > reasonably infer the existence of goto-column from the other goto- > functions, and be surprised (as I was!) when they don't find it. I could maybe be persuaded to add a `goto-column' alias. As for copy-rectangle-as-kill, that sounds perfectly fine to me. [ Tho I'd much rather do it with M-x push-rectangle-mark RET ...move to other corner... M-w. E.g. by letting `mark-active' take a third possible value `rectangle'. ] Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 18:19 ` Stefan Monnier @ 2012-04-12 20:47 ` Reuben Thomas 2012-04-12 21:21 ` Andreas Schwab 2012-04-14 11:32 ` Lars Ingebrigtsen 1 sibling, 1 reply; 20+ messages in thread From: Reuben Thomas @ 2012-04-12 20:47 UTC (permalink / raw) To: Stefan Monnier; +Cc: Lars Magne Ingebrigtsen, 739 On 12 April 2012 19:19, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>>> But, please don't define a new function/command, just put a interactive >>>> property on `move-to-column' instead. >>> `move-to-column' already has an interactive spec. :-) >> It does, but it could still be extended to prompt for a number if one >> isn't given; > > Agreed. Patch welcome. I'm glad to see that although move-to-column is a C function, I don't have to write any C! Diff against bzr head: === modified file 'src/indent.c' --- src/indent.c 2012-04-09 13:05:48 +0000 +++ src/indent.c 2012-04-12 20:44:45 +0000 @@ -956,7 +956,7 @@ return val >= column; } -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "(list (or current-prefix-arg (read-number \"Goto column: \")))", doc: /* Move point to column COLUMN in the current line. Interactively, COLUMN is the value of prefix numeric argument. The column of a character is calculated by adding together the widths ---cut-here--- -- http://rrt.sc3d.org ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 20:47 ` Reuben Thomas @ 2012-04-12 21:21 ` Andreas Schwab 2012-04-12 21:27 ` Reuben Thomas 2012-04-13 18:52 ` Reuben Thomas 0 siblings, 2 replies; 20+ messages in thread From: Andreas Schwab @ 2012-04-12 21:21 UTC (permalink / raw) To: Reuben Thomas; +Cc: Lars Magne Ingebrigtsen, 739 Reuben Thomas <rrt@sc3d.org> writes: > -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", > +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, > "(list (or current-prefix-arg (read-number \"Goto column: \")))", This is what "N" does. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 21:21 ` Andreas Schwab @ 2012-04-12 21:27 ` Reuben Thomas 2012-04-13 6:20 ` Chong Yidong 2012-04-13 18:52 ` Reuben Thomas 1 sibling, 1 reply; 20+ messages in thread From: Reuben Thomas @ 2012-04-12 21:27 UTC (permalink / raw) To: Andreas Schwab; +Cc: Lars Magne Ingebrigtsen, 739 On 12 April 2012 22:21, Andreas Schwab <schwab@linux-m68k.org> wrote: > Reuben Thomas <rrt@sc3d.org> writes: > >> -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", >> +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, >> "(list (or current-prefix-arg (read-number \"Goto column: \")))", > > This is what "N" does. Great, so, new patch: === modified file 'src/indent.c' --- src/indent.c 2012-04-09 13:05:48 +0000 +++ src/indent.c 2012-04-12 21:26:30 +0000 @@ -956,7 +956,7 @@ return val >= column; } -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "NGoto column: ", doc: /* Move point to column COLUMN in the current line. Interactively, COLUMN is the value of prefix numeric argument. The column of a character is calculated by adding together the widths ---cut-here--- -- http://rrt.sc3d.org ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 21:27 ` Reuben Thomas @ 2012-04-13 6:20 ` Chong Yidong 0 siblings, 0 replies; 20+ messages in thread From: Chong Yidong @ 2012-04-13 6:20 UTC (permalink / raw) To: Reuben Thomas; +Cc: 739, Andreas Schwab, Lars Magne Ingebrigtsen Reuben Thomas <rrt@sc3d.org> writes: >> This is what "N" does. > > Great, so, new patch: Committed to trunk. Thanks. ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 21:21 ` Andreas Schwab 2012-04-12 21:27 ` Reuben Thomas @ 2012-04-13 18:52 ` Reuben Thomas 2012-04-16 12:52 ` Stefan Monnier 1 sibling, 1 reply; 20+ messages in thread From: Reuben Thomas @ 2012-04-13 18:52 UTC (permalink / raw) To: Andreas Schwab; +Cc: Lars Magne Ingebrigtsen, 739 On 12 April 2012 22:21, Andreas Schwab <schwab@linux-m68k.org> wrote: > Reuben Thomas <rrt@sc3d.org> writes: > >> -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", >> +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, >> "(list (or current-prefix-arg (read-number \"Goto column: \")))", > > This is what "N" does. So why doesn't set-fill-column use N? Because of the default value? -- http://rrt.sc3d.org ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-13 18:52 ` Reuben Thomas @ 2012-04-16 12:52 ` Stefan Monnier 0 siblings, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2012-04-16 12:52 UTC (permalink / raw) To: Reuben Thomas; +Cc: Lars Magne Ingebrigtsen, Andreas Schwab, 739 > So why doesn't set-fill-column use N? Because of the default value? Yes. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-12 18:19 ` Stefan Monnier 2012-04-12 20:47 ` Reuben Thomas @ 2012-04-14 11:32 ` Lars Ingebrigtsen 2012-04-16 2:05 ` Stefan Monnier 1 sibling, 1 reply; 20+ messages in thread From: Lars Ingebrigtsen @ 2012-04-14 11:32 UTC (permalink / raw) To: Stefan Monnier; +Cc: 739, Reuben Thomas Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > As for copy-rectangle-as-kill, that sounds perfectly fine to me. > [ Tho I'd much rather do it with M-x push-rectangle-mark RET ...move to > other corner... M-w. E.g. by letting `mark-active' take a third > possible value `rectangle'. ] Hm. `mark-active'? Anyway, that would make `M-w' not be totally analogous to `C-w', so then `C-w' should be changed, too, perhaps. But I think having the rectangle commands live in their own keymap is kinda nice. When you're in a rectangular kinda mood, you use them a lot, and it's nice to have them separate from the normal kill/yank commands. -- (domestic pets only, the antidote for overdose, milk.) http://lars.ingebrigtsen.no * Sent from my Rome ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-14 11:32 ` Lars Ingebrigtsen @ 2012-04-16 2:05 ` Stefan Monnier 0 siblings, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2012-04-16 2:05 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 739, Reuben Thomas > Hm. `mark-active'? Anyway, that would make `M-w' not be totally > analogous to `C-w', so then `C-w' should be changed, too, perhaps. Of course. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-11 12:23 ` Lars Magne Ingebrigtsen 2012-04-11 13:46 ` Stefan Monnier @ 2012-04-11 16:04 ` Reuben Thomas 2012-04-11 17:57 ` Drew Adams 2012-04-13 6:25 ` Chong Yidong 3 siblings, 0 replies; 20+ messages in thread From: Reuben Thomas @ 2012-04-11 16:04 UTC (permalink / raw) To: Lars Magne Ingebrigtsen; +Cc: 739 On 11 April 2012 13:23, Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: > Reuben Thomas <rrt@sc3d.org> writes: > >> For rect.el: >> >> (defun copy-rectangle-as-kill (start end) >> "Copy the region-rectangle and save it as the last killed one." >> (interactive "r") >> (setq killed-rectangle (extract-rectangle start end))) >> > This is a good idea, especially in read-only buffers. What would the > keystroke be, though? `C-x r c' is already taken... The mailing list message in which I found this function suggested C-x r v, and that's what I use. -- http://rrt.sc3d.org ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-11 12:23 ` Lars Magne Ingebrigtsen 2012-04-11 13:46 ` Stefan Monnier 2012-04-11 16:04 ` Reuben Thomas @ 2012-04-11 17:57 ` Drew Adams 2012-04-13 6:25 ` Chong Yidong 3 siblings, 0 replies; 20+ messages in thread From: Drew Adams @ 2012-04-11 17:57 UTC (permalink / raw) To: 'Lars Magne Ingebrigtsen', 'Reuben Thomas'; +Cc: 739 > This doesn't really seem that useful to me. `C-u 9 <right>' does that > already. > ... > This is a good idea, especially in read-only buffers. What would the > keystroke be, though? `C-x r c' is already taken... It is appropriate to file enhancement requests using `report-emacs-bug'. But discussion of whether to enhance Emacs following such a request should take place in emacs-devel, not debbugs. The list audiences and the list purposes are not the same. ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-11 12:23 ` Lars Magne Ingebrigtsen ` (2 preceding siblings ...) 2012-04-11 17:57 ` Drew Adams @ 2012-04-13 6:25 ` Chong Yidong 2012-04-14 11:33 ` Lars Ingebrigtsen 3 siblings, 1 reply; 20+ messages in thread From: Chong Yidong @ 2012-04-13 6:25 UTC (permalink / raw) To: Lars Magne Ingebrigtsen; +Cc: 739, Reuben Thomas Lars Magne Ingebrigtsen <larsi@gnus.org> writes: >> goto-column fills an obvious gap left between goto-char and goto-line, >> while copy-rectangle-as-kill mirrors copy-region-as-kill (and has been >> requested and suggested before on more than one Emacs mailing list). > > This is a good idea, especially in read-only buffers. What would the > keystroke be, though? `C-x r c' is already taken... How about `C-x r w' (for symmetry with `M-w') and move the binding of `window-configuration-to-register' to `C-x r W'? ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-13 6:25 ` Chong Yidong @ 2012-04-14 11:33 ` Lars Ingebrigtsen 2012-04-14 13:46 ` Drew Adams 0 siblings, 1 reply; 20+ messages in thread From: Lars Ingebrigtsen @ 2012-04-14 11:33 UTC (permalink / raw) To: Chong Yidong; +Cc: 739, Reuben Thomas Chong Yidong <cyd@gnu.org> writes: > How about `C-x r w' (for symmetry with `M-w') and move the binding of > `window-configuration-to-register' to `C-x r W'? I think that's a good idea. I can't imagine that `window-configuration-to-register' is a command that's used a lot. -- (domestic pets only, the antidote for overdose, milk.) http://lars.ingebrigtsen.no * Sent from my Rome ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-14 11:33 ` Lars Ingebrigtsen @ 2012-04-14 13:46 ` Drew Adams 2012-07-14 2:17 ` Chong Yidong 0 siblings, 1 reply; 20+ messages in thread From: Drew Adams @ 2012-04-14 13:46 UTC (permalink / raw) To: 'Lars Ingebrigtsen', 'Chong Yidong' Cc: 739, 'Reuben Thomas' > > How about `C-x r w' (for symmetry with `M-w') and move the > > binding of `window-configuration-to-register' to `C-x r W'? > > I think that's a good idea. I can't imagine that > `window-configuration-to-register' is a command that's used a lot. 1. That's not a great assumption. 2. `C-x r M-w' is better for symmetry with `M-w'. Plain `w' has symmetry with lots of other things in Emacs (write commands, window commands,...). `M-w' is ingrained in finger-memory as a copy operation. Better to keep `w' for something that actually has a `w' in its name/meaning. (Yes, I know that Dired uses `w' as `dired-copy-filename-as-kill', but that's presumably because `M-w' is still available there and the aim was to avoid using a prefix.) 3. With `M-w', if someone binds `ctl-x-r-map' to a (prefix) key (e.g., a shorter one than `C-x r'), then s?he gets `M-w' on it, with its "copy" association. As opposed to getting just `w', with no such useful association. E.g., `<f10> M-w'. 4. I really don't care. If the above helps, fine. ^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#739: Suggested small functions to plug symmetry gaps 2012-04-14 13:46 ` Drew Adams @ 2012-07-14 2:17 ` Chong Yidong 0 siblings, 0 replies; 20+ messages in thread From: Chong Yidong @ 2012-07-14 2:17 UTC (permalink / raw) To: Drew Adams; +Cc: 'Lars Ingebrigtsen', 739, 'Reuben Thomas' "Drew Adams" <drew.adams@oracle.com> writes: > 2. `C-x r M-w' is better for symmetry with `M-w'. It's an okay choice. If we were starting from scratch, `C-x r w' would be better, but there's no point causing disruption for the sake of this small difference. I've committed copy-rectangle-as-kill as C-x r M-w. ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-07-14 2:17 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-19 12:51 bug#739: Suggested small functions to plug symmetry gaps Reuben Thomas 2012-04-11 12:23 ` Lars Magne Ingebrigtsen 2012-04-11 13:46 ` Stefan Monnier 2012-04-12 16:06 ` Lars Magne Ingebrigtsen 2012-04-12 16:17 ` Reuben Thomas 2012-04-12 18:19 ` Stefan Monnier 2012-04-12 20:47 ` Reuben Thomas 2012-04-12 21:21 ` Andreas Schwab 2012-04-12 21:27 ` Reuben Thomas 2012-04-13 6:20 ` Chong Yidong 2012-04-13 18:52 ` Reuben Thomas 2012-04-16 12:52 ` Stefan Monnier 2012-04-14 11:32 ` Lars Ingebrigtsen 2012-04-16 2:05 ` Stefan Monnier 2012-04-11 16:04 ` Reuben Thomas 2012-04-11 17:57 ` Drew Adams 2012-04-13 6:25 ` Chong Yidong 2012-04-14 11:33 ` Lars Ingebrigtsen 2012-04-14 13:46 ` Drew Adams 2012-07-14 2:17 ` Chong Yidong
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).