From: Marco Wahl <marcowahlsoft@gmail.com>
To: emacs-orgmode@gnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: Switching buffers from babel snippets
Date: Sun, 15 Jan 2017 12:58:26 +0100 [thread overview]
Message-ID: <84r344a61p.fsf@gmail.com> (raw)
In-Reply-To: 87ziit1mff.fsf@linaro.org
Alex Bennée <alex.bennee@linaro.org> 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
prev parent reply other threads:[~2017-01-15 11:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-14 19:17 Switching buffers from babel snippets Alex Bennée
2017-01-15 11:58 ` Marco Wahl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84r344a61p.fsf@gmail.com \
--to=marcowahlsoft@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).