On Tue, 14 Apr 2015 03:45:35 -0700 (PDT) "Edward K. Ream" <[email protected]> wrote:
> On Mon, Apr 13, 2015 at 2:06 PM, 'Terry Brown' via leo-editor < > [email protected]> wrote: > > is there a fast way to know if you're in "source code", presumably > > from the @language definition. > > > > Yes. The new g.getLanguageAtPosition(c,p). It should be fast > enough: Ok - that's great - that just leaves the question - for which languages do you want to be warned about excessive columns :-) For rst it's kind of personal preference, although I'd think best practice would be to control wrapping within 80 columns. I guess there needs to be a config setting listing languages for which the warning should apply. Cheers -Terry > def getLanguageAtPosition(c,p): > ''' > Return the language in effect at position p. > This is always a lowercase language name, never None. > ''' > aList = g.get_directives_dict_list(p) > d = g.scanAtCommentAndAtLanguageDirectives(aList) > language = d and d.get('language') > if not d: > language = g.getLanguageFromAncestorAtFileNode(p) > if not language: > language = c.config.getString('target_language') or 'python' > return language.lower() > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
