def guess_tab(text):
    count = 0
for line in text.split('\n'):
    indents = line[:len(line) - len(line.lstrip())]
if '\t' in indents:
    count += 1
if count > 5:
    return True
else:
    return False

def buffer_active(arg):
    editor.setBackSpaceUnIndents(True)
use_tab = guess_tab(editor.getText())
editor.setUseTabs(use_tab)
sys.stderr.write('setUseTabs %s\n' % use_tab)
notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED])
notepad.callback(buffer_active, [NOTIFICATION.BUFFERACTIVATED])
Notepad++ Автоматическое обнаружение табуляции или пробелов Python