emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Switching buffers from babel snippets


From: Marco Wahl
Subject: Re: [O] Switching buffers from babel snippets
Date: Sun, 15 Jan 2017 12:58:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Alex Bennée <address@hidden> writes:

Hi,

> I've trying to further automate my maintainer tasks by moving things
> into babel snippets. I have one to find a cover letter and edit the
> file:
>
> #+name: edit-cover-letter
> #+begin_src emacs-lisp :var cover=create-qemu-pull[0]
>
>   (find-file (expand-file-name (concat default-directory (car cover))))
>   (mail-mode)
> #+end_src
>
> However when I run the code although the file is loaded and in the right
> mode I never see the buffer come up and have to switch to it manually. I
> expect this is because the code is running under some sort of
> safe-excursion. Is there anyway to pass a final buffer back to org-mode
> after the code is run and switch to it?

Actually I don't know why the switch to the other buffer does not apply
with the babel execution.

For a practical realization you could use a timer.

#+begin_src emacs-lisp :var cover="cover.txt"
(let ((buf (find-file cover)))
  (mail-mode)
  (run-at-time 1 nil #'switch-to-buffer buf))
#+end_src


Ciao

                       Marco





reply via email to

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