emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug: Problem with hook added to org-mode-hook [8.2.6 (release_8.


From: Bastien
Subject: Re: [O] Bug: Problem with hook added to org-mode-hook [8.2.6 (release_8.2.6-1 @ /usr/local/share/emacs/24.4.50/lisp/org/)]
Date: Mon, 28 Jul 2014 11:25:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi Tianxiang,

Tianxiang Xiong <address@hidden> writes:

> (add-hook 'org-mode-hook
>           (lambda ()
>              (add-hook 'after-save-hook 'tangle-init nil t)))
>
> However, when I open my init.org file, I see that the after-save-hook
> variable is nil. If I manually reapply org-mode, however, it works as
> expected.

If you define the hook then kill the buffer containing init.org then
reopens it, you don't need to manually M-x org-mode RET in order for
the hook to be taken into account.  IOW: the hook runs fine, it's
just that your buffer was already in org-mode.

Can you confirm this?

To me

(add-hook 'after-save-hook (lambda ()
  (when (derived-mode-p 'org-mode)
    (tangle-init)))

seems more "natural" anyway.

Thanks,

-- 
 Bastien



reply via email to

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