I Downloaded b12 and was playing around when I noticed something that I thought had been 'fixed' earlier and appears to not be working now. I have not used TM for a little while so perhaps what I am trying to do has been slightly changed or I was imagining things:
Problem: Drag an image file from the drawer into the html file and have the tag, width and height added automaticlly. Ideally the behavior would also put in an alt and have the cursor default to that location as well as a closing / if it is xhtml.
Solutions ?
Thanks,
Eric Curtis
On Jun 16, 2005, at 21:26, Eric Curtis wrote:
Drag an image file from the drawer into the html file and have the tag, width and height added automaticlly. Ideally the behavior would also put in an alt and have the cursor default to that location as well as a closing / if it is xhtml.
Solutions ?
This should work granted that a) you have the HTML drag command for images, b) you drop the image file in something which has scope text.html, and c) the image dragged has one of these (case sensitive) extensions: png, PNG, jpeg, JPEG, jpg, JPG, gif, GIF.
Naturally everything about it is changable using the bundle editor (it's named drag commands, and you'll find the default one for images dropped in HTML in the HTML bundle).
And it does btw insert with correct size and the alt-argument selected with the filename as default value.
Ah I think I see the problem here. After you pointed to condition B I noticed that my html files are filename.htm, no 'l'
I changed the scope line to read:
text.html, text.htm
with no luck.
Is there a way to assign a wider scope and I might suggest that be default the html behaviors should work on both .html and .htm
Eric
This should work granted that a) you have the HTML drag command for images, b) you drop the image file in something which has scope text.html, and c) the image dragged has one of these (case sensitive) extensions: png, PNG, jpeg, JPEG, jpg, JPG, gif, GIF.
On Jun 17, 2005, at 2:22, Eric Curtis wrote:
Ah I think I see the problem here. After you pointed to condition B I noticed that my html files are filename.htm, no 'l'
I changed the scope line to read: text.html, text.htm
The scope is not the file extension. Try in your HTML file to press ctrl-shift-T and you'll see the scope of the caret (if you have the Language Definition bundle).
Is there a way to assign a wider scope and I might suggest that be default the html behaviors should work on both .html and .htm
It should -- does the language in the status bar say: HTML (Basic)?
Ok, learning a lot here. The status bar says XML and I have a feeling it is because of the beginning of the file. For some reason (a particular browser needs this I believe) my first lines of the .htm file are:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If this is a line that will need to stay is there a way to force the file to observe the extension?
Thanks,
Eric C
On Jun 16, 2005, at 5:29 PM, Allan Odgaard wrote:
On Jun 17, 2005, at 2:22, Eric Curtis wrote:
Ah I think I see the problem here. After you pointed to condition B I noticed that my html files are filename.htm, no 'l'
I changed the scope line to read: text.html, text.htm
The scope is not the file extension. Try in your HTML file to press ctrl-shift-T and you'll see the scope of the caret (if you have the Language Definition bundle).
Is there a way to assign a wider scope and I might suggest that be default the html behaviors should work on both .html and .htm
It should -- does the language in the status bar say: HTML (Basic)?
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
On Jun 17, 2005, at 7:03, Eric Curtis wrote:
Ok, learning a lot here. The status bar says XML
Ah, okay -- then that's why the dropped image isn't inserted. If you switch to HTML (using View -> Language -> HTML) it should work.
If this is a line that will need to stay is there a way to force the file to observe the extension?
Unfortunately for b12 the “first line match” takes precedence over (even a user specified) extension.
What you should/can do is enter the language editor (ctrl-option-cmd- L), open the XML bundle and select the XML language. Now remove this line: “firstLineMatch = "^\s*<\?xml";”. That way files starting with “<?xml…” won't be forced as XML (I'll remove this line in the default XML grammar for b13 as well, since too many files have the XML marker for which a more specific grammar actually exist).
Two interesting things I notice in regards to changing the view:
1. If I change the view and then go to another document tab and return the language resets to XML. I wonder if there is someway to maintain the changed setting esp when you are working in a project.
2. If the above could be implimented it would also be helpful to allow the user to have multiiple files selected in the Drawer and apply all the changes to the selected documents. For example in with my site I need to change 10 files from XML to HTML and have them maintain the settings.
Thank you for you attention.
Eric C
Ah, okay -- then that's why the dropped image isn't inserted. If you switch to HTML (using View -> Language -> HTML) it should work.
On Jun 17, 2005, at 18:43, Eric Curtis wrote:
- If I change the view and then go to another document tab and
return the language resets to XML. I wonder if there is someway to maintain the changed setting esp when you are working in a project.
It really should stick -- but language associations where sort of removed from 1.1b6+ and then partially re-implemented. There has been a few changes since 1.1b12, though I would have thought that 1.1b12 was sticky as for choice (language specific settings is another matter).
If you experience the same problem with 1.1b13, let me know.
And as for changing them, after removing the firstLineMatch from the XML language, it should correctly show them as HTML on each (new) load, right!?!
Actually no. I removed:
firstLineMatch = "^\s*<\?xml";
So the definition starts like this now:
{ scopeName = "text.xml"; fileTypes = ( "xml", "tld", "jsp", "xsl", "xslt", "pt", "cpt", "dtml" );
I next tried making a new project and pulling in all the files put it still defaulted to XML. I tried quitting and restarting TM thinking perhaps it was a cached setting but no luck.
Interesting no?
Eric
And as for changing them, after removing the firstLineMatch from the XML language, it should correctly show them as HTML on each (new) load, right!?!
On Jun 17, 2005, at 19:03, Eric Curtis wrote:
So the definition starts like this now:
{ scopeName = "text.xml"; fileTypes = ( "xml", "tld", "jsp", "xsl", "xslt", "pt", "cpt", "dtml" );
I next tried making a new project and pulling in all the files put it still defaulted to XML. I tried quitting and restarting TM thinking perhaps it was a cached setting but no luck.
So IOW when you open a .htm or .html file, it says Language: XML in the status bar?
Try (menu) TextMate -> Edit File Associations… to see if there's an entry for .htm -> XML.
If there is, then just open one .htm file, select View -> Language -> HTML, and from that point all .htm files should open as HTML. If they don't, then I don't know what's wrong.
Ok I am not sure when it started working but now the files are opening as html. One oddity that is happening now it that the first time a file is selected in a project a beep is occurring when the file is opening. no big deal though and I can drag image files in without a problem now.
Thank you,
Eric
On Jun 17, 2005, at 10:32 AM, Allan Odgaard wrote:
On Jun 17, 2005, at 19:03, Eric Curtis wrote:
So the definition starts like this now:
{ scopeName = "text.xml"; fileTypes = ( "xml", "tld", "jsp", "xsl", "xslt", "pt", "cpt", "dtml" );
I next tried making a new project and pulling in all the files put it still defaulted to XML. I tried quitting and restarting TM thinking perhaps it was a cached setting but no luck.
So IOW when you open a .htm or .html file, it says Language: XML in the status bar?
Try (menu) TextMate -> Edit File Associations… to see if there's an entry for .htm -> XML.
If there is, then just open one .htm file, select View -> Language -
HTML, and from that point all .htm files should open as HTML. If
they don't, then I don't know what's wrong.
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
On Jun 17, 2005, at 12:57 PM, Eric Curtis wrote:
Ok I am not sure when it started working but now the files are opening as html. One oddity that is happening now it that the first time a file is selected in a project a beep is occurring when the file is opening. no big deal though and I can drag image files in without a problem now.
Check your console log. My guess is the beep registered an error message there.
Haris
On 17/06/2005, at 7.03, Eric Curtis wrote:
Ok, learning a lot here. The status bar says XML and I have a feeling it is because of the beginning of the file. For some reason (a particular browser needs this I believe) my first lines of the .htm file are:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This is a normal header for XHTML files, since XHTML is an XML application. According to the specification, the first line can only be dropped if you use the default XML character encoding, viz. UTF-8.
Incidentally, I had to drop that line as well from some of my pages, since IE patches up some of its bugs in the presence of a DOCTYPE line with a STRICT type...but that only works if the DOCTYPE is the _first_ line of the file ;-).
-- Sune.