thomasjo/atom-latex — pull request #13 by boborbt (2014-07-10 09:51:29+00:00)
Title: Adds an auto-find-tex-master feature.

When asked to compile a latex file the package would now search the current directory for the master tex file. This is helpful in case the latex document is split in several files since it allows compilation from any latex file in the project. IMHO this solves, except for weird project configurations, the most important problem currently deriving by still not having proper project management: the necessity to switch to the latex master file before invoking the compilation. The code in this pull request could be used when building project management support to initialise the project settings with a sensible guess of the latex master file.

Performance issues: the present implementation would (possibly) scan every tex file contained in the current directory in search for a file containing a documentclass declaration. On my system (a relatively new MacBook pro) it adds negligible compilation time to a project with 10 latex files resulting in a 60 pages document (it also happens that the master file is found after analysing almost all the other files, so I was close to the worst case scenario). My gut feelings is that there should not be performance issues but for the most constrained machines working on the largest latex files. When proper project management is implemented, the issues would be solved since the search would be run only during the initialisation of the project (i.e., only once).

Possible improvements:
- option to disable it (one should be able to set this option in the project and in the main package config);
- it may be useful to bind the compilation with this feature to a different key binding (in weird situations where a single directory contains more master files the algorithm would select one at random, -- notice that it is not hard to change the logic of the algorithm so to find the master file including the currently selected file).