Subject: Re: bug#28905: 11.90.2.2017-07-25; TeX-documentation-texdoc blocks

From: "Fran Burstall (Gmail)" <[email-masked]>
Date: Sat, 3 Nov 2018 21:17:39 +0000

Hi Ikumi,

It works for me.  Pass "amsmath" to the patched TeX-documentation-texdoc
and it fires evince on the documentation without blocking emacs; fire it on
"foobar" and I get a sensible message about not finding any documentation.

---Fran

On Sat, 3 Nov 2018 at 18:02, Ikumi Keita <[email-masked]> wrote:

> Hi Fran, Mosè and all, I'm responding to one year old thread.
>
> >>>>> "Fran Burstall (Gmail)" <[email-masked]> writes:
> > Thanks, Moisè, for looking into this and thank you Keita for verifying
> the
> > issue.
>
> > I shall use tex-doc for the time being.
>
> After struggling with this problem again, it seems that I managed to
> find out a solution.  The patch listed below resolves the problem on my
> environment.  Could you please try it?
>
> If it fixes the problem without harming other's environments, I'll
> install this in the git repository.
>
> Regards,
> Ikumi Keita
>
> diff --git a/tex.el b/tex.el
> index 9995af3f..2d3942f3 100644
> --- a/tex.el
> +++ b/tex.el
> @@ -6350,7 +6350,27 @@ the number of the file to view, anything else to
> skip: ") list)))
>         ;; Called without prefix argument: just run "texdoc --view <pkg>"
> and
>         ;; show the output, so that the user is warned in case it doesn't
> find
>         ;; the documentation or "texdoc" is not available.
> -       (message (shell-command-to-string (concat "texdoc --view "
> pkg)))))))
> +       (message
> +        ;; The folowing code to the end of `defun' used to be just
> +        ;; (shell-command-to-string (concat "texdoc --view " pkg))
> +        ;; , but in some cases it blocks emacs until the user quits
> +        ;; the viewer (bug#28905).
> +        (with-output-to-string
> +          (let* (;; Use pipe rather than pty because the latter
> +                 ;; causes atril (evince variant viewer) to exit
> +                 ;; before showing anything.
> +                 (process-connection-type nil)
> +                 (process (start-process-shell-command
> +                           "Doc view" standard-output
> +                           (concat "texdoc --view " pkg))))
> +            ;; Suppress the message "Process Doc view finished".
> +            (set-process-sentinel process #'ignore)
> +            ;; Kill temp buffer without query.  This is necessary if
> +            ;; the underneath shell can't find the texdoc binary, at
> +            ;; least for some environment.
> +            (set-process-query-on-exit-flag process nil)
> +            ;; Don't discard shell output.
> +            (accept-process-output process))))))))
>
>  (defun TeX-goto-info-page ()
>    "Read documentation for AUCTeX in the info system."
>
>