因此,我有一个关于让字数在emacs LaTeX模式下正确工作的问题(auctex,实际上,但不要紧)。That was answered fine。然后我发现当(buffer-file-name)
包含空格时我遇到了麻烦。这使它搞砸了。 This problem was got around too。现在的问题是当没有空格时解决方案会中断。在emacs中调用(缓冲区文件名)时跳过空格
所以目前我有两个Emacs命令:
(defun latex-word-count()
(interactive)
(shell-command (concat "/usr/local/bin/texcount.pl "
"-inc "
(shell-quote-argument (concat "'" (buffer-file-name) "'")))))
当有包含文件夹的空间工作的。
(defun latex-word-c-nospace()
(interactive)
(shell-command (concat "/usr/local/bin/texcount.pl "
"-inc "
(shell-quote-argument (buffer-file-name)))))
这适用于包含文件夹名称中没有空格的情况。 (好,所以缩进是一个有点screwey,但无论如何)
我的问题:有一种方法可以在两种情况下具有相同的功能? This answer表示问题出在texcount而不是emacs。有没有办法做到这一点,而不会弄乱texcount.pl?或者,我最好的办法是用Chris Johnsen在SU上提出的方式来戳一下texcount.pl?
这似乎工作。我试着自己输入命令,试着弄清楚命令在做什么。我明显得到括号错误或某事,因为它不断给我错误。但是当我将这段代码放入我的.emacs中时,它工作正常。谢谢! – Seamus 2010-07-21 12:46:35