From mboxrd@z Thu Jan 1 00:00:00 1970 From: Seweryn Kokot Subject: Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook Date: Wed, 17 Nov 2010 12:41:18 +0000 (UTC) Message-ID: References: <2F4D54FD-C457-4372-8871-2F1A022FF082@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=42830 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIhKP-00014w-L6 for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 07:41:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PIhKO-0005XU-G1 for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 07:41:33 -0500 Received: from lo.gmane.org ([80.91.229.12]:32967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PIhKO-0005XB-1U for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 07:41:32 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PIhKM-0006at-B4 for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 13:41:30 +0100 Received: from 139.191.131.39 ([139.191.131.39]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Nov 2010 13:41:30 +0100 Received: from sewkokot by 139.191.131.39 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Nov 2010 13:41:30 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Carsten Dominik gmail.com> writes: > > Should the be run only if the sending was successful? Or also for > tables > where have no ORGTBD SEND statement? We could make orgtbl-send-table > return a value indicating if sending has taken place. > > We might want to call the hook orgtbl-after-send-table-hook... What about this patch? --- h:/org-mode/lisp/org-table.el 2010-11-16 11:17:36.000000000 +0100 +++ h:/org-mode/lisp/org-table-new.el 2010-11-17 13:35:58.000000000 +0100 @@ -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 @@ -3726,10 +3732,11 @@ (goto-char action) (org-table-maybe-eval-formula) (if arg - (call-interactively 'org-table-recalculate) - (org-table-maybe-recalculate-line)) + (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 @@ (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) + t + nil)))) (defun org-remove-by-index (list indices &optional i0) "Remove the elements in LIST with indices in INDICES. Diff finished. Wed Nov 17 13:38:17 2010