all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Help needed with post-command-hook
@ 2014-09-14  9:37 Thorsten Jolitz
  2014-09-14 14:17 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-14  9:37 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

I have three questions wrt `post-command-hook':

 - Is `post-command-hook' triggered when an interactive function is
   called non-interactively?

 - If not, what would be the equivalent hook for `funcall`, i.e. the
   Emacs 'post-funcall-hook'? I could not find one. Many functions
   change or insert, but some just move point, so using a post change or
   post insert hook would not cover all cases (or would moving point
   trigger a post change hook?).

 - When is `post-command-hook' triggered? When I (e.g.)
   `call-interactively' an Org command in a temporary Org-mode buffer,
   and a function that exits that temp-buffer was added to the local
   `post-command-hook', I would expect that once the Org command is
   done that 'exit' function is called. But instead the temp buffer
   still sits there, and its my next user action (e.g. typing C-n) that
   then triggers the hook and calls the 'exit' function. So it seems
   `post-command-hook' is triggered when another command is called, not
   when current command returns control? 

-- 
cheers,
Thorsten





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

* Re: Help needed with post-command-hook
  2014-09-14  9:37 Help needed with post-command-hook Thorsten Jolitz
@ 2014-09-14 14:17 ` Stefan Monnier
  2014-09-15  9:02   ` Thorsten Jolitz
       [not found]   ` <mailman.8879.1410771787.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-09-14 14:17 UTC (permalink / raw)
  To: help-gnu-emacs

>  - Is `post-command-hook' triggered when an interactive function is
>    called non-interactively?

No.  It's not even run when you do (call-interactively 'foo).
It's run by the command-loop (which does: read-key, lookup-command, run
pre-command-hook, run command, run post-command-hook, ...).

What are you trying to do?


        Stefan




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

* Re: Help needed with post-command-hook
       [not found] <mailman.8853.1410687492.1147.help-gnu-emacs@gnu.org>
@ 2014-09-14 16:32 ` Barry Margolin
  2014-09-15  9:03   ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Margolin @ 2014-09-14 16:32 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.8853.1410687492.1147.help-gnu-emacs@gnu.org>,
 Thorsten Jolitz <tjolitz@gmail.com> wrote:

> Hi List, 
> 
> I have three questions wrt `post-command-hook':
> 
>  - Is `post-command-hook' triggered when an interactive function is
>    called non-interactively?
> 
>  - If not, what would be the equivalent hook for `funcall`, i.e. the
>    Emacs 'post-funcall-hook'? I could not find one. Many functions
>    change or insert, but some just move point, so using a post change or
>    post insert hook would not cover all cases (or would moving point
>    trigger a post change hook?).

There's no hook for all function calls. That would be way overkill.

If you want to do something after a specific function, advise it.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: Help needed with post-command-hook
  2014-09-14 14:17 ` Stefan Monnier
@ 2014-09-15  9:02   ` Thorsten Jolitz
  2014-09-15 12:50     ` Phillip Lord
       [not found]   ` <mailman.8879.1410771787.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-15  9:02 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>  - Is `post-command-hook' triggered when an interactive function is
>>    called non-interactively?
>
> No.  It's not even run when you do (call-interactively 'foo).
> It's run by the command-loop (which does: read-key, lookup-command, run
> pre-command-hook, run command, run post-command-hook, ...).

ok, thanks.

> What are you trying to do?

I wanted to call a function in a temp-buffer and then close that temp
buffer after the function/cmd is done. And it seems to work now without
using any hooks, just by sequential functions calls (as expected). 

I suspect the reason it did not work yesterday has to do something with
the function/cmd that was actually called, not sure though what it was. 

So this question was kind of noise, sorry. 

-- 
cheers,
Thorsten




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

* Re: Help needed with post-command-hook
  2014-09-14 16:32 ` Barry Margolin
@ 2014-09-15  9:03   ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-15  9:03 UTC (permalink / raw)
  To: help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.8853.1410687492.1147.help-gnu-emacs@gnu.org>,
>  Thorsten Jolitz <tjolitz@gmail.com> wrote:
>
>> Hi List, 
>> 
>> I have three questions wrt `post-command-hook':
>> 
>>  - Is `post-command-hook' triggered when an interactive function is
>>    called non-interactively?
>> 
>>  - If not, what would be the equivalent hook for `funcall`, i.e. the
>>    Emacs 'post-funcall-hook'? I could not find one. Many functions
>>    change or insert, but some just move point, so using a post change or
>>    post insert hook would not cover all cases (or would moving point
>>    trigger a post change hook?).
>
> There's no hook for all function calls. That would be way overkill.
>
> If you want to do something after a specific function, advise it.

Ok, thanks for the tip. 

-- 
cheers,
Thorsten




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

* Re: Help needed with post-command-hook
       [not found]   ` <mailman.8879.1410771787.1147.help-gnu-emacs@gnu.org>
@ 2014-09-15 11:16     ` Joost Kremers
  2014-09-15 12:41       ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Joost Kremers @ 2014-09-15 11:16 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz wrote:
> I wanted to call a function in a temp-buffer and then close that temp
> buffer after the function/cmd is done. And it seems to work now without
> using any hooks, just by sequential functions calls (as expected). 

Are you aware of the macro `with-temp-buffer'? :-)



-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


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

* Re: Help needed with post-command-hook
  2014-09-15 11:16     ` Joost Kremers
@ 2014-09-15 12:41       ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-15 12:41 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers <joost.m.kremers@gmail.com> writes:

> Thorsten Jolitz wrote:
>> I wanted to call a function in a temp-buffer and then close that temp
>> buffer after the function/cmd is done. And it seems to work now without
>> using any hooks, just by sequential functions calls (as expected). 
>
> Are you aware of the macro `with-temp-buffer'? :-)

yes, but things are a bit more complicated ...

-- 
cheers,
Thorsten




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

* Re: Help needed with post-command-hook
  2014-09-15  9:02   ` Thorsten Jolitz
@ 2014-09-15 12:50     ` Phillip Lord
  0 siblings, 0 replies; 8+ messages in thread
From: Phillip Lord @ 2014-09-15 12:50 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:
>> What are you trying to do?
>
> I wanted to call a function in a temp-buffer and then close that temp
> buffer after the function/cmd is done. And it seems to work now without
> using any hooks, just by sequential functions calls (as expected). 

`with-temp-buffer'

Phil



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

end of thread, other threads:[~2014-09-15 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-14  9:37 Help needed with post-command-hook Thorsten Jolitz
2014-09-14 14:17 ` Stefan Monnier
2014-09-15  9:02   ` Thorsten Jolitz
2014-09-15 12:50     ` Phillip Lord
     [not found]   ` <mailman.8879.1410771787.1147.help-gnu-emacs@gnu.org>
2014-09-15 11:16     ` Joost Kremers
2014-09-15 12:41       ` Thorsten Jolitz
     [not found] <mailman.8853.1410687492.1147.help-gnu-emacs@gnu.org>
2014-09-14 16:32 ` Barry Margolin
2014-09-15  9:03   ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.