emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Seweryn Kokot <sewkokot@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: [REQUEST] orgtbl-ctrl-c-ctrl-c-hook
Date: Wed, 17 Nov 2010 10:30:09 +0100	[thread overview]
Message-ID: <B65696B4-9395-4CF5-A601-DAF6F0D90810@gmail.com> (raw)
In-Reply-To: <loom.20101117T100216-16@post.gmane.org>

Hi Seweryn,

On Nov 17, 2010, at 10:10 AM, Seweryn Kokot wrote:

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


I am a bit confused by this patch.  You do call the hook after C-c C-c  
has done its thing.  Which is OK, but this is not what the  
documentation in your hook variable says.  That documentation seems to  
have been copied from the normal ctrl-c-ctrl-c hook, and these hooks  
are used in a different way:  They establish *alternative*  
functionality to the normal C-c C-c actions.  So if any of the hook  
functions returns a non-nil value, the normal C-c C-c functionality  
will *not* be executed.

So what are your true intentions, and can you make code and  
documentation macht up?

Thanks

- Carsten


>
> , and  finished.  Wed Nov 17 10:08:00 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

  reply	other threads:[~2010-11-17  9:30 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 [this message]
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
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=B65696B4-9395-4CF5-A601-DAF6F0D90810@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sewkokot@gmail.com \
    /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).