larstvei / Focus

Dim the font color of text in surrounding paragraphs
485 stars 16 forks source link

Python bug #7

Closed kootenpv closed 8 years ago

kootenpv commented 8 years ago

It does not highlight single lines in the highest level (most notably imports). In fact, it stays on a class defined a couple of lines down (when scrolling up from that class).

I hope there is a solution, since I really like the idea.

larstvei commented 8 years ago

Hi, thanks for raising this issue.

By default, all modes that are derived from prog-mode uses defun as the default thing to be in focus (defined in Thing At Point). It seems like this is a bad fit for python, as it only works with classes and functions.

Try adding this to your config:

(add-to-list 'focus-mode-to-thing '(python-mode . paragraph))

Does this produce a more satisfying result?

kootenpv commented 8 years ago

In terms of highlighting, yes it solves the problem! Thanks! It unfortunately introduces a new problem: my screen flickers, causing a very stuttering feeling when I change "block".

Here I have an idea what could be related: whenever I move my cursor I have "recenter-screen" called (so my cursor is always in the middle, except when at bottom or end of a file). Perhaps you're doing something similar.

Oh and in case it helps, I'm using Emacs 24.4.

larstvei commented 8 years ago

Sadly, I am not able to reproduce this error. I've tried using center-cursor-mode along with focus, and it seems to work fine.

This seems unrelated to the Python bug, so I'll close this issue (assuming that the customization I suggested was satisfactory). If you want me to further investigate the flickering-bug, please open a new issue, and provide some reproducible example.