GNU bug report logs - #35964
TeX-strip-extension not doing what's documented, TeX-master-file always returning relative name

Previous Next

Package: auctex;

Reported by: Jan Seeger <jan.seeger+auctex <at> thenybble.de>

Date: Tue, 28 May 2019 16:33:02 UTC

Severity: normal

Tags: notabug

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Jan Seeger <jan.seeger+auctex <at> thenybble.de>
To: bug-auctex <at> gnu.org
Subject: TeX-strip-extension not doing what's documented,
 TeX-master-file  always returning relative name
Date: Tue, 28 May 2019 17:40:59 +0200
Hey!

While trying to get TeX-master-file to produce an absolute path, I found 
that the `nodir` argument to TeX-strip-extension was not doing what was 
expected. The filename was still getting stripped, and the code on lines 
4393 to 4398 in `tex.el` was responsible for that.

`TeX-strip-extension` is documented in the function's docstring to 
remove the directory name from the file name if (and only if):

(1) The NODIR argument is `t`
(2) The NODIR argument is `'path`, and the file is in the current 
directory or in the LaTeX macro path.

However, the second case check is implemented without regard for the 
special value 'path, and strips the directory even when NODIR is nil.

I've modified the check to

    (if (or (eq nodir t)
	    (and (eq nodir 'path)
		 (or
		  (string-equal dir (expand-file-name "./"))
		  (member dir TeX-macro-global)
		  (member dir TeX-macro-private))))
	(file-name-nondirectory strip)

and this gives me an absolute path from `TeX-strip-extension`.

Relatedly, `TeX-master-file` also fails to return an absolute path to 
the master file if the `NONDIR` argument is nil because the `NONDIR` 
argument is not forwarded to TeX-strip-extension, and thus always 
returns a filename without directory part. The relevant line is line 
2332 in `tex.el`.

I hope these fixes make sense, if you need any more info please do not 
hesitate to ask.

Best regards,
Jan




This bug report was last modified 1 year and 42 days ago.

Previous Next


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