Hi all,
I noticed that the Cocoa autocomplete word (ESC in Tiger) works in TextMate. Using ~/Library/KeyBindings/DefaultKeyBinding.dict I have set ^/ to also do autocomplete in Cocoa apps. I've been using this keybinding for a long time now, but I'm new to TextMate (bought license today).
Unfortunately, this user set binding does not work in TextMate although it does work in other Cocoa apps such as TextEdit. Does anyone know why this might be the case and any hints to fix it?
Optimally I'd like to set "Apple /" to autocomplete, but for some reason Cocoa doesn't allow this.
cheers, Sam
Sam Halliday wrote:
I noticed that the Cocoa autocomplete word (ESC in Tiger) works in TextMate. Using ~/Library/KeyBindings/DefaultKeyBinding.dict I have set ^/ to also do autocomplete in Cocoa apps. I've been using this keybinding for a long time now, but I'm new to TextMate (bought license today).
Unfortunately, this user set binding does not work in TextMate although it does work in other Cocoa apps such as TextEdit. Does anyone know why this might be the case and any hints to fix it?
The relevant selectors that TextMate uses are `nextCompletion` and `previousCompletion`, so you'll need to make a textmate-specific bindings file, and put it in `~/Library/Application Support/Textmate/KeyBindings.dict`
Hello,
On 10 Jan 2007, at 02:25, Jacob Rus wrote:
Sam Halliday wrote:
I noticed that the Cocoa autocomplete word (ESC in Tiger) works in TextMate. Using ~/Library/KeyBindings/DefaultKeyBinding.dict I have set ^/ to also do autocomplete in Cocoa apps. I've been using this keybinding for a long time now, but I'm new to TextMate (bought license today). Unfortunately, this user set binding does not work in TextMate although it does work in other Cocoa apps such as TextEdit. Does anyone know why this might be the case and any hints to fix it?
The relevant selectors that TextMate uses are `nextCompletion` and `previousCompletion`, so you'll need to make a textmate-specific bindings file, and put it in `~/Library/Application Support/ Textmate/KeyBindings.dict`
I have done this and restarted TextMate, but the binding is not doing anything and now ESC doesn't autocomplete! Attached is my Keybindings.dict. If somebody could have look at this at let me know what is going on, that would be appreciated.
Question: does TextMate use this instead of the one in its Resources folder, or does it merge them?
Is there a list of all the symbols available in TextMate? Specifically I'd like to bind ctrl-up/ctrl-down to navigate up/down a paragraph and apple-(< or >) to navigate to beginning/end of file.
cheers, Sam
Sam Halliday wrote:
I have done this and restarted TextMate, but the binding is not doing anything and now ESC doesn't autocomplete! Attached is my Keybindings.dict. If somebody could have look at this at let me know what is going on, that would be appreciated.
With such a short KeyBindings.dict, you could have just inlined it:
{"^/" = "nextCompletion:"; }
Anyway, that should work fine, so that it doesn't implies that something is indeed up; I thought it would first source the file inside the app bundle, and then overwrite those bindings with anything found in ~/Library, but it might just ignore the file in the app bundle whenever one exists in ~/Library
To but to be sure, you could just duplicate the file in the resources folder and then modify it as desired. That's what I do, and I don't have any problems with it
Is there a list of all the symbols available in TextMate? Specifically I'd like to bind ctrl-up/ctrl-down to navigate up/down a paragraph and apple-(< or >) to navigate to beginning/end of file.
You can't use the ⌘ key inside any key bindings that don't involve the arrow keys and maybe a couple other things. But you can definitely make a TextMate macro which does this. So it's not going to work in other apps, but in TextMate it should be fine. And for moving up/down a paragraph, you'll have to clarify what you mean. Is a line a paragraph, or a group of lines with content separated by double newlines? If the latter, you could do something like a macro for a forwards regular expression search for two blank lines and then move backwards, or similar.
-Jacob
Hello,
On 10 Jan 2007, at 19:31, Jacob Rus wrote:
that should work fine, so that it doesn't implies that something is indeed up
I just realised that my ^/ binding is working, but it's not doing what I thought it was... it seems that TextMate autocomplete words based on what it has already seen in the file: not the same as Cocoa complete! Cocoa complete uses the dictionary (including the user's language and amendments) to find completion. How can I get the Cocoa autocompleter instead?
for moving up/down a paragraph, you'll have to clarify what you mean.
Jumping to the previous/next pair of double newlines would be sufficient. I'll try that out cheers.
Is there a list somewhere of all the TextMate symbols that can be used in the KeyBindings.dict file? Or have they all been assigned already.
Sam Halliday wrote:
Hello,
On 10 Jan 2007, at 19:31, Jacob Rus wrote:
that should work fine, so that it doesn't implies that something is indeed up
I just realised that my ^/ binding is working, but it's not doing what I thought it was... it seems that TextMate autocomplete words based on what it has already seen in the file: not the same as Cocoa complete! Cocoa complete uses the dictionary (including the user's language and
Yes, that's right
amendments) to find completion. How can I get the Cocoa autocompleter instead?
You can't, really, without doing some work. But Thomas Aylott made something that completes English words.
Is there a list somewhere of all the TextMate symbols that can be used in the KeyBindings.dict file? Or have they all been assigned already.
Look at the file inside the textmate application. Any selectors used there are fair game. Other than that, most of the selectors that work in other Cocoa apps will also work in TextMate, with a few exceptions (didn't I send a link to my giant list in the last email?)
Hello,
On 11 Jan 2007, at 02:27, Jacob Rus wrote:
Sam Halliday wrote:
How can I get the Cocoa autocompleter instead?
You can't, really, without doing some work. But Thomas Aylott made something that completes English words.
I seen this and wasn't that impressed as it only has system words, not the Cocoa dictionary (i.e. one static language and no user words).
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
Is there a list somewhere of all the TextMate symbols that can be used in the KeyBindings.dict file?
(didn't I send a link to my giant list in the last email?)
Not since I've joined. It'd be better if there was a page somewhere with sort of this info on it.
Incidentally, I created a macro that uses the find/replace to go to the next \n\n, which works, but highlights both lines! Also, I didn't know how to reverse this and make it search backwards... any hints on that? Would a snippet perhaps be more appropriate?
Where is the best place to start learning snippets?
Hi,
I seen this and wasn't that impressed as it only has system words, not the Cocoa dictionary (i.e. one static language and no user words).
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
As far as I know, TextMate uses a custom text view and doesn't use the one provided by Cocoa.
Nico
Sam Halliday wrote:
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
It can't use them all. Each one had to be re-implemented by Allan.
Is there a list somewhere of all the TextMate symbols that can be used in the KeyBindings.dict file?
(didn't I send a link to my giant list in the last email?)
Not since I've joined. It'd be better if there was a page somewhere with sort of this info on it.
Like two emails ago, in this thread, in response to your email...
Here it is again though: http://www.hcs.harvard.edu/~jrus/site/selectors.html
Incidentally, I created a macro that uses the find/replace to go to the next \n\n, which works, but highlights both lines!
Yes, that is overly simplistic. You can add a right/left arrow to the end of your macro (depending on how you want it to work). But you probably also want a more complex regexp than just `\n\n`, which is overly specific, and won't match lines that include spaces.
Also, I didn't know
how to reverse this and make it search backwards... any hints on that?
Yes, do a search backwards. :)
Would a snippet perhaps be more appropriate?
Um... what? A snippet has nothing to do with matching patterns...
Where is the best place to start learning snippets?
What do you mean? A pretty good place is sitting in front of your computer, with TextMate open, looking at the bundles menu or the bundle editor.
But really the best place is in the Moscone Center, San Francisco, sometime in the next two days, where Soryu, Infin, and myself will be happy to show off any and all snippets.
-Jacob
Hi,
On 11 Jan 2007, at 10:50, Jacob Rus wrote:
Like two emails ago, in this thread, in response to your email...
Here it is again though: http://www.hcs.harvard.edu/~jrus/site/ selectors.html
Thanks... I think the mailing list stripped the attachment.
Also, I didn't know
how to reverse this and make it search backwards... any hints on that?
Yes, do a search backwards. :)
Well, I would have... but apple-f doesn't have that option. Is there a more advanced search menu hidden away?
Would a snippet perhaps be more appropriate?
Um... what? A snippet has nothing to do with matching patterns...
Heh... sorry, I thought snippets were like macros... I've now read the manual and understand what they are.
On 11 Jan 2007, at 11:04, Sam Halliday wrote:
how to reverse this and make it search backwards... any hints on that?
Yes, do a search backwards. :)
Well, I would have... but apple-f doesn't have that option. Is there a more advanced search menu hidden away?
/me spots "search backward" and hits head against wall
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 11 Jan 2007, at 09:36, Sam Halliday wrote:
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
Autocomplete isn't part of Cocoa - it's part of XCode.
- -- Andy Armstrong, hexten.net
Hi,
On 11 Jan 2007, at 10:55, Andy Armstrong wrote:
On 11 Jan 2007, at 09:36, Sam Halliday wrote:
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
Autocomplete isn't part of Cocoa - it's part of XCode.
If it's part of XCode, then how come all Cocoa apps (including TextEdit and Mail.. try it yourself) can use it?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 11 Jan 2007, at 11:02, Sam Halliday wrote:
Autocomplete isn't part of Cocoa - it's part of XCode.
If it's part of XCode, then how come all Cocoa apps (including TextEdit and Mail.. try it yourself) can use it?
They don't autocomplete Objective C though do they? Maybe we're talking at cross purposes here.
- -- Andy Armstrong, hexten.net
On 11 Jan 2007, at 09:36, Sam Halliday wrote:
Isn't TextMate built in Cocoa... how come it can use all the other Cocoa methods except complete??
Autocomplete isn't part of Cocoa - it's part of XCode.
He wasn't talking about code autocompletion but about word autocompletion (what you get when you write 'app' in TextEdit and hit escape for example).
Nico
Hi,
On 11 Jan 2007, at 09:36, Sam Halliday wrote:
Incidentally, I created a macro that uses the find/replace to go to the next \n\n, which works, but highlights both lines!
For anyone who wants to implement something similar (move forwards back paragraph, Emacs style)... I was actually able to do this in Cocoa by binding keys to action combos like
moveUp: moveToBeginningOfParagraph: moveUp:
and
moveDown: moveToEndOfParagraph: moveDown:
Dear all,
I don't know whether I can follow the entire discussion but here comes my opinion.
First of all I find it quite useful that TM has its own completion based on terms occurring in the current document. Actually TM was written as an editor to write source code. By writing the name of a variable only once I can use the key 'ESC' to complete the name if I have to write it again instead of having all English words beginning with that I typed.
Nevertheless everybody knows TM is useful for thousand of things. Also for writing prose. To use a completion for all English words, for instance, you can write such a command very easily by yourself.
Here a fast written first approach in Ruby:
#!/usr/bin/ruby require File.join(ENV['TM_SUPPORT_PATH'], "lib/exit_codes.rb") require File.join(ENV['TM_SUPPORT_PATH'], "lib/dialog.rb") require File.join(ENV['TM_SUPPORT_PATH'], 'lib/current_word.rb')
word = Word.current_word(/\w./)
wrds = `cat /usr/share/dict/web2 | grep ^#{word}`
words = wrds.split("\n") if words.size == 1 out = words.first else idx = Dialog.menu words TextMate.exit_discard if idx.nil? out = words[idx] end
TextMate.exit_discard if words.empty?
print out[word.length..-1] print " "
What I'm doing here is use the dict file of Webster's dictionary which should come out of each Mac OSX release. This file is located in /usr/share/dict/web2.
Then I use the system command:
cat /usr/share/dict/web2 | grep ^myword
The output is a list separated by a '\n' of all words beginning with 'myword'. I put this list into a dialog and then you can select that one which you want to insert.
This script can be modified easily to use an other dictionary of course.
If you want to use a non-English dictionary then you have to manage the right encoding in beforehand, but this can be discussed later.
Attached is an example command 'AutoComplete' using this script. I bound this command to the key APPLE+ESC, but you can change it.
Maybe it helps. (and with this solution Allan hasn't to change TM's source code)
Best
-Hans
Hi Hans-Joerg,
I see what your script is doing there and it would be sensible but for the fact that I would require British (not American) English plus my own personal additions to the dictionary.
I could get around the British restraint by using a British file from somewhere (possibly aspell), and my personal additions as located in "Library/Spelling/en_GB" (but uses some odd characters and terminators, so regex definitely needed there).
Perhaps you might want to generalise your script to include the user additions?
If there is no other way around this, I may just have to do that.
Thanks, Sam
On 11 Jan 2007, at 12:23, Hans-Joerg Bibiko wrote:
Dear all,
I don't know whether I can follow the entire discussion but here comes my opinion.
First of all I find it quite useful that TM has its own completion based on terms occurring in the current document. Actually TM was written as an editor to write source code. By writing the name of a variable only once I can use the key 'ESC' to complete the name if I have to write it again instead of having all English words beginning with that I typed.
Nevertheless everybody knows TM is useful for thousand of things. Also for writing prose. To use a completion for all English words, for instance, you can write such a command very easily by yourself.
Here a fast written first approach in Ruby:
#!/usr/bin/ruby require File.join(ENV['TM_SUPPORT_PATH'], "lib/exit_codes.rb") require File.join(ENV['TM_SUPPORT_PATH'], "lib/dialog.rb") require File.join(ENV['TM_SUPPORT_PATH'], 'lib/current_word.rb')
word = Word.current_word(/\w./)
wrds = `cat /usr/share/dict/web2 | grep ^#{word}`
words = wrds.split("\n") if words.size == 1 out = words.first else idx = Dialog.menu words TextMate.exit_discard if idx.nil? out = words[idx] end
TextMate.exit_discard if words.empty?
print out[word.length..-1] print " "
What I'm doing here is use the dict file of Webster's dictionary which should come out of each Mac OSX release. This file is located in /usr/share/dict/web2.
Then I use the system command:
cat /usr/share/dict/web2 | grep ^myword
The output is a list separated by a '\n' of all words beginning with 'myword'. I put this list into a dialog and then you can select that one which you want to insert.
This script can be modified easily to use an other dictionary of course.
If you want to use a non-English dictionary then you have to manage the right encoding in beforehand, but this can be discussed later.
Attached is an example command 'AutoComplete' using this script. I bound this command to the key APPLE+ESC, but you can change it.
Maybe it helps. (and with this solution Allan hasn't to change TM's source code)
Best
-Hans
<AutoComplete.tmCommand>
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hi Sam,
On 11 Jan 2007, at 13:31, Sam Halliday wrote:
I see what your script is doing there and it would be sensible but for the fact that I would require British (not American) English plus my own personal additions to the dictionary.
I could get around the British restraint by using a British file from somewhere (possibly aspell), and my personal additions as located in "Library/Spelling/en_GB" (but uses some odd characters and terminators, so regex definitely needed there).
OK. I can see the problem with the bunch of English varieties.
Perhaps you might want to generalise your script to include the user additions?
What do you mean with to 'generalise'?
The 'only' thing to do is to create your own dict file. The dict file is nothing else than a list of words, one word one line.
If you need a British English wordlist you can download such, e.g., via http://packages.debian.org/unstable/text/ (here one can find also other languages), look for 'wbritish-huge', download it, use the Terminal command 'dpkg-deb -x' to extract the package. After that you have a British wordlist of roughly 57000 words. Add your own additions to that file and replace '/usr/share/dict/webs2' with the location of your own file in the Ruby script. Furthermore you can merge this Debian British wordlist with Debian's wamerican-huge list and with the ca. 250000 Webster words, remove the duplicates, and at the end you have a British/American/Webster wordlist of ca. 280.000 words.
That means in other words, my approach is based only on a wordlist written as a plain text file!
Cheers,
Hans
Hi,
On 11 Jan 2007, at 13:28, Hans-Joerg Bibiko wrote:
The 'only' thing to do is to create your own dict file.
But then also merge this "master" dictionary with the user file. One of the main reasons for me switching to TextMate over Emacs was to get the Cocoa spell checker. I'm not overly keen on using another word source.
By "generalising your code" I meant that you could parse the user's additions and run grep on them, adding any hits to the list. It should be a 2 or 3 liner.
The major drawbacks of your technique are:-
- Static language (not dependent on keyboard layout) - Uses different sources than the system dictionary for non-US - No ranking algorithm for giving the best completion
If, however, there was a way to interface with the Cocoa "complete:", then it would solve these problems. Perhaps there may be a way of doing this using an AppleScript.
On a vaguely related note: how does TextMate handle code completion? In Eclipse if I type the auto-complete on a String objcet, it will give me a completion list of all the methods/constants available to me. Does TextMate have anything similar for C/PHP/other?
On Jan 11, 2007, at 05:43, Sam Halliday wrote:
But then also merge this "master" dictionary with the user file. One of the main reasons for me switching to TextMate over Emacs was to get the Cocoa spell checker. I'm not overly keen on using another word source.
[...]
If, however, there was a way to interface with the Cocoa "complete:", then it would solve these problems. Perhaps there may be a way of doing this using an AppleScript.
I think you could write a Foundation command-line tool that calls [[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTag :] and provides its results via tm_dialog. I did a similar thing in writing a tool that asks BibDesk for citation completions, and it works pretty well.
-- Adam
Hello,
On 11 Jan 2007, at 15:02, Adam R. Maxwell wrote:
I think you could write a Foundation command-line tool that calls [[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTa g:] and provides its results via tm_dialog. I did a similar thing in writing a tool that asks BibDesk for citation completions, and it works pretty well.
That sounds like the best way to hack it! It would also be a way of getting at the preferred spelling correction for misspelt words. Foundation is the Objective C framework, right? Do you have any examples of programs doing something similar?
On Jan 11, 2007, at 07:12, Sam Halliday wrote:
On 11 Jan 2007, at 15:02, Adam R. Maxwell wrote:
I think you could write a Foundation command-line tool that calls [[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTag :] and provides its results via tm_dialog. I did a similar thing in writing a tool that asks BibDesk for citation completions, and it works pretty well.
That sounds like the best way to hack it! It would also be a way of getting at the preferred spelling correction for misspelt words. Foundation is the Objective C framework, right? Do you have any examples of programs doing something similar?
Yeah, this gives access to what TextEdit et al. use for completion in NSTextView. Create a new Foundation tool in Xcode and fill in the blanks :). The source for my program is at http://homepage.mac.com/amaxwell as BibDeskTMCompletions.zip; just look at the part where it returns data via stdout. I think the .tmcommand is in the Completion.zip file at the same address. If not, e-mail me off-list.
-- Adam
Hi,
If, however, there was a way to interface with the Cocoa "complete:", then it would solve these problems. Perhaps there may be a way of doing this using an AppleScript.
I think you could write a Foundation command-line tool that calls [[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTa g:] and provides its results via tm_dialog. I did a similar thing in writing a tool that asks BibDesk for citation completions, and it works pretty well.
Well, that's a good idea, but I have a small problem with that.
The function
[[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTag: ]
needs a inSpellDocumentWithTag and a language.
But, there is a problem. I invoke this command by writing a tmCommand which calls BASH. The used NSSpellChecker has no info about TM's spelling language and there's also no unique inSpellDocumentWithTag. In other words you loose the nice feature of having a ranked output and you have to set the language by yourself.
I don't know whether I'm right, but I believe that NSSpellChecker can only invoke inside of TM or, maybe, by putting it into a tmPlugin to get this nice feature.
Here is my humble test script 'a.m':
#import <AppKit/AppKit.h>
int main(int argc, char* argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
NSString *wd = [NSString stringWithUTF8String:argv[1]]; NSRange rg = {0, [wd length]};
NSSpellChecker* checker = [NSSpellChecker sharedSpellChecker]; NSArray* list;
NSFileHandle *fh = [NSFileHandle fileHandleWithStandardOutput]; NSString *lg = @"en_GB"; if (argc > 2) { lg = [NSString stringWithUTF8String:argv[2]]; }
list = [checker completionsForPartialWordRange:rg inString:wd language:lg inSpellDocumentWithTag:0]; int cind; for(cind=0; cind<[list count]; cind++){ [fh writeData:[(NSData*)[list objectAtIndex:cind] dataUsingEncoding:NSUTF8StringEncoding]]; [fh writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]]; } [pool release]; }
_____
to compile it write: gcc a.m -framework AppKit
to run it:
a.out "beef"
or
a.out "app" "en_US"
or
a.out "Wanderu" "de"
You can replace this command within the Ruby script. Hint: This code (Ruby) is not utf-8 save!
Any comments? Did I something wrong?
Best
Hans
On Thursday, January 11, 2007, at 03:08PM, "Hans-Jörg Bibiko" bibiko@eva.mpg.de wrote:
If, however, there was a way to interface with the Cocoa "complete:", then it would solve these problems. Perhaps there may be a way of doing this using an AppleScript.
I think you could write a Foundation command-line tool that calls [[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTa g:] and provides its results via tm_dialog. I did a similar thing in writing a tool that asks BibDesk for citation completions, and it works pretty well.
Well, that's a good idea, but I have a small problem with that.
The function
[[NSSpellChecker sharedSpellChecker] completionsForPartialWordRange:inString:language:inSpellDocumentWithTag: ]
needs a inSpellDocumentWithTag and a language.
But, there is a problem. I invoke this command by writing a tmCommand which calls BASH. The used NSSpellChecker has no info about TM's spelling language and there's also no unique inSpellDocumentWithTag. In other words you loose the nice feature of having a ranked output and you have to set the language by yourself.
Not sure what you mean by "ranked output", but yes, you would have to pass the appropriate language setting as an argument. For the tag, I think you should use [NSSpellChecker uniqueSpellDocumentTag] instead of passing 0, but it may not matter; it's not clear to me if you should use closeSpellDocumentWithTag: when done.
I don't know whether I'm right, but I believe that NSSpellChecker can only invoke inside of TM or, maybe, by putting it into a tmPlugin to get this nice feature.
Sure, there are numerous features of the spelling system that won't be integrated correctly unless it's in the application, and maybe a tmPlugin would solve that. I was just suggesting a possible way for someone to get dictionary completions.
Here is my humble test script 'a.m':
#import <AppKit/AppKit.h>
[...]
Interesting...did you need [NSApplication sharedApplication]?
You can replace this command within the Ruby script. Hint: This code (Ruby) is not utf-8 save!
If you're referring to my example, I borrowed the Ruby script from elsewhere in TextMate. What part of it isn't UTF-8 safe?
-- Adam
Hi,
But, there is a problem. I invoke this command by writing a tmCommand which calls BASH. The used NSSpellChecker has no info about TM's spelling language and there's also no unique inSpellDocumentWithTag. In other words you loose the nice feature of having a ranked output and you have to set the language by yourself.
Not sure what you mean by "ranked output", but yes, you would have to pass the appropriate language setting as an argument. For the tag, I think you should use [NSSpellChecker uniqueSpellDocumentTag] instead of passing 0, but it may not matter; it's not clear to me if you should use closeSpellDocumentWithTag: when done.
By 'ranked output' I meant the following: If I type, for instance, 'beef' and call the autocompete function. It will list: beef beef's beefcake beefcake's ....
Then I choose 'beefsteak'. After writing further stuff I type 'beef' again and call autocomplete. Now it will list: beefsteak beef beef's beefcake ...
'beefsteak' will listed at the top because NSSpellChecker remembers my last choice. And this is done via an unique inSpellDocumentWithTag.
If I write in 'a.m':
int utag = [NSSpellChecker uniqueSpellDocumentTag]
it causes an error because the program is started outside of a cocoa application; and there is no SpellDocument referring to. Furthermore if the a.out is executed the NSSpellChecker is also closed, so there is no way to memorise my choices. (?)
I have no idea to pass the tag and language info from TM to a.out!
The same for language: If I type language:nil NSSpellChecker takes the language which is set in the document. But there is no document for a.out.
I don't know whether I'm right, but I believe that NSSpellChecker can only invoke inside of TM or, maybe, by putting it into a tmPlugin to get this nice feature.
Sure, there are numerous features of the spelling system that won't be integrated correctly unless it's in the application, and maybe a tmPlugin would solve that. I was just suggesting a possible way for someone to get dictionary completions.
Here is my humble test script 'a.m':
#import <AppKit/AppKit.h>
[...]
Interesting...did you need [NSApplication sharedApplication]?
Well, I don't know. If I leave it out the program doesn't run.
You can replace this command within the Ruby script. Hint: This code (Ruby) is not utf-8 save!
If you're referring to my example, I borrowed the Ruby script from elsewhere in TextMate. What part of it isn't UTF-8 safe?
I tried it out with language "de". I wrote 'Vermö' but nothing returns because the Ruby line:
word = Word.current_word(/\w./)
interprets the 'ö' as word boundary. If I type 'Vermög' it lists all words beginning with 'g'.
If I use TM directly and type
/PATH/TO/a.out "Vermö" "de"
it works perfectly.
To solve this problem you have to write within the Ruby script instead of
word = Word.current_word(/\w./)
word = `cat`
and set the input behaviour of the command to 'Selection' or 'Word'
###########
I don't know but it seems to me that the easiest way to use this functionality is to wait for Allan. I guess to implement this in TM directly is the cleanest way (?)
Cheers,
Hans
New in TeXMLMate 1.4: XPath 2.0 Visualization.
http://www.ditchnet.org/texmlmate/
In the new ‘XPath’ tab, execute XPath 2.0 expressions against your front most TextMate document and view the matched nodes. XPath support added via NSXML.
Todd Ditchendorf
Scandalous Software - Cocoa Developer Tools http://scan.dalo.us
Todd Ditchendorf wrote:
New in TeXMLMate 1.4: XPath 2.0 Visualization.
http://www.ditchnet.org/texmlmate/
In the new ‘XPath’ tab, execute XPath 2.0 expressions against your front most TextMate document and view the matched nodes. XPath support added via NSXML.
This stuff is pretty slick. Incidentally, send new emails to the list instead of replying to existing threads, so that mail clients don't get confused. ;)
On 1/10/07, Todd Ditchendorf itod@mac.com wrote:
New in TeXMLMate 1.4: XPath 2.0 Visualization.
http://www.ditchnet.org/texmlmate/
In the new 'XPath' tab, execute XPath 2.0 expressions against your front most TextMate document and view the matched nodes. XPath support added via NSXML.
Todd Ditchendorf
This is an awesome plugin!
You're making some of my vi using co-workers jealous :)
-Chris