unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* running function in hook dependent on value of a variable
@ 2013-06-13 14:26 Rainer M Krug
  2013-06-14  5:11 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Rainer M Krug @ 2013-06-13 14:26 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

Hi

I want to run a function in a hook only if the value of a variable is
non-nil. I have gotten that far with my less then rudimentary lisp knowledge:

,----
| (defvar org-babel-tangle-run-postTangleScript nil
|   "If non-nil, postTangleScript.sh will be executed")
| (put 'org-babel-tangle-run-postTangleScript 'safe-local-variable 'booleanp)
| 
| (defun org-babel-run-post-tangle-script ()
|   (if org-babel-tangle-run-postTangleScript
|       (	(message "running the postTangleScript.sh bash shell script")
| 	(shell-command "bash ./postTangleScript.sh"))))
| 
| (add-hook 'org-babel-post-tangle-hook 'org-babel-run-post-tangle-script)
`----

But something is wrong with the function, as it does not work. 

Any suggestions?

The idea is to be able to enable and disable the execution of this
postTangleScript.sh file on a per-file-basis using file-local-variables.

Ultimately, I would like to be able to execute a script whose name is
stored in the variable org-babel-tangle-run-postTangleScript and not
hardcoded. 

Also, if the variable and the function should follow a certain naming
convention, please let me know.

Thanks,

Rainer

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <mailman.1558.1371133630.22516.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2013-06-14  7:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-13 14:26 running function in hook dependent on value of a variable Rainer M Krug
2013-06-14  5:11 ` Kevin Rodgers
2013-06-14  7:39   ` Rainer M Krug
     [not found] <mailman.1558.1371133630.22516.help-gnu-emacs@gnu.org>
2013-06-13 15:18 ` Barry Margolin
2013-06-14  7:45   ` Rainer M Krug

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