From: Michael Gauland <mikelygee@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Different listing styles for same babel language?
Date: Mon, 7 Aug 2017 13:06:50 +1200 [thread overview]
Message-ID: <fc0d3470-7f9a-8f28-2b16-34b6a09742dc@gmail.com> (raw)
In-Reply-To: <alpine.OSX.2.20.1707240936280.1562@charlessmacbook.attlocal.net>
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
I recently wrote:
>> My org documents include lots of source code blocks, in a variety of
>> languages. I use the listings package to give each language a
>> distinctive look.
>>
>> Lately, my work has involved using shell commands on different machines,
>> as different users. I'd like to give each shell environment (e.g., local
>> user, normal user on remote host, root on remote host) a different look.
>> At the moment, I'm doing this by specifying different shells (bash,
>> dash, sh) for each. This works, especially since I'm not executing the
>> commands from emacs, so it doesn't matter which shell I specify.
>>
>> Is there a better way to do this?
>>
>
I've found that #+ATTR_LATEX: :options language=.... does exactly what I
was looking for. The attached example may be useful to others.
[-- Attachment #2: lstyle-example.org --]
[-- Type: text/plain, Size: 888 bytes --]
#+LATEX_HEADER: \lstset{frame=shadowbox}
#+LATEX_HEADER: \lstdefinelanguage{bash-local}{rulesepcolor=\color{cyan}}
#+LATEX_HEADER: \lstdefinelanguage{bash-remote}{rulesepcolor=\color{yellow}}
#+LATEX_HEADER: \lstdefinelanguage{bash-remote-root}{rulesepcolor=\color{orange}}
#+PROPERTY: header-args :eval never
#+ATTR_LATEX: :options language=bash-local
#+BEGIN_SRC bash :results output :eval ask
# Run this script on the local host
# Install the key in the VM:
ssh-copy-id -i ~/.ssh/vm \
-p 3022 user@127.0.0.1
#+END_SRC
#+RESULTS:
#+ATTR_LATEX: :options language=bash-remote-root
#+BEGIN_SRC bash
# Run this as root on the remote host
apt-get update
apt-get -y install git
#+END_SRC
#+ATTR_LATEX: :options language=bash-remote
#+BEGIN_SRC bash :results output :eval ask
# Run this as a normal user on the remote host
cd project
git pull
make
#+END_SRC
next prev parent reply other threads:[~2017-08-07 1:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 0:34 Different listing styles for same babel language? Michael Gauland
2017-07-24 16:37 ` Charles C. Berry
2017-08-07 1:06 ` Michael Gauland [this message]
2017-07-24 23:54 ` Adam Porter
-- strict thread matches above, loose matches on Subject: below --
2017-07-20 1:14 Michael Gauland
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=fc0d3470-7f9a-8f28-2b16-34b6a09742dc@gmail.com \
--to=mikelygee@gmail.com \
--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).