emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: hymie@lactose.homelinux.net
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: export code with backslashes
Date: Mon, 16 Mar 2015 19:11:31 -0400	[thread overview]
Message-ID: <E1YXeAV-0004EV-Ot@lactose.homelinux.net> (raw)
In-Reply-To: <alpine.OSX.2.00.1503161517260.4697@charles-berrys-macbook.local>

"Charles C. Berry" writes:
>On Mon, 16 Mar 2015, hymie! wrote:

>> useradd -U -G wheel -p \<newline>
>> '$6$wcMRrkcdGeNHLT5b$password0ISmGZSsILOyV/WJnpassword//' \<newline>
>> accountname <newline>
>>
>> Is such a thing possible?
>
>Yes.
>
>#+BEGIN_SRC emacs-lisp
>   (defun org-export-ascii-filter-code (text back-end info)
>   "Replace `\\n' with `\\' in ascii code."
>     (if (eq back-end 'ascii)
>         (replace-regexp-in-string
>          "\n" "\\\n"
>          (org-babel-chomp
>           (org-export-string-as text 'ascii t))
>          nil t)
>       text))
>   (add-to-list 'org-export-filter-code-functions
>                'org-export-ascii-filter-code)
>#+END_SRC

Awesome -- this is perfect.  (Note that, to be perfect, the
continuation lines need at least one leading space.)

>When I run this on your example, I get only one line break, but it is 
>preceeded by a backslash.

My original post had a much much longer password string, but the
web-to-news gateway demanded 80 characters or less, so I trimmed the
password but left in the line breaks.

>Naturally, you will need to adapt this up for other backends as a single 
>backslash might not be what is wanted.

I hope my programming skills are up to the task.  But it's certainly
a great jumping-off point.

Thank you.

--hymie!     http://lactose.homelinux.net/~hymie    hymie@lactose.homelinux.net
My fitbit says I've walked 7009 steps today (as of 19:02).

  reply	other threads:[~2015-03-16 23:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 15:47 export code with backslashes hymie!
2015-03-16 22:28 ` Charles C. Berry
2015-03-16 23:11   ` hymie [this message]
2015-03-18 13:09   ` hymie
2015-03-18 17:10     ` Charles C. Berry

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=E1YXeAV-0004EV-Ot@lactose.homelinux.net \
    --to=hymie@lactose.homelinux.net \
    --cc=ccberry@ucsd.edu \
    --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).