Previously, a value for focus-mode-to-thing like:
'((prog-mode . defun)
(text-mode . sentence)
(org-mode . paragraph))
Wouldn't work, since org-mode is dervied from text-mode. Now
focus-get-thing checks if the current mode is explicitly in
focus-mode-to-thing before checking if it's a derived mode.
The source of the error was not keeping track of which buffer focus should
operate on.
Also ensured that all hooks are local, which might also effect #13.
In `focus-read-only-mode` the `cursor-type` was unconditionally set to `t`, and
did not restore the users customized cursor type. This is fixed by storing the
original value of `cursor-type` in `focus-cursor-type`.
Addresses #11. Focus mode will no longer make any variables
`permanent-local'. On major mode change `focus-terminate' is run so that
the overlays are removed.
The `post-command-hook` was made `permanent-local` in order to keep
focus mode enabled when changing major mode. Other modes relies on the
`post-command-hook` to be cleared on major mode change, causing
problems. This fix rather uses the `permanent-local-hook` to tag
functions that should not be removed from hooks.
This fixes abo-abo/swiper#755. It might fix bugs I have not been able to
reproduce, namely #10, #8 and a followup in #7.
The `focus-mode-to-thing` variable dictates what thing to use according
to the currently enabled mode. Changing this if you only wished to
change the thing for a single session seems tedious. Now this can be
achieved by `M-x focus-change-thing`.
One can customize what sort of bounds should be used for a mode, where
derived modes are used to generalize. By default text-mode and prog-mode
are defined.