I noticed an annoying behaviour when copying multiple rows (a list) from a web page into an org-mode table, following a process inspired by Is it possible to copy /paste multiple lines of text into cells of org-mode table?.
The annoying result is that the table sides don't align properly, due to a TAB character being introduced during the process. Maybe I've discovered a bug or an undesired feature.
Note: It seems that using copy-rectangle-as-kill
rather than kill-rectangle
in the process prevents the TAB from appearing.
Reproducing the behaviour
Update: Reproduced in Emacs 26.3, but not fully in 27.1. If you have Docker installed you can test yourself using: docker run -it silex/emacs:26.3 emacs
.
For version 27.1, do docker run -it silex/emacs:27.1 emacs
and note that when yanking, a TAB character is actually created/inserted after the A
. However, when you then press C-c C-c
the TAB is replaced with a suitable number of spaces.
Create an empty table and these lines of text (the number of characters matter):
| |
| |
A
12345678
Cut/kill the lines as a rectangle in exactly the following way:
- Start
rectangle-mark-mode
(C-x SPC
) with the cursor to the left ofA
- Use
kill-rectangle
(C-x r k
) with the cursor to the right of8
Yank rectangle into the table:
- Place cursor on first row
- Do
yank-rectangle
(C-x r y
)
It should now look like this:
| A |
| 12345678 |
There should be a TAB character after the A
in the first row.
With cursor in table, align borders using C-c C-c
, giving:
| A |
| 12345678 |
Oops, still unaligned.
Discussion
I suspect the misalignment is due to the TAB character. But to see the effect, you have to have the right number of characters on the second row. Repeating steps above on the following two lines of text produces an aligned table without a TAB character:
A
1234567
| A |
| 1234567 |
Further, using copy-rectangle-as-kill
(C-x r M-w
) on the original two lines of text also did not result in a TAB character.
emacs -Q
and didn't get the "Oops, still unaligned." part. @chr could you please start Emacs by executingemacs -Q
and tell us whether you still get the error?emacs -q
I can replicate the behaviour. I can also replicate the behaviour on another computer (also version 26.3). I also could replicate on a third computer. Could you please give it a try with '-q'? Note: Don't do my mistake an try and replicate with only '1234567', it needs eight characters on the second row.emacs -Q
but notemacs
. Usingemacs -Q
, the yank command inserts a TAB. Usingemacs
does not insert a TAB.