diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-11-17 13:58:52 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-11-17 13:58:52 +0100 |
commit | b3d6f0448380c0dc35126ba235f1902ff8b83ad7 (patch) | |
tree | def26af83e3ff4cc395f95a3bc0fc42d137e5e51 | |
parent | 571e3d985c0a6469a287e52a146c99606f80b926 (diff) | |
download | org-mode-b3d6f0448380c0dc35126ba235f1902ff8b83ad7.tar.gz |
New hook to run after orgtbl-mode has sent a table
* lisp/org-table.el (orgtbl-after-send-table-hook): New hook.
(orgtbl-ctrl-c-ctrl-c): Run `orgtbl-after-send-table-hook' when a
table was sent.
(orgtbl-send-table): Return the number of sent tables, or nil if no
sending has happened.
Patch by Seweryn Kokot. TINYCHANGE
-rw-r--r-- | lisp/org-table.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el index 0d61a78..3de6ae9 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -48,6 +48,12 @@ (defvar org-export-html-table-tag) ; defined in org-exp.el (defvar constants-unit-system) +(defvar orgtbl-after-send-table-hook nil + "Hook for functions attaching to `C-c C-c', if the table is sent. +This can be used to add additional functionality after the table is sent +to the receiver position, othewise, if table is not sent, the functions +are not run.") + (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) "Non-nil means use the optimized table editor version for `orgtbl-mode'. In the optimized version, the table editor takes over all simple keys that @@ -3729,7 +3735,8 @@ With prefix arg, also recompute table." (call-interactively 'org-table-recalculate) (org-table-maybe-recalculate-line)) (call-interactively 'org-table-align) - (orgtbl-send-table 'maybe)) + (when (orgtbl-send-table 'maybe) + (run-hooks 'orgtbl-after-send-table-hook))) ((eq action 'recalc) (save-excursion (beginning-of-line 1) @@ -3943,7 +3950,10 @@ this table." (orgtbl-send-replace-tbl name txt)) (setq ntbl (1+ ntbl))) (message "Table converted and installed at %d receiver location%s" - ntbl (if (> ntbl 1) "s" ""))))) + ntbl (if (> ntbl 1) "s" "")) + (if (> ntbl 0) + ntbl + nil)))) (defun org-remove-by-index (list indices &optional i0) "Remove the elements in LIST with indices in INDICES. |