bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33377: TeX-run-silent doesn't set TeX-command-buffer, which causes a


From: Ikumi Keita
Subject: bug#33377: TeX-run-silent doesn't set TeX-command-buffer, which causes an error
Date: Thu, 15 Nov 2018 01:50:32 +0900

Hi Florent,

>>>>> Florent Rougon <address@hidden> 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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]