emacs-unoffice

Emacs library to reclaim text from office documents (abw, odt, docx).
Log | Files | Refs

commit 5c11ccf6244959d41288c3d1072504a5286ebf01
parent 80f2604d8dd7fbda8f4552983514164d6e8069e7
Author: Tomas Hlavaty <tom@logand.com>
Date:   Wed, 26 Oct 2022 00:16:24 +0200

use cl-lib

Diffstat:
Memacs-unoffice.el | 28++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/emacs-unoffice.el b/emacs-unoffice.el @@ -34,7 +34,7 @@ ;;; - sha256sum from coreutils (require 'arc-mode) -(require 'cl) +(require 'cl-lib) (require 'org) (require 'org-table) (require 'view) @@ -71,7 +71,7 @@ file)) (defun unoffice--to-txt (x) - (assert (eq 'unoffice (car x))) + (cl-assert (eq 'unoffice (car x))) (outline-mode) (insert "# -*- outline -*-\n") (insert "\n") @@ -91,10 +91,10 @@ (when (< fill-column (current-column)) (fill-paragraph)))))) (rec (x) - (typecase x + (cl-typecase x (string (ins x)) (cons - (case (car x) + (cl-case (car x) (pagebreak (unless table (unless (bolp) @@ -113,7 +113,7 @@ (setq table nil) (org-table-align)) ((h1 h2 h3 h4 h5 h6 p) - (case (car x) + (cl-case (car x) (h1 (insert "* ")) (h2 (insert "** ")) (h3 (insert "*** ")) @@ -128,7 +128,7 @@ (rec x)))) (defun unoffice--to-org (x) - (assert (eq 'unoffice (car x))) + (cl-assert (eq 'unoffice (car x))) (org-mode) (insert "# -*- org -*-\n") (insert "#+STARTUP: showeverything\n") @@ -138,10 +138,10 @@ (when (and x (not (equal "" x))) (insert x))) (rec (x) - (typecase x + (cl-typecase x (string (ins x)) (cons - (case (car x) + (cl-case (car x) (b (when (bolp) ;; heading vs bold (insert " ")) @@ -186,7 +186,7 @@ p2 nil) (org-table-align)) ((h1 h2 h3 h4 h5 h6 p) - (case (car x) + (cl-case (car x) (h1 (insert "* ")) (h2 (insert "** ")) (h3 (insert "*** ")) @@ -220,10 +220,10 @@ (when (and x pp (not (equal "" x))) (push x p))) (rec (x) - (typecase x + (cl-typecase x (string (ins x)) (cons - (case (car x) + (cl-case (car x) (p (setq pp t p nil) @@ -254,13 +254,13 @@ (defun unoffice--from-odt () (let (z p) (cl-labels ((rec (x) - (etypecase x + (cl-etypecase x (null) (string (unless (equal "" x) (push x p))) (cons - (case (car x) + (cl-case (car x) (text:p (setq p nil) (mapc #'rec (cddr x)) @@ -297,7 +297,7 @@ (ins '(/u)))) (rec (x) (when (consp x) - (case (car x) + (cl-case (car x) (w:bookmarkStart (ins (cons 'anchor (xml-get-attribute x 'w:name)))) (w:br