[TxMt] Re: latex.rb issue

René Schwaiger sanssecours at f-m.fm
Sat May 30 12:45:20 UTC 2015


Hi Geoff,

> On 30 May 2015, at 12:40 , Geoff Vallis <gkvallis at gmail.com> wrote:
> 
> I started using TextMate for LaTex this morning on OS X 10.10.3 and noticed some of my custom bundle commands were not working. For example, the following script that just echoes the name of the master file in a terminal window did not work:
> 
> #!/usr/bin/env bash
> [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
> TM_LATEX_MASTER=`${TM_RUBY:-ruby} <<"RUBY"
> require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb"
> require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/latex.rb"
> master = LaTeX.master(ENV['TM_LATEX_MASTER'] || 
> ENV['TM_FILEPATH'])
> puts master
> RUBY`
> cd ${TM_DIRECTORY}
> /Users/gkv/scripts/term2 "echo $TM_LATEX_MASTER “ 
> 
> (where term2 just opens a terminal window and echoes the command). After some exploring, it seemed that texmate was not finding latex.rb in its designated directory, namely:
>   /Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/
> Rather, latex.rb  is in the ruby directory underneath that. When I made a symbolic link of latex.rb from ruby into the lib directory, (nearly) everything works again. The same behaviour occurred in my laptop.  
> 
> This seems bizarre. What happened?
> 
> Did something change with an update? 

I just moved the library stuff for JavaScript, Ruby, Perl and Python into their own directories[1][2][3][4]. This was more or less part of an cleanup effort to keep the code for each language separate.

[1]: https://github.com/textmate/latex.tmbundle/commit/209faec4
[2]: https://github.com/textmate/latex.tmbundle/commit/4923a285
[3]: https://github.com/textmate/latex.tmbundle/commit/6948196d
[4]: https://github.com/textmate/latex.tmbundle/commit/0e5b5c5f

`latex.rb` did not change that much in the last two months or so. So everything should work fine after you change your commands to require `/lib/Ruby/latex.rb` instead of `/lib/latex.rb`. If you still have problems, then please just file an issue at the GitHub page of the bundle [GitHub].

[GitHub]: https://github.com/textmate/latex.tmbundle/issues 

I would also recommend that you open a pull request if you made changes to something that could be helpful to others. I am afraid that otherwise your custom commands might break in the future too.

> As a follow up, I notice, by using Time Machine, that the contents of 
> ~/Library/Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/
> have indeed changed in the past few days, presumably with an update. So I suppose the recommended way to proceed is to edit the bundle item to have the correct path, namely:
>  require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/ruby/latex.rb”
> Please advise.

Yes — as said above — the recommended way is to change the path in the require command.  

> Is anything else likely to be similarly broken?

I would not use the word “broken” here, since we make no guarantee about the “API” of the bundle. Considering the recent changes: If you have any code that uses stuff in `lib`, then you need to update the import statement in such a way that it targets one of the new directories `lib/Ruby`, `lib/Python`, `lib/JavaScript` or `lib/Perl`.  
 
> Perhaps unrelatedly, I also notice my syncing command was now broken, but could be fixed by replacing 
> texMate.py sync 1
> with
> texmate.py sync 

It seems that your bundle code contains very outdated stuff. I would recommend that you remove your custom changes to the LaTeX bundle and instead create a new bundle with a different name that just saves your own extension commands. This way an update should at least not break the stuff of your local copy of the LaTeX bundle. 

As said before, if your code contains any stuff that might be helpful to others, then please consider opening a pull request. If there are any other problems that you have with the bundle, then please open an issue [GitHub]. There is a high chance that someone else might have the same problem. By opening an issue you not only help yourself but might make other users happier too.

> Thanks
> Geoff

Kind regards,
  René


More information about the textmate mailing list