Subject: Re: bug#17059: bug 17059 still present

From: Alexis <[email-masked]>
Date: Thu, 23 Oct 2014 18:27:29 +1100

Stefan Monnier writes:

>> i then instrumented `doc-view-initiate-display` instead, and stepped
>> through it line-by-line .... and when it reached `(doc-view-open-text)`
>> and called it, the text was extracted and displayed in a buffer.
>
> The step-by-step gave the process time to finish before it gets killed.
>
>> i'm now no longer able to reproduce the issue with -nw -Q.
>
> The process is not needed any more because we reuse the output from
> earlier Emacs sessions (stashed in /tmp somewhere).

Ah, okay. Thanks for explaining!

So: calling `sit-for` in `doc-view-start-process` solves the problem for
me:

    (defun doc-view-start-process (name program args callback)
      ;; Make sure the process is started in an existing directory, (rather than                                       
      ;; some file-name-handler-managed dir, for example).                                                
      (let* ((default-directory (or (unhandled-file-name-directory
                                     default-directory)
                                  (expand-file-name "~/")))      
             (proc (apply 'start-process name doc-view-conversion-buffer
                          program args)))
        (push proc doc-view--current-converter-processes)
        (setq mode-line-process (list (format ":%s" proc)))
        (set-process-sentinel proc 'doc-view-sentinel)
        (sit-for 1)
        (process-put proc 'buffer   (current-buffer))
        (process-put proc 'callback callback)))

Is this a reasonable solution?

Alexis.