Ben Finney wrote: > Veek M <vek.m1...@gmail.com> writes: > >> 1. I had to turn on <TAB> highlighting to catch mixed indent (which >> is a good thing anyways so this was resolved - not sure how tabs got >> in anyhow) > > The EditorConfig system is a growing consensus for configuring a code > base to instruct text editors not to mangle it. See the EditorConfig > site <URL:http://editorconfig.org/> for more information. > > Sadly, it seems Kate does not yet recognise EditorConfig instructions > <URL:https://bugs.kde.org/show_bug.cgi?id=330843>. In the meantime, > manually configure Kate to only ever insert spaces to indent lines. > >> 2. Blank lines in my code within the editor are perfectly acceptable >> for readability but they act as a block termination on cmd line. > > Yes. That is a deliberate compromise to make it easy to write code > interactively at the interactive prompt. > >> I get: >> IndentationError: unexpected indent >> >> How do i deal with this - what's the best way to achieve what I'm >> trying to do. > > Since you are writing code into a module file, why not just run the > module from that file with the non-interactive Python interpreter? > It's part of a hexchat plugin/addon.. like below (basically lots of hexchat crud interspersed.
Anyway, i should hive it off into a separate function, and hide the import hexchat - still, bit of a pain. import hexchat def send_message(word, word_eol, userdata): if not(word[0] == "65293"): return msg = hexchat.get_info('inputbox') if msg is None: return x = re.match(r'(^\\help)\s+(\w+)', msg) if x: filter = x.groups()[1] for key, value in unicode_tex.tex_to_unicode_map.items(): if filter in key: print_help(value + ' ' + key) hexchat.command("settext %s" % '') return # findall returns: [(,), (,), ...] or [] tex_matches = re.findall(r'((\\\w+){(.+?)})|(\\\w+)', msg) if len(tex_matches) == 0: return -- https://mail.python.org/mailman/listinfo/python-list