emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook


From: Carsten Dominik
Subject: Re: [Orgmode] Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook
Date: Wed, 17 Nov 2010 14:00:47 +0100

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 <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




_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten






reply via email to

[Prev in Thread] Current Thread [Next in Thread]