unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to run a function when I save a file of a particular type
@ 2006-10-27 14:17 joearms
  2006-10-27 14:26 ` David Kastrup
  0 siblings, 1 reply; 2+ messages in thread
From: joearms @ 2006-10-27 14:17 UTC (permalink / raw)



How can I run a function (say foo) just before I save a file
with extension ".bar"

/Joe

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

* Re: how to run a function when I save a file of a particular type
  2006-10-27 14:17 how to run a function when I save a file of a particular type joearms
@ 2006-10-27 14:26 ` David Kastrup
  0 siblings, 0 replies; 2+ messages in thread
From: David Kastrup @ 2006-10-27 14:26 UTC (permalink / raw)


"joearms@gmail.com" <joearms@gmail.com> writes:

> How can I run a function (say foo) just before I save a file
> with extension ".bar"

(add-hook 'before-save-hook
  (lambda nil
    (and (stringp buffer-file-name)
         (string= (file-name-extension buffer-file-name t) ".bar")
         (foo))))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2006-10-27 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-27 14:17 how to run a function when I save a file of a particular type joearms
2006-10-27 14:26 ` David Kastrup

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