[TxMt] Fwd: Re: Regular expression for current file name without extension

Jan Jakob Bornheim jjbornheim at gmail.com
Wed May 20 11:15:42 UTC 2009


On Wed, May 20, 2009 at 11:40 AM, Allan Odgaard
<mailinglist at textmate.org> wrote:
> On 8 May 2009, at 00:50, Jan Jakob Bornheim wrote:
>
>> I use TextMate mainly for LaTex editing.
>>
>> [...] by using this simple syntax:
>>
>> texMate.py bibtex 1
>>
>> However, simply adding .rsp.aux after the 1 does not work. So I guess
>> what I am looking for is a command or regular expression that would do
>> the following: get the name of the current master file without
>> extension, and add the extension .rsp.aux to this name. Maybe that is
>> very simpe question I am asking but I promise you that I duly
>> researched the mailing list and could not find an answer.
>
> The real question is probably how to get the master file for a
> project. If you have set the TM_LATEX_MASTER variable that is easy, as
> you can just use "$TM_LATEX_MASTER" in your command, and "$
> {TM_LATEX_MASTER%.*}.rsp.aux" to cut the current extension and add
> your custom extension.

Thank you. That solves one big problem.

However, it still does not work.

If I define the command to be "texmate.py bibtex
${TM_LATEX_MASTER%.*}.rsp.aux", texmate.py pretty much seems to ignore
everything that comes after bibtex (i.e. I could write whatever I want
after bibdesk, the command will run on the result of
"${TM_LATEX_MASTER%.*}.aux" (without rsp).

If I simply define the command to be "bibtex
${TM_LATEX_MASTER%.*}.rsp.aux", bibtex itself gives the error "Need
exactly one file argument".If I instead define the command to run on
the actual file name (i.e. bibtex master.rsp.aux), it works.

So I assume the problem is that by using the second alternative, it is
bibtex that tries to guess the meaning of the expression
"${TM_LATEX_MASTER%.*}.rsp.aux", which it can't, while in the first
alternative, it is texmate.py that should interpret
"${TM_LATEX_MASTER%.*}.rsp.aux" but does not because texmate.py really
does not expect to have the file specified on which it runs bibtex.

Assuming my layman's guess is correct, I conclude that the expression
"${TM_LATEX_MASTER%.*}.rsp.aux" needs to be interpreted before being
handed over to the bibtex command. Is there a way to do that?



More information about the textmate mailing list