From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tobias Frischholz Subject: shell scripts in yasnippet? Date: Thu, 3 Sep 2015 17:06:45 +0200 Message-ID: <16A16A59-258B-4A8F-9E8F-F2D82B9735CB@friolz.com> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_1C6D8E3B-642E-4A9F-ADFB-9320B66AC9F5" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXW6I-0006i7-Pe for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 11:06:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXW6D-0007ys-Kz for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 11:06:54 -0400 Received: from sculptor.uberspace.de ([95.143.172.183]:42717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXW6D-0007yf-Bd for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 11:06:49 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Mailing List --Apple-Mail=_1C6D8E3B-642E-4A9F-ADFB-9320B66AC9F5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi there, right now I=E2=80=99m tinkering around with yasnippet. I was wondering if there=E2=80=99s a possibility to run a shell script = and write its results in the text file. Specifically, I=E2=80=99m want to run =E2=80=9Cfortune=E2=80=9D and put = the results in a #+BEGIN_QUOTE=E2=80=A6#+END_QUOTE block. Would that be possible? Best regards, Tobias Frischholz PGP PUBLIC KEY: http://pgp.mit.edu/pks/lookup?search=3D0xCD463AC1&op=3Dind= ex --Apple-Mail=_1C6D8E3B-642E-4A9F-ADFB-9320B66AC9F5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi there,

right now I=E2=80=99m tinkering around with = yasnippet.
I was wondering if there=E2=80=99s a = possibility to run a shell script and write its results in the text = file.

Specifically, I=E2=80=99m want to run =E2=80=9Cfortune=E2=80=9D= and put the results in a #+BEGIN_QUOTE=E2=80=A6#+END_QUOTE = block.
Would that be possible?
Best regards,
Tobias = Frischholz


= --Apple-Mail=_1C6D8E3B-642E-4A9F-ADFB-9320B66AC9F5-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: shell scripts in yasnippet? Date: Fri, 04 Sep 2015 09:20:20 -0400 Message-ID: References: <16A16A59-258B-4A8F-9E8F-F2D82B9735CB@friolz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXqus-0007ae-Vc for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 09:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXquo-0001zr-Pr for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 09:20:30 -0400 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:36346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXquo-0001zU-Ic for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 09:20:26 -0400 Received: by qkcf65 with SMTP id f65so8206579qkc.3 for ; Fri, 04 Sep 2015 06:20:25 -0700 (PDT) In-reply-to: <16A16A59-258B-4A8F-9E8F-F2D82B9735CB@friolz.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Tobias Frischholz Cc: Org Mode Mailing List This is kind of close: #+BEGIN_SRC emacs-lisp (yas-global-mode) (with-temp-buffer (insert "# name : my-fortune # key: myf # expand-env: ((yas-indent-line nil) # -- #+BEGIN_QUOTE: ${1:`(shell-command-to-string \"fortune\")`} #END_QUOTE $0 ") (yas-load-snippet-buffer-and-close 'org-mode)) #+END_SRC For some reason it is inserting some extra spaces before # for me, and I cannot figure out why. Tobias Frischholz writes: > Hi there, > > right now I’m tinkering around with yasnippet. > I was wondering if there’s a possibility to run a shell script and write its results in the text file. > > Specifically, I’m want to run “fortune” and put the results in a #+BEGIN_QUOTE…#+END_QUOTE block. > Would that be possible? > Best regards, > Tobias Frischholz > > PGP PUBLIC KEY: http://pgp.mit.edu/pks/lookup?search=0xCD463AC1&op=index -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: shell scripts in yasnippet? Date: Sun, 06 Sep 2015 12:34:31 -0400 Message-ID: References: <16A16A59-258B-4A8F-9E8F-F2D82B9735CB@friolz.com> <26CFED0F-553B-4E68-9006-E2A705FE8903@friolz.com> <930BB4CD-C957-45BA-8396-B79FAA8B7727@friolz.com> <7522ECBF-F9AB-4262-B6AF-58536E6C4D45@friolz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYctt-00008A-DX for emacs-orgmode@gnu.org; Sun, 06 Sep 2015 12:34:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYctp-0003KL-B6 for emacs-orgmode@gnu.org; Sun, 06 Sep 2015 12:34:41 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:36728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYctp-0003JM-6y for emacs-orgmode@gnu.org; Sun, 06 Sep 2015 12:34:37 -0400 Received: by qgx61 with SMTP id 61so48983947qgx.3 for ; Sun, 06 Sep 2015 09:34:36 -0700 (PDT) In-reply-to: <7522ECBF-F9AB-4262-B6AF-58536E6C4D45@friolz.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Tobias Frischholz Cc: "emacs-orgmode@gnu.org" This will not work. That is not what yasnippets are for. What you want is more like this: http://kitchingroup.cheme.cmu.edu/blog/2013/10/14/Lisp-links-in-org-mode-to-dynamically-generated-content/ Or this: * test fortune #+BEGIN_SRC emacs-lisp :exports results :results org (format "#+BEGIN_QUOTE: %s ,#+END_QUOTE " (shell-command-to-string "fortune")) #+END_SRC #+BEGIN_SRC emacs-lisp :exports none (let ((org-export-babel-evaluate t)) (browse-url (org-html-export-to-html nil t))) #+END_SRC Tobias Frischholz writes: > On 05 Sep 2015, at 00:19, John Kitchin wrote: >> >> That code worked verbatim for me running it from the src block. You may not need the escaped quotes the way you are doing it. > > I tried to adopt it this way: > > #+TITLE: Wochenplan KW37 > #+AUTHOR: Tobias Frischholz > #+OPTIONS: toc:nil > #+LATEX_CLASS_OPTIONS: [a4paper] > #+LATEX_HEADER: \usepackage[german]{isodate} > > #+BEGIN_SRC emacs-lisp > #+BEGIN_QUOTE: > ${1:`(shell-command-to-string "fortune")`} > #+END_QUOTE > #+END_SRC > > * Stundenplan > > |----------------+--------------+-----------+------------+---------| > | Montag | Dienstag | Mittwoch | Donnerstag | Freitag | > |----------------+--------------+-----------+------------+---------| > | Englisch 8dM | Englisch 9dM | Mathe 9dM | | | > | Mathematik 9dM | Englisch 9dM | | | | > | | Englisch 9eM | Mathe 9eM | | | > | AWT 9dM | | | | | > | AWT 9dM | Sport 9abc | | | | > | | Sport 9abc | | | | > |----------------+--------------+-----------+------------+---------| > > * Wochenplan > > ** Montag > *** Englisch 8dM [3/3] > /Es fehlen: Hans, Sepp, Franzi/ > - [X] Wiederholung present progressive > - [X] Buch, S. 17 > - [X] HA: Buch, S. 17/1-5 > Mit Schülern vereinbart, dass Nr. 5 wegfallen kann. > > *** Mathematik 9dM [0/3] > - [ ] Pythagoras wiederholen > - [ ] Üben, S. 12/4-5 > - [ ] HA, S. 13/6a,b > > ** Dienstag > ** Mittwoch > ** Donnerstag > ** Freitag > > However nothing seems to get executed when I export to LaTeX PDF. > > — > Tobi -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu