summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-07-25 16:09:16 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-07-25 16:10:02 +0200
commit3ff1f7336e0c6e9de89496791c74addb2a23aaf4 (patch)
tree4e534d1efc0e8ee511cc36bc6f3a35dbf2d16211
parent38de20287fbf26d0a84d6264c030fd8fddadfdc6 (diff)
downloadorg-mode-3ff1f7336e0c6e9de89496791c74addb2a23aaf4.tar.gz
ox-man: Use cl-lib
* lisp/ox-man.el (org-man-headline): (org-man-item): (org-man-table--align-string): Silence byte-compiler. Small refactoring.
-rw-r--r--lisp/ox-man.el47
1 files changed, 21 insertions, 26 deletions
diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index 1aefb33..82cbb8d 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -37,10 +37,9 @@
;;; Code:
+(require 'cl-lib)
(require 'ox)
-(eval-when-compile (require 'cl))
-
(defvar org-export-man-default-packages-alist)
(defvar org-export-man-packages-alist)
(defvar orgtbl-exp-regexp)
@@ -444,11 +443,11 @@ holding contextual information."
;; Section formatting will set two placeholders: one for the
;; title and the other for the contents.
(section-fmt
- (case level
+ (pcase level
(1 ".SH \"%s\"\n%s")
(2 ".SS \"%s\"\n%s")
(3 ".SS \"%s\"\n%s")
- (t nil)))
+ (_ nil)))
(text (org-export-data (org-element-property :title headline) info)))
(cond
@@ -542,17 +541,15 @@ contextual information."
(defun org-man-item (item contents info)
-
"Transcode an ITEM element from Org to Man.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
-
(let* ((bullet (org-element-property :bullet item))
(type (org-element-property :type (org-element-property :parent item)))
- (checkbox (case (org-element-property :checkbox item)
- (on "\\o'\\(sq\\(mu'") ;;
- (off "\\(sq ") ;;
- (trans "\\o'\\(sq\\(mi'" ))) ;;
+ (checkbox (pcase (org-element-property :checkbox item)
+ (`on "\\o'\\(sq\\(mu'")
+ (`off "\\(sq ")
+ (`trans "\\o'\\(sq\\(mi'")))
(tag (let ((tag (org-element-property :tag item)))
;; Check-boxes must belong to the tag.
@@ -560,17 +557,15 @@ contextual information."
(concat checkbox
(org-export-data tag info)))))))
- (if (and (null tag )
- (null checkbox))
- (let* ((bullet (org-trim bullet))
- (marker (cond ((string= "-" bullet) "\\(em")
- ((string= "*" bullet) "\\(bu")
- ((eq type 'ordered)
- (format "%s " (org-trim bullet)))
- (t "\\(dg"))))
- (concat ".IP " marker " 4\n"
- (org-trim (or contents " " ))))
- ; else
+ (if (and (null tag) (null checkbox))
+ (let* ((bullet (org-trim bullet))
+ (marker (cond ((string= "-" bullet) "\\(em")
+ ((string= "*" bullet) "\\(bu")
+ ((eq type 'ordered)
+ (format "%s " (org-trim bullet)))
+ (t "\\(dg"))))
+ (concat ".IP " marker " 4\n"
+ (org-trim (or contents " " ))))
(concat ".TP\n" (or tag (concat " " checkbox)) "\n"
(org-trim (or contents " " ))))))
@@ -860,14 +855,14 @@ a communication channel."
(when (and (memq 'left borders) (not alignment))
(push "|" alignment))
(push
- (case (org-export-table-cell-alignment cell info)
- (left (concat "l" width divider))
- (right (concat "r" width divider))
- (center (concat "c" width divider)))
+ (concat (pcase (org-export-table-cell-alignment cell info)
+ (`left "l") (`right "r") (`center "c"))
+ width
+ divider)
alignment)
(when (memq 'right borders) (push "|" alignment))))
info)
- (apply 'concat (reverse alignment))))
+ (apply #'concat (reverse alignment))))
(defun org-man-table--org-table (table contents info)
"Return appropriate Man code for an Org table.