auctex-devel
[Top][All Lists]
Advanced

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

Re: Output filenames and the inconsistency of the `file` variable


From: Al Haji-Ali
Subject: Re: Output filenames and the inconsistency of the `file` variable
Date: Wed, 26 Aug 2020 09:50:37 +0100
User-agent: mu4e 1.5.5; emacs 27.1

Hi Ikumi,

Thanks for the feedback!

> In my humble opinion, it's a bit dangerous to presume so. In general, a
> user can have an entry in TeX-view-program-list like
> ("XYZ" my-TeX-view-open-XYZ)
> where the second symbol is one's own elisp function. If that function
> assumes that the variable `file' has string value, your proposal would
> cause error.
>
I see. From a documentation point of view, the only mention of `file` is in the 
documentation  of `TeX-expand-list`, where it says

"The special value file will be expanded to the name of the file being 
processed, with an optional extension."

So `TeX-expand-list` entries treat `file` as a function. The documentation of 
`TeX-view-program-list` does not mention `file` as a variable. So from this 
perspective, IMO it is justifiable to normalize the treatment of this variable.

With that being said, I understand that this could break some user configs that 
use undocumented variables. Although I would argue that changing the name of 
the variable (as the thread you linked earlier suggests) would also break these 
configs.

> How about using functionp test or stringp test on the value of `file'
> for the changes in TeX-pdf-tools-sync-view and TeX-evince-sync-view-1?
> That would be rather safe way although there still remains doubled
> identity, function name and string, of the variable `file'...
>
I am not sure how to do this using `functionp` and `stringp`. The problem is 
the value of `file` is overwritten in `TeX-command` before the program is 
called so in `TeX-pdf-tools-sync-view` and `TeX-evince-sync-view-1` the 
function value of `file` is inaccessible. One way to not break any past 
behavior would be to introduce a new dynamically-scoped variable `file-fn` that 
always has the function value. Although I am not sure if introducing yet 
another dynamically scoped variable is a good solution long-term.

> Another possible idea is to stop relying on dynamic scope variable
> `file' and just to call TeX-active-master in TeX-pdf-tools-sync-view and
> TeX-evince-sync-view-1. My understanding is that TeX-active-master
> serves for such purposes for most cases.
>
This is what I thought at first. However, according to comments in tex.el, 
`file` can be
`TeX-master-file', `TeX-region-file' or `TeX-active-master'.

I am not an AUCTeX expert, so I don't know if there is any difference between 
`TeX-master-file` and `TeX-active-master'. Also, I don't use regions so I am 
not sure if the value `TeX-region-file' is relevant for `TeX-active-master` and 
`TeX-pdf-tools-sync-view`.

Best regards,
-- Al



reply via email to

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