GNU bug report logs - #33377
TeX-run-silent doesn't set TeX-command-buffer, which causes an error

Previous Next

Package: auctex;

Reported by: Florent Rougon <f.rougon <at> free.fr>

Date: Wed, 14 Nov 2018 13:37:02 UTC

Severity: normal

Tags: fixed

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33377 in the body.
You can then email your comments to 33377 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#33377; Package auctex. (Wed, 14 Nov 2018 13:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Florent Rougon <f.rougon <at> free.fr>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Wed, 14 Nov 2018 13:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Florent Rougon <f.rougon <at> free.fr>
To: bug-auctex <at> gnu.org
Subject: TeX-run-silent doesn't set TeX-command-buffer, which causes an error
Date: Wed, 14 Nov 2018 13:04:58 +0100
[Message part 1 (text/plain, inline)]
Hello,

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 & regards

P.S. : all this with the current state of 'master', namely at commit
       06226ea5e95de16250c18ec3fd033f96237fa642 of the AUCTeX Git
       repository.

-- 
Florent
[set-TeX-command-buffer-in-TeX-run-silent.patch (text/x-diff, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#33377; Package auctex. (Wed, 14 Nov 2018 16:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 33377 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Florent Rougon <f.rougon <at> free.fr>
Cc: 33377 <at> debbugs.gnu.org
Subject: Re: 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 <f.rougon <at> 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)





Information forwarded to bug-auctex <at> gnu.org:
bug#33377; Package auctex. (Wed, 14 Nov 2018 18:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 33377 <at> debbugs.gnu.org (full text, mbox):

From: Florent Rougon <f.rougon <at> free.fr>
To: 33377 <at> debbugs.gnu.org
Subject: Re: bug#33377: TeX-run-silent doesn't set TeX-command-buffer,
 which causes an error
Date: Wed, 14 Nov 2018 19:33:13 +0100
Hi,

Thanks for your reply!

Ikumi Keita <ikumi <at> ikumi.que.jp> wrote:

> 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?

Correct: if I run the LaTeX "TeX command" before, no error message.

> 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 confirm it fixes the problem, many thanks!

-- 
Florent




Information forwarded to bug-auctex <at> gnu.org:
bug#33377; Package auctex. (Thu, 15 Nov 2018 05:59:02 GMT) Full text and rfc822 format available.

Message #14 received at 33377 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Florent Rougon <f.rougon <at> free.fr>
Cc: 33377 <at> debbugs.gnu.org
Subject: Re: bug#33377: TeX-run-silent doesn't set TeX-command-buffer,
 which causes an error
Date: Thu, 15 Nov 2018 14:58:45 +0900
>>>>> Florent Rougon <f.rougon <at> free.fr> writes:

> I confirm it fixes the problem, many thanks!

Thanks for confirmation, comitted!

Best,
Ikumi Keita




Added tag(s) fixed. Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Thu, 15 Nov 2018 06:00:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 33377 <at> debbugs.gnu.org and Florent Rougon <f.rougon <at> free.fr> Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Thu, 15 Nov 2018 06:00:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 13 Dec 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 148 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.