On Sat, 09 Oct 2010 20:24 +0100, "Caolán McNamara" <caol...@redhat.com> wrote: > On Sat, 2010-10-09 at 11:41 -0700, some...@boldandbusted.com wrote: > > Howdy, all. It took some effort for this SysAdmin to craft a shell > > script to meet this "EasyHack", > > The principal looks good. Here's a edge-case test file though, e.g. > > writer/sw/source/filter/ww8/ww8atr.cxx > > it already has a "/* vi:"... modeline at the bottom, so maybe best thing > is to detect and remove conflicting modelines. Though there's so few of > them, they could be handled manually, so its no biggy. > > C. > >
Hi Caolán, One thing that is stinky about this edge case is that the Emacs(?) modeline is actually in the *middle* of the file (after the first #include). Not sure what to do about that, since it is pretty expensive to actually search every part of every file, versus only search the top line and bottom line as add-modelines does now. But, based on your comment, I don't think I'll spend too much effort on dealing with that since it appears to be a quick manual fix. I'm almost ready to submit the next version of the script. It'll have arguments that can be specified to: * Set the top-level directory to search (-p <sourcecode path>) * Wipe out existing modelines (or not) (-z) * Specify filetype via any number of *.<suffix> (-s <file glob>) Also, if none are specified, it'll use defaults that are the same as the previous version (don't zap existing modelines, decscend down from the cwd, change *.cxx and *.cpp). So, for example you could do this: ./add-modelines -z -p LibreOffice-source/ -s *.cxx *.hxx *.h and existing modelines would be replaced, the path would be ./LibreOffice-source/, and the file types would be *.cxx, *.hxx and *.h . All functions work, generally, though I'm working through a bug that, interestingly enough, added a second modeline to the bottom of this particular edge-case file, rather than replacing it as I asked. Once that bug is quashed, I'll post the updated script to this list. Cheers, Jesse Adelman San Francisco, CA Bold and Busted LLC http://www.boldandbusted.com/ _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice