RE: Before-save-hook

"Dan Bar Dov" <[email protected]> Tue, 31 Aug 2004 09:27:00 +0300
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Many thanks, it works now.

Dan 

> -----Original Message-----
> From: Markus Heiser [mailto:[email protected]] 
> Sent: Monday, August 30, 2004 11:12 PM
> To: Dan Bar Dov
> Cc: [email protected]
> Subject: Re: Before-save-hook
> 
> Hello Dan,
> 
> Dan Bar Dov wrote:
>  > Thanks,
>  > So I wrote this - but it does not seem to work. Any idea why?
>  > ... (see below)
> 
> ... there is a typing error in your coding:
> 
>   your typed:  'write-contents-hook'
>   correct:     'write-contents-hooks'
>                                   ^^^^
> 
> I think there is more then one hook called, I decided to use 
> the write-file-hooks list, why? ... take a look at the 
> documentation of both.
> 
> here my result:
> 
> (add-hook 'c-mode-hook (lambda ()
> 			 (tabify (point-min) (point-max))
> 			 (add-local-hook 'write-file-hooks
>                                           (lambda () 
> (untabify (point-min) (point-max)))
>                                           )))
> 
> ... I'am sorry but lisp (and english also) is not my favorit language.
> 
> --
> Mit freundlichem Gruss
> 
>    -- M.Heiser --
> 
> ------------------------------------------------------------
>    Besuchen Sie uns:
>    07.-09.09.2004  -  DMS, Essen (Halle 2, Stand 2315)
>    11.-14.10.2004  -  CAT.PRO, Suttgart (Halle 4.0, Stand 236)
> ------------------------------------------------------------
>    Markus Heiser
>    Dipl. Ing. Physiktechnik (FH)     Tel. : +49 421 20153 0
>    CONTACT Software GmbH (Abt.SE)    FAX  : +49 421 20153 41
>    Wiener Str. 1-3                   eMail: [email protected]
>    D - 28359 Bremen                  http://www.contact.de
> ------------------------------------------------------------
> 
> 
> Dan Bar Dov wrote:
>  > Thanks,
>  >
>  > So I wrote this - but it does not seem to work. Any idea why?
>  >
>  > (defun c-untabify (arg)
>  >   "untabify buffer"
>  >   (interactive "p")
>  >     (untabify (point-min) (point-max))
>  >     )
>  >
>  > (add-hook 'c-mode-hook (lambda ()
>  > 			 (setq c-basic-offset 4
>  > 			       c-recognize-knr-p nil
>  > 			       c-style "k&r"
>  > 			       comment-column 40)
>  > 			 (tabify (point-min) (point-max))
>  > 			 (make-local-hook
>  > 			  'write-contents-hook)
>  > 			 (add-local-hook 'write-contents-hook
>  > 'c-untabify)
>  > 			
>  > ))
>  >
>  > Probably the tabify should be in some other hook, but I 
> expected the  > write hook to work.
>  >
>  > Dan
>  >
> 
>