Subject: Re: bug#40449: 12.1; view with okular crashes

From: Arash Esbati <[email-masked]>
Date: Mon, 06 Apr 2020 23:18:44 +0200

Hi Ernst,

Ernst Reissner <[email-masked]> writes:

> In newest version of auctex, there is no tex view list any more.

There is still a `TeX-view-program-list' but it is a user customizable
variable which defaults to nil.  The predefined entries are in
`TeX-view-program-list-builtin'.

> The old one was
>  '(TeX-view-program-list
>    (quote
>     (("Okular" "okular -unique %o#src:%n%(masterdir)./%b"))
>     ))
>
> but as masterdir seems no longer supported, view crashes.
> I modified:
>
>  '(TeX-view-program-list
>    (quote
>     ;(("Okular" "okular -unique %o#src:%n%(masterdir)./%b"))
>      (("Okular" "okular -unique %o#src:%n./%b"))
>     ))

`TeX-view-program-list-builtin' has an entry for Okular which goes like
this:

    ("Okular" ("okular --unique %o" (mode-io-correlate "#src:%n%a")) "okular")

%a is an expander defined like this in `TeX-expand-list-builtin', note
the comment:

    ;; Okular forward PDF search requires absolute path.
    ("%a" (lambda nil (prin1-to-string (expand-file-name (buffer-file-name)))))

> This works better but sometimes causes a crash with okular
> if tried to tap on a menu item.
> There is a workaround.
> But of course this config is a workaround itself.

I don't use Okular but in theory, it should be sufficient if you check
the above variables for entries quoted (otherwise please update AUCTeX)
and just put something like this in your init file:

    (setq TeX-view-program-selection '((output-pdf "Okular")))

Okular must be in $PATH then.

Best, Arash