emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Seweryn Kokot
Subject: [Orgmode] Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook
Date: Wed, 17 Nov 2010 09:10:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Carsten Dominik <carsten.dominik <at> gmail.com> writes:

> 
> 
> On Nov 17, 2010, at 9:19 AM, Seweryn Kokot wrote:
> 
> > Hi,
> >
> > It need to attach a function to C-c C-c keybinding when exporting a  
> > table in
> > orgtbl-mode so would be nice to have orgtbl-ctrl-c-ctrl-c-hook  
> > similar to
> > org-ctrl-c-ctrl-c-hook.
> 
> This is a reasonable request - please make me a patch.

See the following patch. It seems to work in my case, but please correct it if 
necessary because I don't know if (run-hook-with-args-until-success 'orgtbl-
ctrl-c-ctrl-c-hook) line is in the right place.

Regards,
Seweryn

--- 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 10:07:34.000000000 +0100
@@ -48,6 +48,15 @@
 (defvar org-export-html-table-tag) ; defined in org-exp.el
 (defvar constants-unit-system)
 
+(defvar orgtbl-ctrl-c-ctrl-c-hook nil
+  "Hook for functions attaching themselves to  `C-c C-c'.
+This can be used to add additional functionality to the C-c C-c key which
+executes context-dependent commands.
+Each function will be called with no arguments.  The function must check
+if the context is appropriate for it to act.  If yes, it should do its
+thing and then return a non-nil value.  If the context is wrong,
+just do nothing and return nil.")
+
 (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 +3738,8 @@
          (call-interactively 'org-table-recalculate)
        (org-table-maybe-recalculate-line))
       (call-interactively 'org-table-align)
-      (orgtbl-send-table 'maybe))
+      (orgtbl-send-table 'maybe)
+      (run-hook-with-args-until-success 'orgtbl-ctrl-c-ctrl-c-hook))
      ((eq action 'recalc)
       (save-excursion
        (beginning-of-line 1)

Diff finished.  Wed Nov 17 10:08:00 2010





reply via email to

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