ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> komodo-discuss
komodo-discuss
Re: [Komodo-discuss] Filetype detection
by Trent Mick other posts by this author
Jul 11 2008 2:55PM messages near this date
view in the new Beta List Site
[Komodo-discuss] Filetype detection | Re: [Komodo-discuss] Filetype detection
R. Hicks wrote:
>  Can Komodo do detection with an emacs line or vim line? For example is 
>  some of my Vim files I have at the end:
>  
>  # vim: et sw=4 ts=4 nowrap
>  
>  Just wondering...

Adding to Rich's post (if Komode works for you, then great!).

Komodo currently will use an emacs "file variable" line or block to help 
with encoding detection, but that is currently it.

The "Replace in Files" system reads Emacs and Vi/Vim modelines to help 
with filetype detection, but that code hasn't yet been integrated with 
Komodo's document system. If you are curious, look for "textinfo.py" in 
your Komodo installation. From the command-line it acts kind of like the 
GNU file command:

----------------------------
$ cat vi-modeline-1
/* vim: ft=yaml */
$ python .../textinfo.py vi-modeline-1
vi-modeline-1: YAML, utf-8
----------------------------

Or as a module:

----------------------------
$ cat myfile
# vim: et sw=4 ts=4 nowrap

blah ...
$ python
 > >> import textinfo
 > >> t = textinfo.textinfo_from_path("myfile")
 > >> t
<TextInfo 'myfile'> 
 > >> t.vi_vars
{u'et': None, u'sw': 4, u'ts': 4, u'nowrap\r': None}
----------------------------


I hope in future Komodo versions to use this info to improve filetype 
detection, and possibly to allow using some of those other file vars -- 
e.g. the whitespace settings you have in your example.

Note the "\r" in the "nowrap" parse... obviously there is a little 
buglet in Komodo's code there.


Cheers,
Trent

-- 
Trent Mick
trentm at activestate.com
_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss
Thread:
R. Hicks
Trent Mick
Rich Kang

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved