emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] bug in 'ox-man?


From: Greg Minshall
Subject: Re: [BUG] bug in 'ox-man?
Date: Mon, 31 Jan 2022 16:25:30 -0800

> #+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 via email to

[Prev in Thread] Current Thread [Next in Thread]