emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Temporally/occasionally turn off hooks?
Date: Tue, 29 Jan 2013 13:05:37 +0100	[thread overview]
Message-ID: <87r4l42nzi.fsf@googlemail.com> (raw)


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

             reply	other threads:[~2013-01-29 12:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 12:05 Thorsten Jolitz [this message]
2013-01-29 19:14 ` Temporally/occasionally turn off hooks? Bernt Hansen
2013-01-30 12:21   ` Thorsten Jolitz

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=87r4l42nzi.fsf@googlemail.com \
    --to=tjolitz@googlemail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).