Re:The benefits of everything (in Emacs) being a buffer
by convolvatron on Monday January 30, 2023 @11:37AM
(#34582246)
C-x r k
C-x b *scr C-I
C-x r y
M-< (+
M-> ) C-j
[ Parent
| on HN ]
Re:The benefits of everything (in Emacs) being a buffer
by mxmdkdop on Monday January 30, 2023 @11:44AM
(#34582358)
Nobody thinks you're clever or funny
Re:The benefits of everything (in Emacs) being a buffer
by kriyative on Monday January 30, 2023 @11:48AM
(#34582453)
I don't think they were trying to be. Broadly, those are the key bindings to copy a column of characters (presumably numbers) paste them into the `scratch` buffer and sum them, give or take some assumptions
Re:The benefits of everything (in Emacs) being a buffer
by jgrahamc on Monday January 30, 2023 @12:16PM
(#34582967)
"Kill" text in a "rectangle" and save its contents
C-x r k
Switch to the scratch buffer C-x b *scr C-I
"Yank" the "rectangle" saved in the first command C-x r y
Moves to the start of the buffer and sets a "mark" M-<
Literals that are entered at the start of the buffer (+
Move to the end of the buffer M->
Another literal )
Executes the buffer. C-j
So, suppose the initial buffer contained 1
1
2
3
Then the scratch buffer would get turned into (+1
1
2
3 )
And when executed this would add the list of numbers and look like this: (+
1
1
2
3)
7
Re:The benefits of everything (in Emacs) being a buffer
by wging on Monday January 30, 2023 @01:32PM
(#34584253)
> Switch to the scratch buffer (think there's a missing RET at the end)
In vanilla emacs you need a RET, but I bet that like many people, OP's using a mechanism that will just select the matching item if there's a unique match, rather than the built-in buffer selection mechanism.
I use ido (with flx-ido for fuzzy completions), and it works for me as stated: C-i in the minibuffer runs `ido-complete`, which selects the unique completion if there's only one. (By default, that is, this is emacs and so of course there's a variable `ido-confirm-unique-completion` that you can set to customize this behavior.)
Re:The benefits of everything (in Emacs) being a buffer
by garethrees on Monday January 30, 2023 @12:28PM
(#34583182)
Another way to sum a column of numbers uses calc:
M-x calc-grab-rectangle RET V R +