在Emacs中添加/删除列电子表格功能? [英] Add/remove column spreadsheet features in Emacs?

查看:146
本文介绍了在Emacs中添加/删除列电子表格功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 
abc | efg | 123 | xyz123abc | yes
xxx | bbb | cc | ddd | no

例如说,我想添加一个第3列默认值为1并删除第4列,因此数据将如下所示:

 
abc | efg | 1 | 123 |是
xxx | bbb | 1 | cc | no

我正在研究组织模式表作为起点,

 
| abc | efg | 123 | xyz123abc |
| xxx | bbb | cc | ddd |
| | | | |


解决方案

我刚刚发现如何将数据导入SES(没有导入功能,但事实证明,您可以简单地yank分页数据),所以这个答案比使用表捕获更简单:)(除非你的数据包含选项卡,在这种情况下你需要解决) 。



SES是Emacs中的实际电子表格应用程序。有关详细信息,请参阅其信息节点:

Ch i d m ses RET M - : (infoses) kbd> RET



处理数据:


  1. 转换您的原始数据至TSV,例如 M - % | RET TAB RET

  2. 删除该文本(例如选择区域,然后 Cw

  3. 创建一个临时缓冲区,并改为ses-mode: Cx b * ses * RET

    Mx ses-mode RET

    (当然, Ch m ,了解ses-mode及其关键字的描述)

  4. 将数据转入电子表格: Cy

  5. 移动到要删除的列,并使用 Mk
  6. 将其删除
  7. 复制结果回到TSV格式的杀死环: Cx h x t

    (即 mark-whole-buffer + ses-export-tsv

  8. * ses *缓冲区与 Cx k RET

  9. 将修改的TSV数据转回原始缓冲区与 Cy

  10. 将选项卡转换回 | s使用 M - %< kbd> TAB RET | RET

警告:我实际上在我的标准配置下出现了SES的问题,但是在 emacs -q 。 YMMV。


Given delimited data in the following format, how can I insert and delete columns?

abc|efg|123|xyz123abc|yes
xxx|bbb|cc|ddd|no

Say, for example, that I wanted to add a 3rd column with a default value of 1 and remove the 4th column so the data would look like this:

abc|efg|1|123|yes
xxx|bbb|1|cc|no

I was looking into org-mode tables as a starting point, however it puts extra spaces around the data.

| abc | efg | 123 | xyz123abc |
| xxx | bbb | cc  | ddd       |
|     |     |     |           |

解决方案

Well I just found out how to import data into SES (there are no "ses-import" functions, but it turns out you can simply yank tab-separated data), so this answer is even simpler than using table-capture :) (unless your data contains tabs, in which case you'll need to work around that).

SES is an actual spreadsheet application within Emacs. See its info node for details:
C-hidm ses RET, or M-: (info "ses") RET

To process the data:

  1. Convert your original data to TSV with, say, M-%|RETTABRET!
  2. Kill that text (e.g. select region, then C-w)
  3. Create a temporary buffer and change to ses-mode: C-xb *ses* RET
    M-x ses-mode RET
    (and of course, C-hm for a description of ses-mode, and its keybindings)
  4. Yank the data into the spreadsheet: C-y
  5. Move point to the column to delete, and kill it with M-k
  6. Copy the result back to the kill ring in TSV format: C-xhxt
    (i.e. mark-whole-buffer + ses-export-tsv)
  7. Kill the *ses* buffer with C-xkRET
  8. Yank the modified TSV data back into the original buffer with C-y
  9. Convert the tabs back to |s with M-%TABRET|RET!

Caveat: I'm actually having issues yanking into SES under my standard config, but this process works fine under emacs -q. YMMV.

这篇关于在Emacs中添加/删除列电子表格功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆