emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Seweryn Kokot <sewkokot@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook
Date: Wed, 17 Nov 2010 12:41:18 +0000 (UTC)	[thread overview]
Message-ID: <loom.20101117T134017-741@post.gmane.org> (raw)
In-Reply-To: C379C10A-262A-4E6D-9B95-B252206E1B36@gmail.com

Carsten Dominik <carsten.dominik <at> 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

  parent reply	other threads:[~2010-11-17 12:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17  8:19 [REQUEST] orgtbl-ctrl-c-ctrl-c-hook Seweryn Kokot
2010-11-17  8:28 ` Carsten Dominik
2010-11-17  9:10   ` Seweryn Kokot
2010-11-17  9:30     ` Carsten Dominik
2010-11-17  9:58       ` Seweryn Kokot
2010-11-17 10:04         ` Carsten Dominik
2010-11-17 10:16           ` Seweryn Kokot
2010-11-17 12:41           ` Seweryn Kokot [this message]
2010-11-17 13:00             ` Carsten Dominik
2010-11-17 13:06               ` Seweryn Kokot
2010-11-17 13:09                 ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20101117T134017-741@post.gmane.org \
    --to=sewkokot@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).