emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] bug in 'ox-man?
@ 2022-01-31 14:00 Greg Minshall
  2022-02-01  0:25 ` Greg Minshall
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Minshall @ 2022-01-31 14:00 UTC (permalink / raw)
  To: emacs-orgmode

hi, all.

this works when exporting as a .pdf or a .html.  but, not when
exporting to 'ox-man:

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

(the result has a "0" in it, appears to have gotten confused by maybe
trying to substitute a newline character for the backslash-n, ???)

i'm running:
Org mode version 9.5.1 (9.5.1-g14ed65 @ /home/minshall/.emacs.d/straight/build/org/)

cheers, Greg

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] bug in 'ox-man?
  2022-01-31 14:00 [BUG] bug in 'ox-man? Greg Minshall
@ 2022-02-01  0:25 ` Greg Minshall
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Minshall @ 2022-02-01  0:25 UTC (permalink / raw)
  To: emacs-orgmode

> #+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

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)))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-01  0:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 14:00 [BUG] bug in 'ox-man? Greg Minshall
2022-02-01  0:25 ` Greg Minshall

Code repositories for project(s) associated with this public inbox


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).