paldepind / composable.el

Composable text editing for Emacs.
GNU General Public License v3.0
115 stars 9 forks source link

Hooks for use with god-mode #14

Closed greduan closed 8 years ago

greduan commented 8 years ago

In the god-mode readme you'll find the following example:

(defun god-toggle-on-overwrite ()
  "Toggle god-mode on overwrite-mode."
  (if (bound-and-true-p overwrite-mode)
      (god-local-mode-pause)
    (god-local-mode-resume)))

(add-hook 'overwrite-mode-hook 'god-toggle-on-overwrite)

What hooks does composable-mode provide in order to be able to pause god-mode? Otherwise in god-mode w} results in god-mode complaining C-} is not bound.

paldepind commented 8 years ago

Hello @greduan.

When you execute a composable command the mode composable-object-mode is activated. This mode contains the keybindings that let you specify objects. I.e. it is the mode that is activated when the cursor has the half-size. You can hook into this mode with composable-object-mode-hook. I.e. the below should solve your problem:

(add-hook 'composable-object-mode-hook 'god-toggle-on-overwrite)

I have tested it with god-mode and for me it solves the problem.

greduan commented 8 years ago

Awesome! Thanks! :)