emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-post-tangle-hook just opening tangled file
@ 2010-09-08  9:46 Miguel Ruiz
  2010-09-08 17:41 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ruiz @ 2010-09-08  9:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi

Should

  (add-hook 'org-babel-post-tangle-hook
            (lambda () (save-window-excursion
                        (find-file (buffer-file-name)))))

work in .emacs? 

The purpose is simply opening the tangled file but I think the opening happens before the tangled file has finished of being written. 

I have tried

  (add-hook 'org-babel-post-tangle-hook
            (lambda () (save-window-excursion
                        (find-file "anyfile"))))

and no problem, but the first code does nothing, apparently.

I am a beginner with elisp, so I beg your pardon.

Miguel Ruiz.




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

* Re: org-babel-post-tangle-hook just opening tangled file
  2010-09-08  9:46 org-babel-post-tangle-hook just opening tangled file Miguel Ruiz
@ 2010-09-08 17:41 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2010-09-08 17:41 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode

Hi Miguel,

The hook is run as part of the tangle process, and the tangle process
ensures that if the tangled file was not open before tangling it will
not be open after tangling, so the code you pasted below will have no
effect.

You could use the following function instead of ob-tangle to get the
behavior you've described.

(defun schulte/tangle-then-open ()
  (interactive)
  (mapc #'find-file (org-babel-tangle)))

Best -- Eric

Miguel Ruiz <rbenit68@yahoo.es> writes:

> Hi
>
> Should
>
>   (add-hook 'org-babel-post-tangle-hook
>             (lambda () (save-window-excursion
>                         (find-file (buffer-file-name)))))
>
> work in .emacs? 
>
> The purpose is simply opening the tangled file but I think the opening
> happens before the tangled file has finished of being written.
>
> I have tried
>
>   (add-hook 'org-babel-post-tangle-hook
>             (lambda () (save-window-excursion
>                         (find-file "anyfile"))))
>
> and no problem, but the first code does nothing, apparently.
>
> I am a beginner with elisp, so I beg your pardon.
>
> Miguel Ruiz.
>
>
>       
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-09-08 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08  9:46 org-babel-post-tangle-hook just opening tangled file Miguel Ruiz
2010-09-08 17:41 ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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