From mboxrd@z Thu Jan 1 00:00:00 1970 From: hymie@lactose.homelinux.net Subject: Re: export code with backslashes Date: Mon, 16 Mar 2015 19:11:31 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXeBE-0004yP-Im for emacs-orgmode@gnu.org; Mon, 16 Mar 2015 19:12:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXeB9-0005fx-RH for emacs-orgmode@gnu.org; Mon, 16 Mar 2015 19:12:16 -0400 Received: from tkt-001-i373.relay.mailchannels.net ([174.136.5.175]:62253 helo=relay.mailchannels.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXeB9-0005cf-C9 for emacs-orgmode@gnu.org; Mon, 16 Mar 2015 19:12:11 -0400 In-reply-to: Content-ID: <8894.1426547491.1@herman.local.net> 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: "Charles C. Berry" Cc: emacs-orgmode@gnu.org "Charles C. Berry" writes: >On Mon, 16 Mar 2015, hymie! wrote: >> useradd -U -G wheel -p \ >> '$6$wcMRrkcdGeNHLT5b$password0ISmGZSsILOyV/WJnpassword//' \ >> accountname >> >> 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).