[TxMt] Problem with code folding in BibTeX mode

Charilaos Skiadas cskiadas at uchicago.edu
Fri May 12 01:27:04 UTC 2006


Hi Matthias,

	as far as I can tell, this is not possible atm. Funny enough, the  
reason is the spaces/tabs in front of "Year". As it stands, the  
folding will terminate on any line that starts with a non-zero  
character, because it only checks for the existence of a right brace  
on the line. However, there is an extra requirement for foldings in  
TM at the moment, namely that the first non-space character is at the  
same column location as the corresponding one for starting folding  
marker. So no luck atm I'm afraid.

Of course it is easy to write a command that replaces the entire  
document with one with the right brace moved to the next line. In  
fact, you probably just need:

#!/usr/bin/env ruby
STDIN.readlines.each{|line| puts line.gsub(/\}\}/,"\}\n\}") }

with input selected text with fallback document, and output replace  
selected text.

Just out of curiosity, what prompted the need for folding  
bibliographies? I personally do most of my bibtex work in bibdesk,  
and I've only used TM for "search and replace" kind of work.

On May 11, 2006, at 6:29 PM, Matthias Damm wrote:

> Hi,
>
> I recently opened some BibTeX documents in TM (which I normally  
> don't do since I use BibDesk) and recognized the following problem:
> TM tries to fold the BibTeX code, but the end of the BibTeX entries  
> are not reocgnized correctly.
>
> My entries look like this:
>
> @book{ros:02,
> 	Address = {London},
> 	Author = {Corey Ross},
> 	Title = {The East German Dictatorship. Problems and Perspectives  
> in the Interpretation of the GDR},
> 	Year = {2002}}
>
> So, the fields are pretty-formatted by BibDesk, they are preceeded  
> by a tab.
> This causes TM not to recognize the end of the entry.
>
> If the entry looks like this:
>
> @book{ros:02,
> Address = {London},
> Author = {Corey Ross},
> Title = {The East German Dictatorship. Problems and Perspectives in  
> the Interpretation of the GDR},
> Year = {2002}}
>
> or like this:
>
> @book{ros:02,
> 	Address = {London},
> 	Author = {Corey Ross},
> 	Title = {The East German Dictatorship. Problems and Perspectives  
> in the Interpretation of the GDR},
> 	Year = {2002}
> }
>
> everything works fine.
>
> Is it possible to change the code folding to work with the first  
> version?
> I suppose many BibTeX users on the Mac will have this problem,  
> since probably almost all of them work with BibDesk ...
>
> Thanks in advance,
> best regards
>
> Matthias
>
> -- 
> Matthias Damm
> mad at macpla.net
> PGP key: http://macpla.net/MatthiasDamm.asc
> PGP fingerprint: CED3 6074 7F7D 3148 C6F3  DFF2 05FF 3A0B 0D12 4D41
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

Haris





More information about the textmate mailing list