emacs_v2.el

;;
;; TeXcount setup for TeXcount version 2.2
;;
(defun texcount ()
  (interactive)
  (let*
    ( (this-file (buffer-file-name))
      (enc-str (symbol-name buffer-file-coding-system))
      (enc-opt (cond ((string-match "utf-8" enc-str) "-utf8") ("")))
      (word-count
        (with-output-to-string
          (with-current-buffer standard-output
            (call-process "texcount" nil t nil "-1" "-relaxed" enc-opt this-file)
    ) ) ) )
    (string-match "\n*$" word-count)
    (message (replace-match "" nil nil word-count))
) )
(add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map "\C-cw" 'texcount)))
(add-hook 'latex-mode-hook (lambda () (define-key latex-mode-map "\C-cw" 'texcount)))


Last modified January 29, 2017.