emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Greg Minshall <minshall@umich.edu>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] bug in 'ox-man?
Date: Mon, 31 Jan 2022 16:25:30 -0800	[thread overview]
Message-ID: <2997747.1643675130@apollo2.minshall.org> (raw)
In-Reply-To: <2924644.1643637646@apollo2.minshall.org>

> #+begin_src bash :results output :exports code :eval never-export
>   echo 'lf "\n"'
> #+end_src

it seems that `.man` files are in troff(1) format, which uses backslash
escapes up the wazoo (however that is spelled).  it seems that (one way)
to getting a backslash character through troff is representing it as
"\e".

for my *particular* instance, where the backslash is in an org src
block, the below modification to `(org-man-src-block)` may work.

presumably one might have backslash sequences in example blocks, or in
the main text, or ...?  i don't know enough to have any idea if there is
some general mechanism that might solve all those.

cheers, Greg

----
From 0d0dadc6b4e7f3358612f056a9eb032c1eb4145f Mon Sep 17 00:00:00 2001
From: Greg Minshall <minshall@umich.edu>
Date: Mon, 31 Jan 2022 16:08:35 -0800
Subject: [PATCH] lisp/ox-man.el: escape backslashes from org src blocks

---
 lisp/ox-man.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index e808edcdf..6eb6b5ff8 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -748,7 +748,9 @@ CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (if (not (plist-get info :man-source-highlight))
       (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
-             (org-export-format-code-default src-block info))
+              (replace-regexp-in-string
+               "\\\\" "\\\\e"
+              (org-export-format-code-default src-block info)))
     (let* ((tmpdir temporary-file-directory)
           (in-file  (make-temp-name (expand-file-name "srchilite" tmpdir)))
           (out-file (make-temp-name (expand-file-name "reshilite" tmpdir)))
--
2.34.1
----


  reply	other threads:[~2022-02-01  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 14:00 [BUG] bug in 'ox-man? Greg Minshall
2022-02-01  0:25 ` Greg Minshall [this message]
2024-04-14 11:20   ` Ihor Radchenko
2024-04-26  9:45     ` Ihor Radchenko

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=2997747.1643675130@apollo2.minshall.org \
    --to=minshall@umich.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).