[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Temporally/occasionally turn off hooks?
From: |
Thorsten Jolitz |
Subject: |
[O] Temporally/occasionally turn off hooks? |
Date: |
Tue, 29 Jan 2013 13:05:37 +0100 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) |
Hi List,
I copied this from Bernt Hansens set-up:
,-----------------------------------------------------------
| org-insert-heading-hook is a variable defined in `org.el'.
| Its value is (bh/insert-heading-inactive-timestamp)
| Original value was nil
`-----------------------------------------------------------
and its often quite usefull to have a timestamp for each newly inserted
todo-item (e.g.). But in other cases, like writing documents or building
Org files programmatically, there is no need for
heading-creation-timestamps, so I would like to turn the timestamp
insertion off.
I could probably use
,-----------------------------------------
| (remove-hook
| 'org-insert-heading-hook
| 'bh/insert-heading-inactive-timestamp
| ’LOCAL)
`-----------------------------------------
to deactivate the behaviour locally, since:
,------------------------------------------------------------------------
| remove-hook is a compiled Lisp function in `subr.el'.
|
| (remove-hook HOOK FUNCTION &optional LOCAL)
|
| Remove from the value of HOOK the function FUNCTION.
| HOOK should be a symbol, and FUNCTION may be any valid function. If
| FUNCTION isn't the value of HOOK, or, if FUNCTION doesn't appear in the
| list of hooks to run in HOOK, then nothing is done. See `add-hook'.
|
| The optional third argument, LOCAL, if non-nil, says to modify
| the hook's buffer-local value rather than its default value.
`------------------------------------------------------------------------
but this is of course not a very generic solution for a program I want
to share with others, their 'org-insert-heading-hook' might look
different.
Is there a way to inhibit a hook in a program, or to run it only
conditionally in certain situations?
--
cheers,
Thorsten
- [O] Temporally/occasionally turn off hooks?,
Thorsten Jolitz <=