From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook Date: Wed, 17 Nov 2010 14:00:47 +0100 Message-ID: <7824CD37-1B9F-485C-9930-D2FA471B9E72@gmail.com> References: <2F4D54FD-C457-4372-8871-2F1A022FF082@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=52600 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIhd6-0007Ru-7r for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 08:00:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PIhd5-0000zA-5f for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 08:00:52 -0500 Received: from mail-ew0-f41.google.com ([209.85.215.41]:61511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PIhd4-0000yy-RG for emacs-orgmode@gnu.org; Wed, 17 Nov 2010 08:00:51 -0500 Received: by ewy25 with SMTP id 25so1074502ewy.0 for ; Wed, 17 Nov 2010 05:00:50 -0800 (PST) In-Reply-To: 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: Seweryn Kokot Cc: emacs-orgmode@gnu.org Hi Seweryn this is good, I have applied the patch. The only change I made was to return the number of sent tables instead of t. Thanks for the patch, and thanks for going through iterations to get this right. - Carsten On Nov 17, 2010, at 1:41 PM, Seweryn Kokot wrote: > 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 > > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten