emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug? 'org-ctrl-c-ctrl-c-final-hook not run
@ 2019-03-17 18:53 Thomas Plass
  2019-03-17 19:42 ` Marco Wahl
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Plass @ 2019-03-17 18:53 UTC (permalink / raw)
  To: emacs-orgmode

This is a question for Org API users regarding
'org-ctrl-c-ctrl-c-final-hook and how it is to be understood.

As per the docstring

   This can be used to add additional functionality to the C-c C-c key
   which executes context-dependent commands.  This hook is run after
   any other test, ...

should the 'message in the hook function below be executed?

(add-hook 'org-ctrl-c-ctrl-c-final-hook
          (function (lambda ()
                      (message "org-ctrl-c-ctrl-c-final-hook called from %s"
                               (org-element-type (org-element-context)))
                      t)))

In fact, the hook isn't run at all, although it makes no assumptions
whatsoever about its context.  

Is this the way things are intended or is this behaviour a bug?

What I'm trying to achieve is to post-process a standard Org element.
However, my target element is already taken care of by one of the
patterns in 'ctrl-c-ctrl-c, so the hook-caller is never reached.

As a workaround, I take advantage of the rest of the above docstring

   ... while ‘org-ctrl-c-ctrl-c-hook’ is run before the first test.

and add to this hook a function that recursively calls
'org-ctrl-c-ctrl-c before it does its own work - which seems
incredibly kludgy.

Thanks for any feedback.

Regards

Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug? 'org-ctrl-c-ctrl-c-final-hook not run
  2019-03-17 18:53 bug? 'org-ctrl-c-ctrl-c-final-hook not run Thomas Plass
@ 2019-03-17 19:42 ` Marco Wahl
  2019-03-17 20:50   ` Thomas Plass
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Wahl @ 2019-03-17 19:42 UTC (permalink / raw)
  To: emacs-orgmode

thunk2@arcor.de (Thomas Plass) writes:

> This is a question for Org API users regarding
> 'org-ctrl-c-ctrl-c-final-hook and how it is to be understood.
>
> As per the docstring
>
>    This can be used to add additional functionality to the C-c C-c key
>    which executes context-dependent commands.  This hook is run after
>    any other test, ...
>
> should the 'message in the hook function below be executed?
>
> (add-hook 'org-ctrl-c-ctrl-c-final-hook
>           (function (lambda ()
>                       (message "org-ctrl-c-ctrl-c-final-hook called from %s"
>                                (org-element-type (org-element-context)))
>                       t)))
>
> In fact, the hook isn't run at all, although it makes no assumptions
> whatsoever about its context.  

Your hook runs if no other C-c C-c functionality jumped in.  You could
apply C-c C-c at several locations in an Org buffer to see your hook in
action.

> Is this the way things are intended or is this behaviour a bug?

I guess this is intended.  You can add functionality for C-c C-c for
locations which don't have C-c C-c functionality yet.

> What I'm trying to achieve is to post-process a standard Org element.
> However, my target element is already taken care of by one of the
> patterns in 'ctrl-c-ctrl-c, so the hook-caller is never reached.

Exactly.

> As a workaround, I take advantage of the rest of the above docstring
>
>    ... while ‘org-ctrl-c-ctrl-c-hook’ is run before the first test.
>
> and add to this hook a function that recursively calls
> 'org-ctrl-c-ctrl-c before it does its own work - which seems
> incredibly kludgy.

Possibly it's a good idea to realize the implementation of your idea
independent of C-c C-c.  And postpone the binding with C-c C-c.


HTH, ciao,
-- 
Marco

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug? 'org-ctrl-c-ctrl-c-final-hook not run
  2019-03-17 19:42 ` Marco Wahl
@ 2019-03-17 20:50   ` Thomas Plass
  2019-03-18  8:03     ` Marco Wahl
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Plass @ 2019-03-17 20:50 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

Marco,

thanks for clearing this up.

Marco Wahl wrote at 20:42 on March 17, 2019:
: 
: Possibly it's a good idea to realize the implementation of your idea
: independent of C-c C-c.  And postpone the binding with C-c C-c.

I've developed something that initially started off as a predicate to
be called and used by Lisp, but adding an interactive mode was easy
and turns the whole thing into an Org add-on.

There are no inherent dependencies.  Binding with C-c C-c would just
be a recommendation to users as a convenient and natural way to access
the functionality.

On this note: is this list the proper channel to publish initial
versions of add-ons and solicit feedback?

Regards

Thoams

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug? 'org-ctrl-c-ctrl-c-final-hook not run
  2019-03-17 20:50   ` Thomas Plass
@ 2019-03-18  8:03     ` Marco Wahl
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Wahl @ 2019-03-18  8:03 UTC (permalink / raw)
  To: emacs-orgmode

> On this note: is this list the proper channel to publish initial
> versions of add-ons and solicit feedback?

https://orgmode.org/worg/org-contribute.html says:

	You can submit Org add-ons – there are many Org add-ons.
	- The best way is to submit your code to the mailing list to discuss it
	  with people.


Ciao,  Marco

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-18  8:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 18:53 bug? 'org-ctrl-c-ctrl-c-final-hook not run Thomas Plass
2019-03-17 19:42 ` Marco Wahl
2019-03-17 20:50   ` Thomas Plass
2019-03-18  8:03     ` Marco Wahl

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