HowTo recognize Python files with a different file extension?

12 views
Skip to first unread message

Erik Southworth

unread,
Jul 31, 2009, 5:57:46 PM7/31/09
to leo-e...@googlegroups.com
How do I make Leo recognize .recipe file extension as Python code files?

-Erik S

Erik Southworth

unread,
Aug 1, 2009, 5:38:45 AM8/1/09
to leo-e...@googlegroups.com
On Fri, Jul 31, 2009 at 5:57 PM, Erik Southworth <erik.so...@gmail.com> wrote:
How do I make Leo recognize .recipe file extension as Python code files?

-Erik S

My problem was lack of proper indentation in the resulting @thin node. My assumption was that Leo would manage the proper indentation based on the outline. I was wrong. I viewed it as lack of expression in the extension as Python=*.py;*.pyw;*.recipe;SConscript; I retract my question.

-Erik S

Edward K. Ream

unread,
Aug 1, 2009, 10:51:26 AM8/1/09
to leo-e...@googlegroups.com

True, but please note that the indentation of @other directives does matter.  For example::

    if 0:
        @others

Edward

Erik Southworth

unread,
Aug 1, 2009, 3:54:39 PM8/1/09
to leo-e...@googlegroups.com
Is it strict that an @auto node is only aware of certain file extensions? I would like if an @auto node was aware of the @language directive and made use of the correct parser without regard to extension.

Edward K. Ream

unread,
Aug 1, 2009, 4:42:08 PM8/1/09
to leo-e...@googlegroups.com
On Sat, Aug 1, 2009 at 2:54 PM, Erik Southworth <erik.so...@gmail.com> wrote:
Is it strict that an @auto node is only aware of certain file extensions? I would like if an @auto node was aware of the @language directive and made use of the correct parser without regard to extension.

An improvement should be possible.  If leo/modes/aLanguage.py exists, we would like @auto to insert @language aLanguage even if @auto doesn't know how to actually do more than import the file into a single node.  We can do this relatively easily by creating an auxiliary file extension dict with one entry for all languages (files) in leo/modes that @auto does not know how to import.

I'll put it on the to-do list.

Edward
Reply all
Reply to author
Forward
0 new messages