Hi Florent,

>>>>> Florent Rougon <f.rou...@free.fr> writes:
> In my TeX-command-list, I have things like this:

>   ("View with okular" "okular %s.pdf" TeX-run-silent nil nil)

> This command works but displays an error message in the Emacs echo area
> after okular has been started ("Wrong type argument: stringp, nil").
> This is because TeX-run-silent does:

>     (if TeX-after-start-process-function
>         (funcall TeX-after-start-process-function process))

> which, in my case, calls TeX-adjust-process-coding-system which runs:

>     (let ((cs (coding-system-base (with-current-buffer TeX-command-buffer
>                                   buffer-file-coding-system))))

> However, in the context described here, TeX-command-buffer is nil at
> this point, hence the aforementioned error that aborts
> TeX-adjust-process-coding-system. With the attached patch,
> TeX-adjust-process-coding-system completes normally.

> Can someone have a look and apply the patch, or otherwise fix the
> problem if there is a better way?

Thanks for the report.  I suppose that the problem occurs only when you
issue the command "View with okular" before excecuting any tex commands
within AUCTeX, doesn't it?

Anyway, there is similar problem with typing "C-c C-c Queue RET".
Considering that many codes in AUCTeX assumes that `TeX-command-buffer'
has suitable value, it seems better to make it sure that
`TeX-command-buffer' is set every time.  Cound you test the patch listed
below?  If it fixes your problem, I'll install in the git repository.

I know this patch introduces a small overhead, but I expect that's
negligibly tiny.

Regards,
Ikumi Keita

diff --git a/tex-buf.el b/tex-buf.el
index cc359388..80a16a0b 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -480,6 +480,8 @@ Run function `TeX-check-engine' to check the correct engine 
has
 been set."
   (TeX-check-engine name)
 
+  (setq-default TeX-command-buffer (current-buffer))
+
   (cond ((eq file #'TeX-region-file)
         (setq TeX-current-process-region-p t))
        ((eq file #'TeX-master-file)




_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to