summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-05-04 22:15:24 -0400
committerKyle Meyer <kyle@kyleam.com>2015-05-04 22:15:24 -0400
commit40c65ddc71387c904bd2938e6e4f7c6d48a4b2ec (patch)
treeeaea8de91ccb1d6151ec16c923384b2a11977ae0 /lisp
parentf6ab22e45bfdc922a1a06df87a7c42de327354b8 (diff)
downloademacs.d-40c65ddc71387c904bd2938e6e4f7c6d48a4b2ec.tar.gz
Rewrite columnify-file
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-text.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/init-text.el b/lisp/init-text.el
index c180cd3..c4fbecc 100644
--- a/lisp/init-text.el
+++ b/lisp/init-text.el
@@ -39,17 +39,16 @@ If a columnified buffer already exists, just switch to it."
((> (prefix-numeric-value current-prefix-arg) 4)
(read-string "Delimiter: "))
(t nil))))
- (let* ((bufname (buffer-name))
- (output-buffer-name (concat "*cols: " bufname "*"))
+ (unless buffer-file-name
+ (user-error "Buffer not visiting a file"))
+ (let* ((output-buffer-name (concat "*cols: " (buffer-name) "*"))
(output-buffer (get-buffer output-buffer-name))
(fname (file-relative-name buffer-file-name))
- (col-args '("-t")))
+ (args (cons "--table"
+ (and delim (list "--separator" delim)))))
(unless output-buffer
(setq output-buffer (get-buffer-create output-buffer-name))
- (when delim
- (add-to-list 'col-args (format "-s'%s'" delim)))
- (apply 'call-process "column" fname output-buffer nil
- col-args))
+ (apply #'call-process "column" fname output-buffer nil args))
(switch-to-buffer output-buffer)))
(provide 'init-text)