求教org-mode表格怎么让单元格下移

比如:

| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
| x | x | x |
| x | x | x |

变成这样:

| 1 | 2 | 3 |
| 4 | 5 |   |
| 7 | 8 | 6 |
| x | x | 9 |
| x | x | x |

如想把”6“这个单元格及下面的所有单元格下移一行,而不移动4,5两列的单元格,也就是说单独在6上面插入一个空的单元格,要怎么做?

请举一个完整的例子:“有这样一个表格……,我想要把它变成……。“

抱歉描述不清,又给你添麻烦了。

移动 cell 的需求不是太常见,所以 org-mode 并没有内置移动单个 cell 的函数。

我之前收藏过大牛写过的类似的代码段,可以将单个 cell 上下左右移动,应该能解决你的问题。

代码段地址: https://cs.gmu.edu/~kauffman/software/org-table-move-single-cell.el

2 个赞

感谢!怪不得翻遍了手册也没找到答案…… 看来只有学会elisp才能真正把emacs用的得心应手……

录制键盘宏,‘M-return M-f’,保存成一个名字。 或者直接’C-x C-e’执行下面的lisp语句。

(fset 'test-insert-cell
   [M-return ?\M-f])

光标移动到6上,按键: C-u 4 M-x test-insert-cell

表格行数少的时候这个方法不错。

C-c C-x M-w (org-table-copy-region)

Copy a rectangular region from a table to a special clipboard. Point and mark determine edge fields of the rectangle. If there is no active region, copy just the current field. The process ignores horizontal separator lines.

C-c C-x C-y (org-table-paste-rectangle) Paste a rectangular region into a table. The upper left corner ends up in the current field. All involved fields will be overwritten. If the rectangle does not fit into the present table, the table is enlarged as needed. The process ignores horizontal separator lines.

1 个赞