Subject: bug#20513: 11.88.5; TeX-view-program-list generated in wrong format by Customize

From: Tassilo Horn <[email-masked]>
Date: Thu, 07 May 2015 08:39:43 +0200

Дарио Ѓорѓевски <[email-masked]> writes:

Hi!

> Consider the following customization of the TeX-view-program-list
> variable: http://i.imgur.com/xP6Cx5k.png
> The generated Lisp expression looks like so:
> '(("SumatraPDF"
>    (("SumatraPDF.exe"
>      (mode-io-correlate " -forward-search %b %n")
>      " %o"))
>    "SumatraPDF.exe"))
>
> This causes TeX-view-command-raw (tex.el, line 1354) to go into an
> *infinite loop*. I do not know why the infinite loop occurs, however,
> I know that changing
>
> (dolist (elt car spec)
> to
> (dolist (elt (car spec))
>
> solves the issue.

The former line looks strange, indeed.  However, it seems you are
looking at a different tex.el than the one that ships with ELPA AUCTeX
11.88.5.  In there, the `TeX-view-command-raw' definition is:

--8<---------------cut here---------------start------------->8---
(defun TeX-view-command-raw ()
  "Choose a viewer and return its unexpanded command string."
  (let ((selection TeX-view-program-selection)
        entry viewer item executable spec command)
    ;; Find the appropriate viewer.
    (while (and (setq entry (pop selection)) (not viewer))
      (when (TeX-view-match-predicate (car entry))
        (setq viewer (cadr entry))))
    (unless viewer
      (error "No matching viewer found"))
    (setq item (assoc viewer (append TeX-view-program-list
                                     TeX-view-program-list-builtin))
          ;; Get the command line or function spec.
          spec (cadr item)
          ;; Get the name of the executable(s) associated to the viewer.
          executable (nth 2 item))
    ;; Check the executable exists.
    (unless (or (null executable)
                (cond
                 ((stringp executable)
                  (executable-find (TeX-command-expand executable nil)))
                 ((listp executable)
                  (catch 'notfound
                    (dolist (exec executable t)
                      (unless (executable-find (TeX-command-expand exec nil))
                        (throw 'notfound nil)))))))
      (error (format "Cannot find %S viewer.  \
Select another one in `TeX-view-program-selection'" viewer)))
    (cond ((functionp spec)
           ;; Converting the function call to a string is ugly, but
           ;; the backend currently only supports strings.
           (prin1-to-string spec))
          ((stringp spec)
           spec)
          ((null spec)
           (error
            (format "Unknown %S viewer. \
Check the `TeX-view-program-selection' variable" viewer)))
          (t
           ;; Build the unexpanded command line.  Pieces with predicates are
           ;; only added if the predicate is evaluated positively.
           (dolist (elt spec)
             (cond ((stringp elt)
                    (setq command (concat command elt)))
                   ((listp elt)
                    (when (TeX-view-match-predicate (car elt))
                      (setq command (concat command (cadr elt)))))))
           command))))
--8<---------------cut here---------------end--------------->8---

So as you can see, no (dolist (elt car spec) ...) anywhere.

Have a look at `M-x list-load-path-shadows' to check if there's some
older, outdated auctex version around which messes with 11.88.5.

Bye,
Tassilo