29

Is there a built-in command to delete the contents of a cell in a single keystroke within an org-mode table? Note, I don't want to delete the row, just the cell contents.

 | some text |  ==> |             |

If not, how would you write this?

NickD
  • 27,023
  • 3
  • 23
  • 42
wdkrnls
  • 3,657
  • 2
  • 27
  • 46

2 Answers2

40

org-table-blank-field, present in the “Tbl” menu.

It used to be bound to C-c SPC, but version 9.5 removed that default binding.

It's been around at least since version 6.01 in 2008, but for some reason it was only added to the manual as a consequence of this question.

  • exactly what I was looking for. Thanks! – wdkrnls Sep 23 '14 at 20:57
  • It has documented in the doc because of this question. The commit is http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=9aa58fa . Requested https://lists.gnu.org/archive/html/emacs-orgmode/2014-11/msg00493.html – Yasushi Shoji Feb 08 '16 at 11:23
  • `org-table-blank-field` will clear the current line in a cell, but if the cell has multiple lines, it will still only affect the current line – rdcdr Feb 02 '17 at 18:50
  • Note that you can also set the mark with `C-SPC`, move the cursor, and use this command to clear a range of rows and/or columns in one go. – shawkinaw Nov 13 '19 at 18:52
  • To reset the binding: `(define-key org-mode-map (kbd "C-c SPC") 'org-table-blank-field)` – kotchwane May 10 '23 at 15:40
15

org-table-blank-field as already said, but also if you move to the cell with TAB, then typing will clear the cell content and replace it with what you type.

JeanMichel
  • 355
  • 2
  • 10