Browse Source

org.el: Let `C-o' insert a new row in tables and open a line elsewhere

* org.el (org-ctrl-o): New command to insert a new row in
tables (like `M-S-<down>' does) and open a line elsewhere.
(org-mode-map): Bind the new command to `C-o'.
Bastien Guerry 12 năm trước cách đây
mục cha
commit
45d6d8f8a2
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      lisp/org.el

+ 8 - 0
lisp/org.el

@@ -18979,6 +18979,7 @@ BEG and END default to the buffer boundaries."
 (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
 (org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches)
 (org-defkey org-mode-map "\C-c#"    'org-update-statistics-cookies)
+(org-defkey org-mode-map "\C-o"     'org-ctrl-o)
 (org-defkey org-mode-map "\C-m"     'org-return)
 (org-defkey org-mode-map "\C-j"     'org-return-indent)
 (org-defkey org-mode-map "\C-c?"    'org-table-field-info)
@@ -20237,6 +20238,13 @@ Also updates the keyword regular expressions."
     (let ((org-note-abort t))
       (funcall org-finish-function))))
 
+(defun org-ctrl-o (n)
+  "Insert a new row in tables, call `open-line' elsewhere."
+  (interactive "*p")
+  (if (org-at-table-p)
+      (org-table-insert-row)
+    (open-line n)))
+
 (defun org-return (&optional indent)
   "Goto next table row or insert a newline.
 Calls `org-table-next-row' or `newline', depending on context.