org-e-man.el 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. ;; org-e-man.el --- Man Back-End For Org Export Engine
  2. ;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
  3. ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
  4. ;; Author: Luis R Anaya <papoanaya aroba hot mail punto com>
  5. ;; Keywords: outlines, hypermedia, calendar, wp
  6. ;;
  7. ;; This program is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; This program is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;;
  19. ;; This library implements a Man back-end for Org generic exporter.
  20. ;;
  21. ;; To test it, run
  22. ;;
  23. ;; M-: (org-export-to-buffer 'e-man "*Test e-Man*") RET
  24. ;;
  25. ;; in an org-mode buffer then switch to the buffer to see the Man
  26. ;; export. See contrib/lisp/org-export.el for more details on how
  27. ;; this exporter works.
  28. ;;
  29. ;; It introduces one new buffer keywords:
  30. ;; "MAN_CLASS_OPTIONS".
  31. ;;; Code:
  32. (require 'org-export)
  33. (eval-when-compile (require 'cl))
  34. (defvar org-export-man-default-packages-alist)
  35. (defvar org-export-man-packages-alist)
  36. (defvar orgtbl-exp-regexp)
  37. ;;; Define Back-End
  38. (org-export-define-backend e-man
  39. ((babel-call . org-e-man-babel-call)
  40. (bold . org-e-man-bold)
  41. (center-block . org-e-man-center-block)
  42. (clock . org-e-man-clock)
  43. (code . org-e-man-code)
  44. (comment . org-e-man-comment)
  45. (comment-block . org-e-man-comment-block)
  46. (drawer . org-e-man-drawer)
  47. (dynamic-block . org-e-man-dynamic-block)
  48. (entity . org-e-man-entity)
  49. (example-block . org-e-man-example-block)
  50. (export-block . org-e-man-export-block)
  51. (export-snippet . org-e-man-export-snippet)
  52. (fixed-width . org-e-man-fixed-width)
  53. (footnote-definition . org-e-man-footnote-definition)
  54. (footnote-reference . org-e-man-footnote-reference)
  55. (headline . org-e-man-headline)
  56. (horizontal-rule . org-e-man-horizontal-rule)
  57. (inline-babel-call . org-e-man-inline-babel-call)
  58. (inline-src-block . org-e-man-inline-src-block)
  59. (inlinetask . org-e-man-inlinetask)
  60. (italic . org-e-man-italic)
  61. (item . org-e-man-item)
  62. (keyword . org-e-man-keyword)
  63. (man-environment . org-e-man-man-environment)
  64. (man-fragment . org-e-man-man-fragment)
  65. (line-break . org-e-man-line-break)
  66. (link . org-e-man-link)
  67. (paragraph . org-e-man-paragraph)
  68. (plain-list . org-e-man-plain-list)
  69. (plain-text . org-e-man-plain-text)
  70. (planning . org-e-man-planning)
  71. (property-drawer . org-e-man-property-drawer)
  72. (quote-block . org-e-man-quote-block)
  73. (quote-section . org-e-man-quote-section)
  74. (radio-target . org-e-man-radio-target)
  75. (section . org-e-man-section)
  76. (special-block . org-e-man-special-block)
  77. (src-block . org-e-man-src-block)
  78. (statistics-cookie . org-e-man-statistics-cookie)
  79. (strike-through . org-e-man-strike-through)
  80. (subscript . org-e-man-subscript)
  81. (superscript . org-e-man-superscript)
  82. (table . org-e-man-table)
  83. (table-cell . org-e-man-table-cell)
  84. (table-row . org-e-man-table-row)
  85. (target . org-e-man-target)
  86. (template . org-e-man-template)
  87. (timestamp . org-e-man-timestamp)
  88. (underline . org-e-man-underline)
  89. (verbatim . org-e-man-verbatim)
  90. (verse-block . org-e-man-verse-block))
  91. :export-block "MAN"
  92. :menu-entry
  93. (?m "Export to MAN"
  94. ((?m "As MAN file" org-e-man-export-to-man)
  95. (?p "As PDF file" org-e-man-export-to-pdf)
  96. (?o "As PDF file and open"
  97. (lambda (s v b) (org-open-file (org-e-man-export-to-pdf s v b))))))
  98. :options-alist
  99. ((:man-class "MAN_CLASS" nil nil t)
  100. (:man-class-options "MAN_CLASS_OPTIONS" nil nil t)
  101. (:man-header-extra "MAN_HEADER" nil nil newline)))
  102. ;;; User Configurable Variables
  103. (defgroup org-export-e-man nil
  104. "Options for exporting Org mode files to Man."
  105. :tag "Org Export Man"
  106. :group 'org-export)
  107. ;;; Tables
  108. (defcustom org-e-man-tables-centered t
  109. "When non-nil, tables are exported in a center environment."
  110. :group 'org-export-e-man
  111. :type 'boolean)
  112. (defcustom org-e-man-tables-verbatim nil
  113. "When non-nil, tables are exported verbatim."
  114. :group 'org-export-e-man
  115. :type 'boolean)
  116. (defcustom org-e-man-table-scientific-notation "%sE%s"
  117. "Format string to display numbers in scientific notation.
  118. The format should have \"%s\" twice, for mantissa and exponent
  119. \(i.e. \"%s\\\\times10^{%s}\").
  120. When nil, no transformation is made."
  121. :group 'org-export-e-man
  122. :type '(choice
  123. (string :tag "Format string")
  124. (const :tag "No formatting")))
  125. ;;; Inlinetasks
  126. ;; Src blocks
  127. (defcustom org-e-man-source-highlight nil
  128. "Use GNU source highlight to embellish source blocks "
  129. :group 'org-export-e-man
  130. :type 'boolean)
  131. (defcustom org-e-man-source-highlight-langs
  132. '((emacs-lisp "lisp") (lisp "lisp") (clojure "lisp")
  133. (scheme "scheme")
  134. (c "c") (cc "cpp") (csharp "csharp") (d "d")
  135. (fortran "fortran") (cobol "cobol") (pascal "pascal")
  136. (ada "ada") (asm "asm")
  137. (perl "perl") (cperl "perl")
  138. (python "python") (ruby "ruby") (tcl "tcl") (lua "lua")
  139. (java "java") (javascript "javascript")
  140. (tex "latex")
  141. (shell-script "sh") (awk "awk") (diff "diff") (m4 "m4")
  142. (ocaml "caml") (caml "caml")
  143. (sql "sql") (sqlite "sql")
  144. (html "html") (css "css") (xml "xml")
  145. (bat "bat") (bison "bison") (clipper "clipper")
  146. (ldap "ldap") (opa "opa")
  147. (php "php") (postscript "postscript") (prolog "prolog")
  148. (properties "properties") (makefile "makefile")
  149. (tml "tml") (vala "vala") (vbscript "vbscript") (xorg "xorg"))
  150. "Alist mapping languages to their listing language counterpart.
  151. The key is a symbol, the major mode symbol without the \"-mode\".
  152. The value is the string that should be inserted as the language
  153. parameter for the listings package. If the mode name and the
  154. listings name are the same, the language does not need an entry
  155. in this list - but it does not hurt if it is present."
  156. :group 'org-export-e-man
  157. :type '(repeat
  158. (list
  159. (symbol :tag "Major mode ")
  160. (string :tag "Listings language"))))
  161. (defvar org-e-man-custom-lang-environments nil
  162. "Alist mapping languages to language-specific Man environments.
  163. It is used during export of src blocks by the listings and
  164. man packages. For example,
  165. \(setq org-e-man-custom-lang-environments
  166. '\(\(python \"pythoncode\"\)\)\)
  167. would have the effect that if org encounters begin_src python
  168. during man export."
  169. )
  170. ;;; Compilation
  171. (defcustom org-e-man-pdf-process
  172. '("tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
  173. "tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
  174. "tbl %f | eqn | groff -man | ps2pdf - > %b.pdf")
  175. "Commands to process a Man file to a PDF file.
  176. This is a list of strings, each of them will be given to the
  177. shell as a command. %f in the command will be replaced by the
  178. full file name, %b by the file base name (i.e. without directory
  179. and extension parts) and %o by the base directory of the file.
  180. By default, Org uses 3 runs of to do the processing.
  181. Alternatively, this may be a Lisp function that does the
  182. processing. This function should accept the file name as
  183. its single argument."
  184. :group 'org-export-pdf
  185. :type '(choice
  186. (repeat :tag "Shell command sequence"
  187. (string :tag "Shell command"))
  188. (const :tag "2 runs of pdfgroff"
  189. ("tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
  190. "tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf" ))
  191. (const :tag "3 runs of pdfgroff"
  192. ("tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
  193. "tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
  194. "tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"))
  195. (function)))
  196. (defcustom org-e-man-logfiles-extensions
  197. '("log" "out" "toc")
  198. "The list of file extensions to consider as Man logfiles."
  199. :group 'org-export-e-man
  200. :type '(repeat (string :tag "Extension")))
  201. (defcustom org-e-man-remove-logfiles t
  202. "Non-nil means remove the logfiles produced by PDF production.
  203. These are the .aux, .log, .out, and .toc files."
  204. :group 'org-export-e-man
  205. :type 'boolean)
  206. ;;; Internal Functions
  207. (defun org-e-man--caption/label-string (element info)
  208. "Return caption and label Man string for ELEMENT.
  209. INFO is a plist holding contextual information. If there's no
  210. caption nor label, return the empty string.
  211. For non-floats, see `org-e-man--wrap-label'."
  212. (let ((label (org-element-property :label element))
  213. (main (org-export-get-caption element))
  214. (short (org-export-get-caption element t)))
  215. (cond ((and (not main) (not label)) "")
  216. ((not main) (format "\\fI%s\\fP" label))
  217. ;; Option caption format with short name.
  218. (short (format "\\fR%s\\fP - \\fI\\P - %s\n"
  219. (org-export-data short info)
  220. (org-export-data main info)))
  221. ;; Standard caption format.
  222. (t (format "\\fR%s\\fP" (org-export-data main info))))))
  223. (defun org-e-man--wrap-label (element output)
  224. "Wrap label associated to ELEMENT around OUTPUT, if appropriate.
  225. This function shouldn't be used for floats. See
  226. `org-e-man--caption/label-string'."
  227. (let ((label (org-element-property :name element)))
  228. (if (or (not output) (not label) (string= output "") (string= label ""))
  229. output
  230. (concat (format "%s\n.br\n" label) output))))
  231. ;;; Template
  232. (defun org-e-man-template (contents info)
  233. "Return complete document string after Man conversion.
  234. CONTENTS is the transcoded contents string. INFO is a plist
  235. holding export options."
  236. (let* ((title (org-export-data (plist-get info :title) info))
  237. (attr (read (format "(%s)"
  238. (mapconcat
  239. #'identity
  240. (list (plist-get info :man-class-options))
  241. " "))))
  242. (section-item (plist-get attr :section-id)))
  243. (concat
  244. (cond
  245. ((and title (stringp section-item))
  246. (format ".TH \"%s\" \"%s\" \n" title section-item))
  247. ((and (string= "" title) (stringp section-item))
  248. (format ".TH \"%s\" \"%s\" \n" " " section-item))
  249. (title
  250. (format ".TH \"%s\" \"1\" \n" title))
  251. (t
  252. ".TH \" \" \"1\" "))
  253. contents)))
  254. ;;; Transcode Functions
  255. ;;; Babel Call
  256. ;;
  257. ;; Babel Calls are ignored.
  258. ;;; Bold
  259. (defun org-e-man-bold (bold contents info)
  260. "Transcode BOLD from Org to Man.
  261. CONTENTS is the text with bold markup. INFO is a plist holding
  262. contextual information."
  263. (format "\\fB%s\\fP" contents))
  264. ;;; Center Block
  265. (defun org-e-man-center-block (center-block contents info)
  266. "Transcode a CENTER-BLOCK element from Org to Man.
  267. CONTENTS holds the contents of the center block. INFO is a plist
  268. holding contextual information."
  269. (org-e-man--wrap-label
  270. center-block
  271. (format ".ce %d\n.nf\n%s\n.fi"
  272. (- (length (split-string contents "\n")) 1 )
  273. contents)))
  274. ;;; Clock
  275. (defun org-e-man-clock (clock contents info)
  276. "Transcode a CLOCK element from Org to Man.
  277. CONTENTS is nil. INFO is a plist holding contextual
  278. information."
  279. "" )
  280. ;;; Code
  281. (defun org-e-man-code (code contents info)
  282. "Transcode a CODE object from Org to Man.
  283. CONTENTS is nil. INFO is a plist used as a communication
  284. channel."
  285. (format "\\fC%s\\fP" code))
  286. ;;; Comment
  287. ;;
  288. ;; Comments are ignored.
  289. ;;; Comment Block
  290. ;;
  291. ;; Comment Blocks are ignored.
  292. ;;; Drawer
  293. (defun org-e-man-drawer (drawer contents info)
  294. "Transcode a DRAWER element from Org to Man.
  295. DRAWER holds the drawer information
  296. CONTENTS holds the contents of the block.
  297. INFO is a plist holding contextual information. "
  298. contents)
  299. ;;; Dynamic Block
  300. (defun org-e-man-dynamic-block (dynamic-block contents info)
  301. "Transcode a DYNAMIC-BLOCK element from Org to Man.
  302. CONTENTS holds the contents of the block. INFO is a plist
  303. holding contextual information. See `org-export-data'."
  304. (org-e-man--wrap-label dynamic-block contents))
  305. ;;; Entity
  306. (defun org-e-man-entity (entity contents info)
  307. "Transcode an ENTITY object from Org to Man.
  308. CONTENTS are the definition itself. INFO is a plist holding
  309. contextual information."
  310. (org-element-property :utf-8 entity))
  311. ;;; Example Block
  312. (defun org-e-man-example-block (example-block contents info)
  313. "Transcode an EXAMPLE-BLOCK element from Org to Man.
  314. CONTENTS is nil. INFO is a plist holding contextual
  315. information."
  316. (org-e-man--wrap-label
  317. example-block
  318. (format ".RS\n.nf\n%s\n.fi\n.RE"
  319. (org-export-format-code-default example-block info))))
  320. ;;; Export Block
  321. (defun org-e-man-export-block (export-block contents info)
  322. "Transcode a EXPORT-BLOCK element from Org to Man.
  323. CONTENTS is nil. INFO is a plist holding contextual information."
  324. (when (string= (org-element-property :type export-block) "MAN")
  325. (org-remove-indentation (org-element-property :value export-block))))
  326. ;;; Export Snippet
  327. (defun org-e-man-export-snippet (export-snippet contents info)
  328. "Transcode a EXPORT-SNIPPET object from Org to Man.
  329. CONTENTS is nil. INFO is a plist holding contextual information."
  330. (when (eq (org-export-snippet-backend export-snippet) 'e-man)
  331. (org-element-property :value export-snippet)))
  332. ;;; Fixed Width
  333. (defun org-e-man-fixed-width (fixed-width contents info)
  334. "Transcode a FIXED-WIDTH element from Org to Man.
  335. CONTENTS is nil. INFO is a plist holding contextual information."
  336. (org-e-man--wrap-label
  337. fixed-width
  338. (format "\\fC\n%s\\fP"
  339. (org-remove-indentation
  340. (org-element-property :value fixed-width)))))
  341. ;;; Footnote Definition
  342. ;;
  343. ;; Footnote Definitions are ignored.
  344. ;;; Footnote References
  345. ;;
  346. ;; Footnote References are Ignored
  347. ;;; Headline
  348. (defun org-e-man-headline (headline contents info)
  349. "Transcode an HEADLINE element from Org to Man.
  350. CONTENTS holds the contents of the headline. INFO is a plist
  351. holding contextual information."
  352. (let* ((level (org-export-get-relative-level headline info))
  353. (numberedp (org-export-numbered-headline-p headline info))
  354. ;; Section formatting will set two placeholders: one for the
  355. ;; title and the other for the contents.
  356. (section-fmt
  357. (case level
  358. (1 ".SH \"%s\"\n%s")
  359. (2 ".SS \"%s\"\n%s")
  360. (3 ".SS \"%s\"\n%s")
  361. (t nil)))
  362. (text (org-export-data (org-element-property :title headline) info)))
  363. (cond
  364. ;; Case 1: This is a footnote section: ignore it.
  365. ((org-element-property :footnote-section-p headline) nil)
  366. ;; Case 2. This is a deep sub-tree: export it as a list item.
  367. ;; Also export as items headlines for which no section
  368. ;; format has been found.
  369. ((or (not section-fmt) (org-export-low-level-p headline info))
  370. ;; Build the real contents of the sub-tree.
  371. (let ((low-level-body
  372. (concat
  373. ;; If the headline is the first sibling, start a list.
  374. (when (org-export-first-sibling-p headline info)
  375. (format "%s\n" ".RS"))
  376. ;; Itemize headline
  377. ".TP\n.ft I\n" text "\n.ft\n"
  378. contents ".RE")))
  379. ;; If headline is not the last sibling simply return
  380. ;; LOW-LEVEL-BODY. Otherwise, also close the list, before any
  381. ;; blank line.
  382. (if (not (org-export-last-sibling-p headline info)) low-level-body
  383. (replace-regexp-in-string
  384. "[ \t\n]*\\'" ""
  385. low-level-body))))
  386. ;; Case 3. Standard headline. Export it as a section.
  387. (t (format section-fmt text contents )))))
  388. ;;; Horizontal Rule
  389. ;; Not supported
  390. ;;; Inline Babel Call
  391. ;;
  392. ;; Inline Babel Calls are ignored.
  393. ;;; Inline Src Block
  394. (defun org-e-man-inline-src-block (inline-src-block contents info)
  395. "Transcode an INLINE-SRC-BLOCK element from Org to Man.
  396. CONTENTS holds the contents of the item. INFO is a plist holding
  397. contextual information."
  398. (let* ((code (org-element-property :value inline-src-block)))
  399. (cond
  400. (org-e-man-source-highlight
  401. (let* ((tmpdir (if (featurep 'xemacs)
  402. temp-directory
  403. temporary-file-directory ))
  404. (in-file (make-temp-name
  405. (expand-file-name "srchilite" tmpdir)))
  406. (out-file (make-temp-name
  407. (expand-file-name "reshilite" tmpdir)))
  408. (org-lang (org-element-property :language inline-src-block))
  409. (lst-lang (cadr (assq (intern org-lang)
  410. org-e-man-source-highlight-langs)))
  411. (cmd (concat (expand-file-name "source-highlight")
  412. " -s " lst-lang
  413. " -f groff_man"
  414. " -i " in-file
  415. " -o " out-file )))
  416. (if lst-lang
  417. (let ((code-block "" ))
  418. (with-temp-file in-file (insert code))
  419. (shell-command cmd)
  420. (setq code-block (org-file-contents out-file))
  421. (delete-file in-file)
  422. (delete-file out-file)
  423. code-block)
  424. (format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE\n"
  425. code))))
  426. ;; Do not use a special package: transcode it verbatim.
  427. (t
  428. (concat ".RS\n.nf\n" "\\fC" "\n" code "\n"
  429. "\\fP\n.fi\n.RE\n")))))
  430. ;;; Inlinetask
  431. ;;; Italic
  432. (defun org-e-man-italic (italic contents info)
  433. "Transcode ITALIC from Org to Man.
  434. CONTENTS is the text with italic markup. INFO is a plist holding
  435. contextual information."
  436. (format "\\fI%s\\fP" contents))
  437. ;;; Item
  438. (defun org-e-man-item (item contents info)
  439. "Transcode an ITEM element from Org to Man.
  440. CONTENTS holds the contents of the item. INFO is a plist holding
  441. contextual information."
  442. (let* ((bullet (org-element-property :bullet item))
  443. (type (org-element-property :type (org-element-property :parent item)))
  444. (checkbox (case (org-element-property :checkbox item)
  445. (on "\\o'\\(sq\\(mu'") ;;
  446. (off "\\(sq ") ;;
  447. (trans "\\o'\\(sq\\(mi'" ))) ;;
  448. (tag (let ((tag (org-element-property :tag item)))
  449. ;; Check-boxes must belong to the tag.
  450. (and tag (format "\\fB%s\\fP"
  451. (concat checkbox
  452. (org-export-data tag info)))))))
  453. (if (and (null tag )
  454. (null checkbox))
  455. (let* ((bullet (org-trim bullet))
  456. (marker (cond ((string= "-" bullet) "\\(em")
  457. ((string= "*" bullet) "\\(bu")
  458. ((eq type 'ordered)
  459. (format "%s " (org-trim bullet)))
  460. (t "\\(dg"))))
  461. (concat ".IP " marker " 4\n"
  462. (org-trim (or contents " " ))))
  463. ; else
  464. (concat ".TP\n" (or tag (concat " " checkbox)) "\n"
  465. (org-trim (or contents " " ))))))
  466. ;;; Keyword
  467. (defun org-e-man-keyword (keyword contents info)
  468. "Transcode a KEYWORD element from Org to Man.
  469. CONTENTS is nil. INFO is a plist holding contextual information."
  470. (let ((key (org-element-property :key keyword))
  471. (value (org-element-property :value keyword)))
  472. (cond
  473. ((string= key "MAN") value)
  474. ((string= key "INDEX") nil)
  475. ;; Invisible targets.
  476. ((string= key "TARGET") nil)
  477. ((string= key "TOC" ) nil))))
  478. ;;; Man Environment
  479. (defun org-e-man-man-environment (man-environment contents info)
  480. "Transcode a MAN-ENVIRONMENT element from Org to Man.
  481. CONTENTS is nil. INFO is a plist holding contextual information."
  482. (let ((label (org-element-property :name man-environment))
  483. (value (org-remove-indentation
  484. (org-element-property :value man-environment))))
  485. (if (not (org-string-nw-p label)) value
  486. ;; Environment is labelled: label must be within the environment
  487. ;; (otherwise, a reference pointing to that element will count
  488. ;; the section instead).
  489. (with-temp-buffer
  490. (insert value)
  491. (goto-char (point-min))
  492. (forward-line)
  493. (insert (format "%s\n" label))
  494. (buffer-string)))))
  495. ;;; Man Fragment
  496. (defun org-e-man-man-fragment (man-fragment contents info)
  497. "Transcode a MAN-FRAGMENT object from Org to Man.
  498. CONTENTS is nil. INFO is a plist holding contextual information."
  499. (org-element-property :value man-fragment))
  500. ;;; Line Break
  501. (defun org-e-man-line-break (line-break contents info)
  502. "Transcode a LINE-BREAK object from Org to Man.
  503. CONTENTS is nil. INFO is a plist holding contextual information."
  504. ".br\n")
  505. ;;; Link
  506. (defun org-e-man-link (link desc info)
  507. "Transcode a LINK object from Org to Man.
  508. DESC is the description part of the link, or the empty string.
  509. INFO is a plist holding contextual information. See
  510. `org-export-data'."
  511. (let* ((type (org-element-property :type link))
  512. (raw-path (org-element-property :path link))
  513. ;; Ensure DESC really exists, or set it to nil.
  514. (desc (and (not (string= desc "")) desc))
  515. (path (cond
  516. ((member type '("http" "https" "ftp" "mailto"))
  517. (concat type ":" raw-path))
  518. ((string= type "file")
  519. (when (string-match "\\(.+\\)::.+" raw-path)
  520. (setq raw-path (match-string 1 raw-path)))
  521. (if (file-name-absolute-p raw-path)
  522. (concat "file://" (expand-file-name raw-path))
  523. (concat "file://" raw-path)))
  524. (t raw-path)))
  525. protocol)
  526. (cond
  527. ;; External link with a description part.
  528. ((and path desc) (format "%s \\fBat\\fP \\fI%s\\fP" path desc))
  529. ;; External link without a description part.
  530. (path (format "\\fI%s\\fP" path))
  531. ;; No path, only description. Try to do something useful.
  532. (t (format "\\fI%s\\fP" desc)))))
  533. ;;; Paragraph
  534. (defun org-e-man-paragraph (paragraph contents info)
  535. "Transcode a PARAGRAPH element from Org to Man.
  536. CONTENTS is the contents of the paragraph, as a string. INFO is
  537. the plist used as a communication channel."
  538. (let ((parent (plist-get (nth 1 paragraph) :parent)))
  539. (when parent
  540. (let ((parent-type (car parent))
  541. (fixed-paragraph ""))
  542. (cond ((and (eq parent-type 'item)
  543. (plist-get (nth 1 parent) :bullet ))
  544. (setq fixed-paragraph (concat "" contents)))
  545. ((eq parent-type 'section)
  546. (setq fixed-paragraph (concat ".PP\n" contents)))
  547. ((eq parent-type 'footnote-definition)
  548. (setq fixed-paragraph contents))
  549. (t (setq fixed-paragraph (concat "" contents))))
  550. fixed-paragraph ))))
  551. ;;; Plain List
  552. (defun org-e-man-plain-list (plain-list contents info)
  553. "Transcode a PLAIN-LIST element from Org to Man.
  554. CONTENTS is the contents of the list. INFO is a plist holding
  555. contextual information."
  556. contents)
  557. ;;; Plain Text
  558. (defun org-e-man-plain-text (text info)
  559. "Transcode a TEXT string from Org to Man.
  560. TEXT is the string to transcode. INFO is a plist holding
  561. contextual information."
  562. (let ((output text))
  563. ;; Protect various chars.
  564. (setq output (replace-regexp-in-string
  565. "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%$#&{}~^_\\]\\|$\\)"
  566. "$\\" output nil t 1))
  567. ;; Activate smart quotes. Be sure to provide original TEXT string
  568. ;; since OUTPUT may have been modified.
  569. (when (plist-get info :with-smart-quotes)
  570. (setq output (org-export-activate-smart-quotes output :utf-8 info text)))
  571. ;; Handle break preservation if required.
  572. (when (plist-get info :preserve-breaks)
  573. (setq output (replace-regexp-in-string "\\(\\\\\\\\\\)?[ \t]*\n" ".br\n"
  574. output)))
  575. ;; Return value.
  576. output))
  577. ;;; Planning
  578. ;;; Property Drawer
  579. ;;; Quote Block
  580. (defun org-e-man-quote-block (quote-block contents info)
  581. "Transcode a QUOTE-BLOCK element from Org to Man.
  582. CONTENTS holds the contents of the block. INFO is a plist
  583. holding contextual information."
  584. (org-e-man--wrap-label
  585. quote-block
  586. (format ".RS\n%s\n.RE" contents)))
  587. ;;; Quote Section
  588. (defun org-e-man-quote-section (quote-section contents info)
  589. "Transcode a QUOTE-SECTION element from Org to Man.
  590. CONTENTS is nil. INFO is a plist holding contextual information."
  591. (let ((value (org-remove-indentation
  592. (org-element-property :value quote-section))))
  593. (when value (format ".RS\\fI%s\\fP\n.RE\n" value))))
  594. ;;; Radio Target
  595. (defun org-e-man-radio-target (radio-target text info)
  596. "Transcode a RADIO-TARGET object from Org to Man.
  597. TEXT is the text of the target. INFO is a plist holding
  598. contextual information."
  599. text )
  600. ;;; Section
  601. (defun org-e-man-section (section contents info)
  602. "Transcode a SECTION element from Org to Man.
  603. CONTENTS holds the contents of the section. INFO is a plist
  604. holding contextual information."
  605. contents)
  606. ;;; Special Block
  607. (defun org-e-man-special-block (special-block contents info)
  608. "Transcode a SPECIAL-BLOCK element from Org to Man.
  609. CONTENTS holds the contents of the block. INFO is a plist
  610. holding contextual information."
  611. (let ((type (downcase (org-element-property :type special-block))))
  612. (org-e-man--wrap-label
  613. special-block
  614. (format "%s\n" contents))))
  615. ;;; Src Block
  616. (defun org-e-man-src-block (src-block contents info)
  617. "Transcode a SRC-BLOCK element from Org to Man.
  618. CONTENTS holds the contents of the item. INFO is a plist holding
  619. contextual information."
  620. (let* ((lang (org-element-property :language src-block))
  621. (code (org-element-property :value src-block))
  622. (custom-env (and lang
  623. (cadr (assq (intern lang)
  624. org-e-man-custom-lang-environments))))
  625. (num-start (case (org-element-property :number-lines src-block)
  626. (continued (org-export-get-loc src-block info))
  627. (new 0)))
  628. (retain-labels (org-element-property :retain-labels src-block)))
  629. (cond
  630. ;; Case 1. No source fontification.
  631. ((not org-e-man-source-highlight)
  632. (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
  633. (org-export-format-code-default src-block info)))
  634. (org-e-man-source-highlight
  635. (let* ((tmpdir (if (featurep 'xemacs)
  636. temp-directory
  637. temporary-file-directory ))
  638. (in-file (make-temp-name
  639. (expand-file-name "srchilite" tmpdir)))
  640. (out-file (make-temp-name
  641. (expand-file-name "reshilite" tmpdir)))
  642. (org-lang (org-element-property :language src-block))
  643. (lst-lang (cadr (assq (intern org-lang)
  644. org-e-man-source-highlight-langs)))
  645. (cmd (concat "source-highlight"
  646. " -s " lst-lang
  647. " -f groff_man "
  648. " -i " in-file
  649. " -o " out-file)))
  650. (if lst-lang
  651. (let ((code-block ""))
  652. (with-temp-file in-file (insert code))
  653. (shell-command cmd)
  654. (setq code-block (org-file-contents out-file))
  655. (delete-file in-file)
  656. (delete-file out-file)
  657. code-block)
  658. (format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" code)))))))
  659. ;;; Statistics Cookie
  660. (defun org-e-man-statistics-cookie (statistics-cookie contents info)
  661. "Transcode a STATISTICS-COOKIE object from Org to Man.
  662. CONTENTS is nil. INFO is a plist holding contextual information."
  663. (org-element-property :value statistics-cookie))
  664. ;;; Strike-Through
  665. (defun org-e-man-strike-through (strike-through contents info)
  666. "Transcode STRIKE-THROUGH from Org to Man.
  667. CONTENTS is the text with strike-through markup. INFO is a plist
  668. holding contextual information."
  669. (format "\\fI%s\\fP" contents))
  670. ;;; Subscript
  671. (defun org-e-man-subscript (subscript contents info)
  672. "Transcode a SUBSCRIPT object from Org to Man.
  673. CONTENTS is the contents of the object. INFO is a plist holding
  674. contextual information."
  675. (format "\\d\\s-2%s\\s+2\\u" contents))
  676. ;;; Superscript "^_%s$
  677. (defun org-e-man-superscript (superscript contents info)
  678. "Transcode a SUPERSCRIPT object from Org to Man.
  679. CONTENTS is the contents of the object. INFO is a plist holding
  680. contextual information."
  681. (format "\\u\\s-2%s\\s+2\\d" contents))
  682. ;;; Table
  683. ;;
  684. ;; `org-e-man-table' is the entry point for table transcoding. It
  685. ;; takes care of tables with a "verbatim" attribute. Otherwise, it
  686. ;; delegates the job to either `org-e-man-table--table.el-table' or
  687. ;; `org-e-man-table--org-table' functions, depending of the type of
  688. ;; the table.
  689. ;;
  690. ;; `org-e-man-table--align-string' is a subroutine used to build
  691. ;; alignment string for Org tables.
  692. (defun org-e-man-table (table contents info)
  693. "Transcode a TABLE element from Org to Man.
  694. CONTENTS is the contents of the table. INFO is a plist holding
  695. contextual information."
  696. (cond
  697. ;; Case 1: verbatim table.
  698. ((or org-e-man-tables-verbatim
  699. (let ((attr (read (format "(%s)"
  700. (mapconcat
  701. #'identity
  702. (org-element-property :attr_man table)
  703. " ")))))
  704. (and attr (plist-get attr :verbatim))))
  705. (format ".nf\n\\fC%s\\fP\n.fi"
  706. ;; Re-create table, without affiliated keywords.
  707. (org-trim
  708. (org-element-interpret-data
  709. `(table nil ,@(org-element-contents table))))))
  710. ;; Case 2: Standard table.
  711. (t (org-e-man-table--org-table table contents info))))
  712. (defun org-e-man-table--align-string (divider table info)
  713. "Return an appropriate Man alignment string.
  714. TABLE is the considered table. INFO is a plist used as
  715. a communication channel."
  716. (let (alignment)
  717. ;; Extract column groups and alignment from first (non-rule)
  718. ;; row.
  719. (org-element-map
  720. (org-element-map
  721. table 'table-row
  722. (lambda (row)
  723. (and (eq (org-element-property :type row) 'standard) row))
  724. info 'first-match)
  725. 'table-cell
  726. (lambda (cell)
  727. (let* ((borders (org-export-table-cell-borders cell info))
  728. (raw-width (org-export-table-cell-width cell info))
  729. (width-cm (when raw-width (/ raw-width 5)))
  730. (width (if raw-width (format "w(%dc)"
  731. (if (< width-cm 1) 1 width-cm)) "")))
  732. ;; Check left border for the first cell only.
  733. (when (and (memq 'left borders) (not alignment))
  734. (push "|" alignment))
  735. (push
  736. (case (org-export-table-cell-alignment cell info)
  737. (left (concat "l" width divider))
  738. (right (concat "r" width divider))
  739. (center (concat "c" width divider)))
  740. alignment)
  741. (when (memq 'right borders) (push "|" alignment))))
  742. info)
  743. (apply 'concat (reverse alignment))))
  744. (defun org-e-man-table--org-table (table contents info)
  745. "Return appropriate Man code for an Org table.
  746. TABLE is the table type element to transcode. CONTENTS is its
  747. contents, as a string. INFO is a plist used as a communication
  748. channel.
  749. This function assumes TABLE has `org' as its `:type' attribute."
  750. (let* ((attr (org-export-read-attribute :attr_man table))
  751. (label (org-element-property :name table))
  752. (caption (and (not (plist-get attr :disable-caption))
  753. (org-e-man--caption/label-string table info)))
  754. (divider (if (plist-get attr :divider) "|" " "))
  755. ;; Determine alignment string.
  756. (alignment (org-e-man-table--align-string divider table info))
  757. ;; Extract others display options.
  758. (lines (org-split-string contents "\n"))
  759. (attr-list
  760. (let ((result-list '()))
  761. (dolist (attr-item
  762. (list
  763. (if (plist-get attr :expand)
  764. "expand" nil)
  765. (case (plist-get attr :placement)
  766. ('center "center")
  767. ('left nil)
  768. (t
  769. (if org-e-man-tables-centered
  770. "center" "")))
  771. (case (plist-get attr :boxtype)
  772. ('box "box")
  773. ('doublebox "doublebox")
  774. ('allbox "allbox")
  775. ('none nil)
  776. (t "box"))))
  777. (if attr-item
  778. (add-to-list 'result-list attr-item)))
  779. result-list ))
  780. (title-line (plist-get attr :title-line))
  781. (long-cells (plist-get attr :long-cells))
  782. (table-format (concat
  783. (format "%s" (or (car attr-list) "" ))
  784. (or
  785. (let ((output-list '()))
  786. (when (cdr attr-list)
  787. (dolist (attr-item (cdr attr-list))
  788. (setq output-list (concat output-list (format ",%s" attr-item)))))
  789. output-list)
  790. "")))
  791. (first-line (when lines (org-split-string (car lines) "\t"))))
  792. ;; Prepare the final format string for the table.
  793. (cond
  794. ;; Others.
  795. (lines (concat ".TS\n " table-format ";\n"
  796. (format "%s.\n"
  797. (let ((final-line ""))
  798. (when title-line
  799. (dotimes (i (length first-line))
  800. (setq final-line (concat final-line "cb" divider))))
  801. (setq final-line (concat final-line "\n"))
  802. (if alignment
  803. (setq final-line (concat final-line alignment))
  804. (dotimes (i (length first-line))
  805. (setq final-line (concat final-line "c" divider))))
  806. final-line ))
  807. (format "%s.TE\n"
  808. (let ((final-line "")
  809. (long-line "")
  810. (lines (org-split-string contents "\n")))
  811. (dolist (line-item lines)
  812. (setq long-line "")
  813. (if long-cells
  814. (progn
  815. (if (string= line-item "_")
  816. (setq long-line (format "%s\n" line-item))
  817. ;; else string =
  818. (let ((cell-item-list (org-split-string line-item "\t")))
  819. (dolist (cell-item cell-item-list)
  820. (cond ((eq cell-item (car (last cell-item-list)))
  821. (setq long-line (concat long-line
  822. (format "T{\n%s\nT}\t\n" cell-item ))))
  823. (t
  824. (setq long-line (concat long-line
  825. (format "T{\n%s\nT}\t" cell-item ))))))
  826. long-line))
  827. ;; else long cells
  828. (setq final-line (concat final-line long-line )))
  829. (setq final-line (concat final-line line-item "\n"))))
  830. final-line))
  831. (and caption (format ".TB \"%s\"" caption)))))))
  832. ;;; Table Cell
  833. (defun org-e-man-table-cell (table-cell contents info)
  834. "Transcode a TABLE-CELL element from Org to Man
  835. CONTENTS is the cell contents. INFO is a plist used as
  836. a communication channel."
  837. (concat (if (and contents
  838. org-e-man-table-scientific-notation
  839. (string-match orgtbl-exp-regexp contents))
  840. ;; Use appropriate format string for scientific
  841. ;; notation.
  842. (format org-e-man-table-scientific-notation
  843. (match-string 1 contents)
  844. (match-string 2 contents))
  845. contents )
  846. (when (org-export-get-next-element table-cell info) "\t")))
  847. ;;; Table Row
  848. (defun org-e-man-table-row (table-row contents info)
  849. "Transcode a TABLE-ROW element from Org to Man
  850. CONTENTS is the contents of the row. INFO is a plist used as
  851. a communication channel."
  852. ;; Rules are ignored since table separators are deduced from
  853. ;; borders of the current row.
  854. (when (eq (org-element-property :type table-row) 'standard)
  855. (let* ((attr (mapconcat 'identity
  856. (org-element-property
  857. :attr_man (org-export-get-parent table-row))
  858. " "))
  859. ;; TABLE-ROW's borders are extracted from its first cell.
  860. (borders
  861. (org-export-table-cell-borders
  862. (car (org-element-contents table-row)) info)))
  863. (concat
  864. ;; Mark horizontal lines
  865. (cond ((and (memq 'top borders) (memq 'above borders)) "_\n"))
  866. contents
  867. (cond
  868. ;; When BOOKTABS are activated enforce bottom rule even when
  869. ;; no hline was specifically marked.
  870. ((and (memq 'bottom borders) (memq 'below borders)) "\n_")
  871. ((memq 'below borders) "\n_"))))))
  872. ;;; Target
  873. (defun org-e-man-target (target contents info)
  874. "Transcode a TARGET object from Org to Man.
  875. CONTENTS is nil. INFO is a plist holding contextual
  876. information."
  877. (format "\\fI%s\\fP"
  878. (org-export-solidify-link-text (org-element-property :value target))))
  879. ;;; Timestamp
  880. (defun org-e-man-timestamp (timestamp contents info)
  881. "Transcode a TIMESTAMP object from Org to Man.
  882. CONTENTS is nil. INFO is a plist holding contextual
  883. information."
  884. "" )
  885. ;;; Underline
  886. (defun org-e-man-underline (underline contents info)
  887. "Transcode UNDERLINE from Org to Man.
  888. CONTENTS is the text with underline markup. INFO is a plist
  889. holding contextual information."
  890. (format "\\fI%s\\fP" contents))
  891. ;;; Verbatim
  892. (defun org-e-man-verbatim (verbatim contents info)
  893. "Transcode a VERBATIM object from Org to Man.
  894. CONTENTS is nil. INFO is a plist used as a communication
  895. channel."
  896. (format ".nf\n%s\n.fi" contents))
  897. ;;; Verse Block
  898. (defun org-e-man-verse-block (verse-block contents info)
  899. "Transcode a VERSE-BLOCK element from Org to Man.
  900. CONTENTS is verse block contents. INFO is a plist holding
  901. contextual information."
  902. (format ".RS\n.ft I\n%s\n.ft\n.RE" contents))
  903. ;;; Interactive functions
  904. (defun org-e-man-export-to-man
  905. (&optional subtreep visible-only body-only ext-plist)
  906. "Export current buffer to a Man file.
  907. If narrowing is active in the current buffer, only export its
  908. narrowed part.
  909. If a region is active, export that region.
  910. When optional argument SUBTREEP is non-nil, export the sub-tree
  911. at point, extracting information from the headline properties
  912. first.
  913. When optional argument VISIBLE-ONLY is non-nil, don't export
  914. contents of hidden elements.
  915. When optional argument BODY-ONLY is non-nil, only the body
  916. without any markers.
  917. EXT-PLIST, when provided, is a property list with external
  918. parameters overriding Org default settings, but still inferior to
  919. file-local settings.
  920. Return output file's name."
  921. (interactive)
  922. (let ((outfile (org-export-output-file-name ".man" subtreep)))
  923. (org-export-to-file
  924. 'e-man outfile subtreep visible-only body-only ext-plist)))
  925. (defun org-e-man-export-to-pdf
  926. (&optional subtreep visible-only body-only ext-plist)
  927. "Export current buffer to Groff then process through to PDF.
  928. If narrowing is active in the current buffer, only export its
  929. narrowed part.
  930. If a region is active, export that region.
  931. When optional argument SUBTREEP is non-nil, export the sub-tree
  932. at point, extracting information from the headline properties
  933. first.
  934. When optional argument VISIBLE-ONLY is non-nil, don't export
  935. contents of hidden elements.
  936. When optional argument BODY-ONLY is non-nil, only write between
  937. markers.
  938. EXT-PLIST, when provided, is a property list with external
  939. parameters overriding Org default settings, but still inferior to
  940. file-local settings.
  941. Return PDF file's name."
  942. (interactive)
  943. (org-e-man-compile
  944. (org-e-man-export-to-man subtreep visible-only body-only ext-plist)))
  945. (defun org-e-man-compile (file)
  946. "Compile a Groff file.
  947. FILE is the name of the file being compiled. Processing is done
  948. through the command specified in `org-e-man-pdf-process'.
  949. Return PDF file name or an error if it couldn't be produced."
  950. (let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
  951. (full-name (file-truename file))
  952. (out-dir (file-name-directory file))
  953. ;; Make sure `default-directory' is set to FILE directory,
  954. ;; not to whatever value the current buffer may have.
  955. (default-directory (file-name-directory full-name))
  956. errors)
  957. (message (format "Processing Groff file %s ..." file))
  958. (save-window-excursion
  959. (cond
  960. ;; A function is provided: Apply it.
  961. ((functionp org-e-man-pdf-process)
  962. (funcall org-e-man-pdf-process (shell-quote-argument file)))
  963. ;; A list is provided: Replace %b, %f and %o with appropriate
  964. ;; values in each command before applying it. Output is
  965. ;; redirected to "*Org PDF Groff Output*" buffer.
  966. ((consp org-e-man-pdf-process)
  967. (let ((outbuf (get-buffer-create "*Org PDF Groff Output*")))
  968. (mapc
  969. (lambda (command)
  970. (shell-command
  971. (replace-regexp-in-string
  972. "%b" (shell-quote-argument base-name)
  973. (replace-regexp-in-string
  974. "%f" (shell-quote-argument full-name)
  975. (replace-regexp-in-string
  976. "%o" (shell-quote-argument out-dir) command t t) t t) t t)
  977. outbuf))
  978. org-e-man-pdf-process)
  979. ;; Collect standard errors from output buffer.
  980. (setq errors (org-e-man-collect-errors outbuf))))
  981. (t (error "No valid command to process to PDF")))
  982. (let ((pdffile (concat out-dir base-name ".pdf")))
  983. ;; Check for process failure. Provide collected errors if
  984. ;; possible.
  985. (if (not (file-exists-p pdffile))
  986. (error (concat (format "PDF file %s wasn't produced" pdffile)
  987. (when errors (concat ": " errors))))
  988. ;; Else remove log files, when specified, and signal end of
  989. ;; process to user, along with any error encountered.
  990. (when org-e-man-remove-logfiles
  991. (dolist (ext org-e-man-logfiles-extensions)
  992. (let ((file (concat out-dir base-name "." ext)))
  993. (when (file-exists-p file) (delete-file file)))))
  994. (message (concat "Process completed"
  995. (if (not errors) "."
  996. (concat " with errors: " errors)))))
  997. ;; Return output file name.
  998. pdffile))))
  999. (defun org-e-man-collect-errors (buffer)
  1000. "Collect some kind of errors from \"groff\" output
  1001. BUFFER is the buffer containing output.
  1002. Return collected error types as a string, or nil if there was
  1003. none."
  1004. (with-current-buffer buffer
  1005. (save-excursion
  1006. (goto-char (point-max))
  1007. ;; Find final run
  1008. nil )))
  1009. (provide 'org-e-man)
  1010. ;;; org-e-man.el ends here