help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add after-save-hook to a mode


From: Jambunathan K
Subject: Re: Add after-save-hook to a mode
Date: Mon, 28 May 2012 03:41:27 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (windows-nt)

Florian Lindner <mailinglists@xgm.de> writes:

> Hello,
>
> I want to org-mobile-push executed everytime a file in org-mode is
> saved. I tried that:
>
> (add-hook 'org-mode-hook
>         (add-hook 'after-save-hook
>                   (lambda ()
>                     (org-mobile-push)
>                     )))
>
> This seems to war, but the hook is executed regardless of the mode the
> file is in. How can I restrict it to org-mode only?

(add-hook 'after-save-hook
          (lambda ()
            (when (string= mode-name "Org")
              (org-mobile-push))))


> Thanks,
>
> Florian
>
>

-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]