tom-tan / auctex-latexmk

This library adds LatexMk support to AUCTeX.
93 stars 24 forks source link

TeX-command-run-all fails #24

Closed ellio167 closed 8 years ago

ellio167 commented 8 years ago

Hello, Thanks for the nice package!

However, I'm having one problem that I hope you can help me resolve. When I use C-cC-a to execute TeX-command-run-all, I get this error:

TeX-command-expand: Wrong type argument: stringp, nil

Any thoughts?

Here is my related .emacs config settings:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; AUCTeX settings
;;
(load "auctex.el" nil t t)
;;
(add-hook 'LaTeX-mode-hook
          (function (lambda ()
                      ;; general setup
                      (turn-on-reftex)
                      (LaTeX-math-mode)
                      (setq-local comment-column 0)
                      (setq-local comment-padding 1)
                      (setq-local TeX-parse-self t)
                      ;; set default indent values
                      (setq-local LaTeX-indent-environment-list ())
                      (setq-local LaTeX-indent-level 0)
                      (setq-local LaTeX-item-indent 0)
                      (setq-local TeX-brace-indent-level 0)
                      (local-set-key [return]
                                     'reindent-then-newline-and-indent)
                      ;; setup latexmk to work with auctex
                      (add-to-list 'load-path "~/share/emacs/site-lisp/auctex-latexmk")
                      (require 'auctex-latexmk)
                      (auctex-latexmk-setup)
                      (setq-local TeX-command-default "LatexMK")
                      (setq-local auctex-latexmk-inherit-TeX-PDF-mode t)
                      ;; settings to make interaction with Skim work
                      (TeX-source-correlate-mode)
                      (add-to-list 'TeX-view-program-selection
                                   '(output-pdf "PDF Viewer"))
                      (add-to-list 'TeX-view-program-list
                                   '("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
                      ;; settings for clean up
                      (add-to-list 'LaTeX-clean-intermediate-suffixes
                                   "\\.spl" "\\.tex~")
                      )))
tom-tan commented 8 years ago

I could not reproduce this issue...

I used Emacs 24.5.1, AUCTeX 11.89.4 (installed from package.el), and the latest auctex-latexmk. I invoked Emacs with -q option (that is, invoke it without any settings) and evaluated the following code in the scratch buffer.

(require 'cask) ;; I assume that auctex and auctex-latexmk are installed via package.el or cask.el
(cask-initialize)
(auctex-latexmk-setup)

And I tried to compile the following TeX file using C-c C-a.

\documentclass{article}

\begin{document}
aaaa
\end{document}

Finally, I could see the preview.

Could you reproduce the issue with -q option?

ellio167 commented 8 years ago

Hi, Thanks for your reply.

I'm using brew for my emacs and auctex

$ brew info emacs
emacs: stable 24.5 (bottled), devel 25.1-rc1, HEAD
GNU Emacs text editor
https://www.gnu.org/software/emacs/
/usr/local/Cellar/emacs/24.5 (3,916 files, 96.9M) *
  Built from source on 2016-06-01 at 09:02:35 with: --with-x11
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/emacs.rb
$ brew info auctex
homebrew/tex/auctex: stable 11.89, HEAD
Emacs package for writing and formatting TeX
https://www.gnu.org/software/auctex/
/usr/local/Cellar/auctex/11.89 (504 files, 4.9M) *
  Built from source on 2016-03-20 at 18:08:01
From: https://github.com/Homebrew/homebrew-tex/blob/master/Formula/auctex.rb

If I use emacs -q and execute

(add-to-list 'load-path "~/share/emacs/site-lisp/auctex-latexmk")
(require 'auctex-latexmk)
(auctex-latexmk-setup)

then C-c C-a works fine. However, if I use emacs -q and execute

(load "auctex.el" nil t t)
;;
(add-hook 'LaTeX-mode-hook
          (function (lambda ()
                      ;; general setup
                      (turn-on-reftex)
                      (LaTeX-math-mode)
                      (setq-local comment-column 0)
                      (setq-local comment-padding 1)
                      (setq-local TeX-parse-self t)
                      ;; set default indent values
                      (setq-local LaTeX-indent-environment-list ())
                      (setq-local LaTeX-indent-level 0)
                      (setq-local LaTeX-item-indent 0)
                      (setq-local TeX-brace-indent-level 0)
                      (local-set-key [return]
                                     'reindent-then-newline-and-indent)
                      ;; setup latexmk to work with auctex
                      (add-to-list 'load-path "~/share/emacs/site-lisp/auctex-latexmk")
                      (require 'auctex-latexmk)
                      (auctex-latexmk-setup)
                      (setq-local TeX-command-default "LatexMK")
                      (setq-local auctex-latexmk-inherit-TeX-PDF-mode t)
                      ;; settings to make interaction with Skim work
                      (TeX-source-correlate-mode)
                      (add-to-list 'TeX-view-program-selection
                                   '(output-pdf "PDF Viewer"))
                      (add-to-list 'TeX-view-program-list
                                   '("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
                      ;; settings for clean up
                      (add-to-list 'LaTeX-clean-intermediate-suffixes
                                   "\\.spl" "\\.tex~")
                      )))

then C-c C-a produces the error I mentioned previously.

tom-tan commented 8 years ago

Sorry for late reply.

I finally found that.

                 (setq-local TeX-command-default "LatexMK")

Please use "LatexMk" instead of "LatexMK".

ellio167 commented 8 years ago

Yes! That does it. Such a stupid mistake. Thanks for finding my error and for a nice package!