I have 5 rows of text:

1   0%
2   от 1% до 20%
3   от 21% до 50%
4   от 51% до 100%
5   100%

And I would like to copy everything after digits (1..5) to a table column PRC

| N | PRC|
|   |    |
|   |    |
|   |    |
|   |    |
|   |    |

I have tried different rectangle commands but was unable to select correct rectangle from 0% to 100% -- I only got part of text.

  • I would try to convert the text into org-tables first, then it's way easier to copy from an org-table rectangular regions. Oct 31 '16 at 19:35

I tried using your data, and the normal C-x r rectangle commands work just fine?

I marked the corners (adding the necessary spaces) and copied the rectangle with C-x r M-w and then yanked it into the table column (with point in the first data row for that column) with C-x r y (and TAB to tidy up the column lines).

edit: In fact, all the rectangle editing options I know of work fine here.

In addition to the above, I can mark the rectangle with C-x SPC, copy with M-w, and yank into the column with C-y; and the same copy/yank works for cua-selection-mode's rectangle editing.

This is in Emacs 24.5.1 with Org 8.2.10

  • Well I am old vim user and there is a way in vim to easily mark rectangles without adding spaces. I thought there should be smth similar in emacs.
    – Maxim Kim
    Jun 14 '16 at 19:10
  • So is this (adding spaces) a proper emacs way of rectangular manipulations?
    – Maxim Kim
    Jun 14 '16 at 19:12
  • For some approaches, yes. It sounds like you'd like the cua rectangle editing, though; that doesn't require additional space characters to be added. You can use (cua-selection-mode 1) to enable it permanently. Read M-x find-library RET cua-base RET for documentation -- look for "rectangle" in the commentary.
    – phils
    Jun 14 '16 at 22:34
  • Alternatively (and I forget exactly where I first read this), you can also use artist-mode as a trick to avoid entering spaces while marking rectangles. It wouldn't surprise me if someone has written a convenience library to make that convenient to use in practice.
    – phils
    Jun 14 '16 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.