feat(sterni/emacs): function to display texcount for current file

Change-Id: Iae09dd79494d65e4025e1e34ab1d848ef2b9cd47
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5722
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
sterni 2022-05-28 00:23:50 +02:00 committed by clbot
parent 0d694afee4
commit e86d0101d5

View file

@ -120,6 +120,19 @@
"/.config/emacs-custom/pa-jira.el")))
(when (file-exists-p jira-config) (load jira-config))))))
;; latex
(defun latex-word-count ()
"Calls texcount on the file the current buffer points to and displays the result."
(interactive)
(save-buffer)
(let* ((file (buffer-file-name)) ; needs to happen outside with-current-buffer
(word-count
(with-output-to-string
(with-current-buffer standard-output
(call-process "texcount" nil t nil "-brief" "-utf8" file)))))
(message (string-trim-right word-count))))
;; ediff
; doesn't create new window for ediff controls which I always open accidentally
(setq ediff-window-setup-function 'ediff-setup-windows-plain)