summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2008-11-26 09:14:09 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2008-11-26 09:14:09 +0100
commit69ac82e1e6557c15dbcfaa8498118f64666cd762 (patch)
tree24611664c0c2ffa2a4c3a1f50feff6c7963f8b88
parent07c77bc4dce67f92959047a7861a089e8be08303 (diff)
downloadorg-mode-69ac82e1e6557c15dbcfaa8498118f64666cd762.tar.gz
Make `C-c |' work in orgtbl-mode.
This key needs special treatment, because it needs to work *outside* tables. The patch introduces a special command to call the creation/conversion function if there is no conflicting binding to `C-c |' outside of orgtbl-mode.
-rwxr-xr-xlisp/ChangeLog1
-rw-r--r--lisp/org-table.el16
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5d02e1e..61f971f 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,7 @@
* org-table.el (orgtbl-self-insert-command): Make S-SPC work in
orgtbl-mode.
+ (orgtabl-create-or-convert-from-region): New command.
* org-exp.el (org-export-as-ascii): Remove the handling of
targets.
diff --git a/lisp/org-table.el b/lisp/org-table.el
index ffab7ad..22a6be0 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3323,7 +3323,6 @@ to execute outside of tables."
'("\C-c'" org-table-edit-formulas)
'("\C-c`" org-table-edit-field)
'("\C-c*" org-table-recalculate)
- '("\C-c|" org-table-create-or-convert-from-region)
'("\C-c^" org-table-sort-lines)
'([(control ?#)] org-table-rotate-recalc-marks)))
elt key fun cmd)
@@ -3357,6 +3356,8 @@ to execute outside of tables."
[(meta return)] "\M-\C-m"))
(org-defkey orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c)
+ (org-defkey orgtbl-mode-map "\C-c|" 'orgtbl-create-or-convert-from-region)
+
(when orgtbl-optimized
;; If the user wants maximum table support, we need to hijack
;; some standard editing functions
@@ -3367,6 +3368,9 @@ to execute outside of tables."
(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
(easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
'("OrgTbl"
+ ["Create or convert" org-table-create-or-convert-from-region
+ :active (not (org-at-table-p)) :keys "C-c |" ]
+ "--"
["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
["Next Field" org-cycle :active (org-at-table-p) :keys "TAB"]
["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"]
@@ -3451,6 +3455,16 @@ With prefix arg, also recompute table."
(t (let (orgtbl-mode)
(call-interactively (key-binding "\C-c\C-c")))))))
+(defun orgtbl-create-or-convert-from-region (arg)
+ "Create table or convert region to table, if no conflicting binding.
+This installs the table binding `C-c |', but only if there is no
+conflicting binding to this key outside orgtbl-mode."
+ (interactive "P")
+ (let* (orgtbl-mode (cmd (key-binding "\C-c|")))
+ (if cmd
+ (call-interactively cmd)
+ (call-interactively 'org-table-create-or-convert-from-region))))
+
(defun orgtbl-tab (arg)
"Justification and field motion for `orgtbl-mode'."
(interactive "P")