5

I normally use OS X, and have recently decided to start using Emacs, and specifically AUCTeX based on myriad recommendations. I downloaded the current version for OS X and tried to preview a very simple document:

\documentclass{article} 
\begin{document} 
$e^x=10$ 
\end{document} 

When I tried to use preview-buffer and preview-at point, I initially got the usual PATH-based errors that one seems to get on OS X, but on correcting those I got an error that didn't seem to be caused by the PATH:

PDF2DSC sentinel: Wrong type argument: arrayp, nil

The process then seems to hang, producing no further output, although DSC files do appear to have been created in _region_.prv/tmpXXXXXX/

I switched over to the Linux side of my laptop (Arch Linux), installed Emacs 24.4.1 and the current version of AUCTeX (11.88.2), only to discover that the issue had followed me across partitions.

Edit: Added debug info

When I enable debugging on error I get this:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  signal(wrong-type-argument (arrayp nil))
  preview-reraise-error(#<process Preview-PDF2DSC>)
  preview-pdf2dsc-sentinel(#<process Preview-PDF2DSC> "Preview-PDF2DSC" t)
  (lambda (process command) (preview-pdf2dsc-sentinel process command t))(#<process Preview-PDF2DSC> "Preview-PDF2DSC")
  TeX-command-sentinel(#<process Preview-PDF2DSC> "finished\n")

I'm not an emacs lisp expert (learning is slow), so I'm not sure what this means, but it looks like the error comes from this section of preview.el:

(defun preview-pdf2dsc-sentinel (process _command &optional gsstart)
  "Sentinel function for indirect rendering PDF process.
The usual PROCESS and COMMAND arguments for
`TeX-sentinel-function' apply.  Starts gs if GSSTART is set."
  (condition-case err
      (let ((status (process-status process)))
    (cond ((eq status 'exit)
           (delete-process process)
           (setq TeX-sentinel-function nil)
           (setq preview-gs-init-string
             (concat preview-gs-init-string
                 (preview-pdf-color-string preview-colors)))
           (preview-prepare-fast-conversion)
           (when gsstart
         (if preview-gs-queue
             (preview-gs-restart)
           (when preview-ps-file
             (condition-case nil
             (preview-delete-file preview-ps-file)
               (file-error nil))))))
          ((eq status 'signal)
           (delete-process process)
           (preview-dvips-abort))))
    (error (preview-log-error err "PDF2DSC sentinel" process)))

I have TeXlive 2014.34872-1 installed, and Emacs seems to have the right PATH set in both OS X and Linux (as determined by getenv PATH. I only found one other mention of this problem online (http://lists.gnu.org/archive/html/auctex/2014-12/msg00020.html), and there's no resolution to the issue.

Am I doing something wrong, or is this a bug?

  • Can tex.stackexchange.com/a/156617/39306 help? – Name Feb 3 '15 at 19:43
  • I don't think so. The PDF generation works fine, and I can actually view it fine in DocView mode; it's just the inline preview command that hangs. – Ben Weinstein-Raun Feb 3 '15 at 20:00
  • Have you tried doing M-x toggle-debug-on-error before you trigger an error to debug where the error originates? – PythonNut Feb 3 '15 at 20:29
  • Thanks! I wasn't aware of that switch. I added the relevant info to the question. – Ben Weinstein-Raun Feb 3 '15 at 23:27
3

So, after asking this question in gnu.emacs.help, Tassilo Horn pointed out that the preview-gs-command variable was nil. gs was in my PATH (and my PATH is loaded correctly), but that variable wasn't populated for some reason. When I add (setq preview-gs-command "/usr/local/bin/gs") to my init.el, everything works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.