Subject: bug#36483: 12.1.2; 'lacheck' and 'chktex' results not recongnized by compilation mode when filename has spaces

From: Gustavo Barros <[email-masked]>
Date: Mon, 15 Jul 2019 14:53:08 -0300

Hi Keita,

On Mon, Jul 15 2019, Ikumi Keita wrote:

> Hi Gustavo,
>
>>>>>> Gustavo Barros <[email-masked]> writes:
>
> I reported this problem in [email-masked], but didn't get any
> response unfortunately.  What we can do tentatively now is to add an
> ad-hoc workaround like a patch quoted below to AUCTeX.

Thank you for that.

>
> What do you think about this?
>

Well, the potential repercussions of the change are somewhat beyond my league. 
But I understand the proposed change is restrained to `TeX-command-buffer`, so 
no consequences are expected outside AUCTeX.

However, I don’t have the means to judge if this might cause any side effects 
to other TeX-commands or if dealing with this in ad-hoc fashion is to be 
frowned upon or not (it looks good to me, but I’m no dev). So I trust your 
judgment on that. If you are fine with it, so am I.

Of course, I’ve tested it, and it works. So I’m very happy with this 
result. Thank you very much.

> Regards,
> Ikumi Keita
>
> diff --git a/tex-buf.el b/tex-buf.el
> index 8b87c4c6..cf3ada95 100644
> --- a/tex-buf.el
> +++ b/tex-buf.el
> @@ -1293,7 +1293,17 @@ run of `TeX-run-TeX', use
>  (defun TeX-run-compile (_name command _file)
>    "Ignore first and third argument, start compile with second argument."
>    (let ((default-directory (TeX-master-directory)))
> -    (setq TeX-command-buffer (compile command))))
> +    (setq TeX-command-buffer (compile command)))
> +  ;; Make `compilation-mode' to recognize file names with spaces.
> +  ;; (bug#36483)
> +  (with-current-buffer TeX-command-buffer
> +    (make-local-variable 'compilation-error-regexp-alist)
> +    (add-to-list 'compilation-error-regexp-alist
> +		 ;; Add slightly modified entry of the one associated
> +		 ;; with `comma' in `compilation-error-regexp-alist-alist'
> +		 ;; to pick up file names with spaces.
> +		 '("^\"\\([^,\"\n\t]+\\)\", line \\([0-9]+\\)\
> +\\(?:[(. pos]+\\([0-9]+\\))?\\)?[:.,; (-]\\( warning:\\|[-0-9 ]*(W)\\)?" 1 
> 2 3 (4)) t))))
>  
>  (defun TeX-run-shell (_name command _file)
>    "Ignore first and third argument, start shell-command with second 
>    argument."

Besides that, if I may.
I’m not an English native speaker, but I do think "Make `compilation-mode' 
recognize file names with spaces." would sound better. And, if I am not 
mistaken, I believe there is a (closing) parenthesis too much in the patch.

Thank you again very much for seeing this through.

Best regards,
Gustavo Barros.