commit a22bb22ab0ac64a427f7039b29bd39801e177eff parent dbb662c2aebbd9545f024ad08d9cc2cf07b29c20 Author: Tomas Hlavaty <tom@logand.com> Date: Tue, 2 Jul 2019 08:45:47 +0200 add unoffice.el Diffstat:
A | unoffice.el | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/unoffice.el b/unoffice.el @@ -0,0 +1,25 @@ +;;(add-to-list 'auto-mode-alist '("\\.abw\\'" . unabw)) +;;(add-to-list 'auto-mode-alist '("\\.docx\\'" . undocx)) +;;(add-to-list 'auto-mode-alist '("\\.odt\\'" . unodt)) + +(defun unoffice-buffer (program) + (setq buffer-read-only nil) + (let ((coding-system-for-read 'utf-8-unix)) + (shell-command-on-region (point-min) + (point-max) + (concat program " '" buffer-file-name "'") + t + t)) + (setq buffer-read-only t) + (set-buffer-modified-p nil)) + +(defun unabw () + (unoffice-buffer "unabw")) + +(defun undocx () + (unoffice-buffer "undocx")) + +(defun unodt () + (unoffice-buffer "unodt")) + +(provide 'unoffice)