[TxMt] Improving SymbolPopup for LaTeX?

Charilaos Skiadas cskiadas at uchicago.edu
Sat Dec 3 14:11:06 UTC 2005


On Dec 3, 2005, at 5:02 AM, Allan Odgaard wrote:

> On 3/12/2005, at 1:00, Charilaos Skiadas wrote:
>
>
>> 1) First of all, you need to create a new preferences item. WHY?  
>> I'd really like to know that.
>>
>
> You don't. I made the current one: text.latex meta.section.latex  
> and it works. But you have to make one edit to the document, before  
> the symbol list is rebuilt, so maybe that's what threw you off.
>
Ah, probably that was it. It works fine now with your latest commit.
>
>> 2) Second, any changes you make only take effect after you closed  
>> the bundle editor. Again, WHY? That's not the case for commands  
>> and snippets and stuff.
>>
>
> I hope it will change real-time in the future, but a preference  
> change affects a lot, so a lot of caches needs to be flushed,  
> things needs to be re-parsed, a.s.o. -- so currently this only  
> happens when you close the window.
>
> Commands, snippets, etc. are special in that when you execute one  
> of these, it “commits” the current changes in the bundle editor.  
> But things like preferences, language grammars etc. are in use all  
> the time, so you (currently) need to manually commit (by closing  
> the window, or for the latter, using the Test button).
>

Yeah, when I thought about it I figured that it would be too messy to  
have it work real-time, and it is fine as it is, but maybe a little  
comment on the page would be helpful (to the effect: "Note: This will  
only take effect if you...), exactly because the behavior is not  
consistent.
Well, the only thing I found irritating is the lack of a shortcut for  
the Languages editor and for the Preferences editor, or did I miss  
them? Having to close the bundle editor for effects to show is fine  
(though a save button as Tim says is even better), but having to  
press three buttons to get back where you were is not.
>
>> 3) This is the code I used now [...] two questions on that:
>> a) Why don't the spaces that $1 catches being shown? They are in  
>> the python thing.
>>
>
> Because meta.section match “\(sub)*section…” and not “(^\s*)?\(sub) 
> *section…”. I.e. the leading spaces are not included in the scope.
>
>
>> b) the \subsubsection rule gives me: \subsubsection{stuff} instead  
>> of just "stuff".
>>
>
> You rule had a (closing) ' before the last subst. This works for me:
>
>    symbolTransformation = '
>       s/^(\s*)\\section\{(.+)\}/$1 $2/;
>       s/^(\s*)\\subsection\{(.+)\}/$1\t $2/;
>       s/^(\s*)\\subsubsection\{(.+)\}/$1 \t \t $2/;
>    ';
>
ah, the dangers of using the small unpleasant window to edit, rather  
than a wonderful textmate window :-)
> Of course the “^(\s*)” part has no meaning unless the language  
> grammar gets changed.
>
Oh, we can just remove that, I was using it to try to use that as  
space, as the Python bundle does, or at least that's what I thought  
they do.
>
>> Other than that, it works well. The tabs inserted by \t get  
>> interpreted, even though spaces seem not to.
>>
>
> As for using \t, I use the em-space in the few transformation I've  
> made (e.g. Markdown headings), this looks a little better. Though  
> you'll have to copy/paste it, and with a fixed width font (bundle  
> editor), it looks just like a regular space -- I'll add support for  
> \x{nnnn} for these things.
>
Is that what is being used in the Python code? \x{nnnn} support would  
be great, as well as explanation of one or two of the choices for  
nnnn. For instance, I still have no idea what em-space is, guessing  
some unicode character.

But really, why doesn't plain old space work, both here and in ctags?  
It seems to be completely ignored if it's at the beginning.
Btw, can you make it so that it looks at the number of "sub" in front  
of section, and puts an equal amount of em-spaces? That would be divine.



Haris





More information about the textmate mailing list