Commits

Takafumi Arakaki  committed 1b16907

add rope-turn-on (off) command and use it for the python-mode-hook

The ropemacs-mode command defined by define-minor-mode toggles the
mode when it is called without argument. It can be a trouble if it is
called in python-mode-hook multiple times without argument. That's
why I am adding rope-turn-on command to replace the hook function.

  • Participants
  • Parent commits 6913282

Comments (0)

Files changed (1)

File ropemacs/__init__.py

     occurrences_goto()
 occurrences_next.interaction = ''
 
+def turn_on():
+    """Turn on ropemacs-mode."""
+    lisp.ropemacs_mode(True)
+turn_on.interaction = ''
+
+def turn_off():
+    """Turn off ropemacs-mode."""
+    lisp.ropemacs_mode(False)
+turn_off.interaction = ''
+
 
 DEFVARS = """\
 (defgroup ropemacs nil
         for key, command in shortcuts:
             LispUtils()._bind_local(command, key)
 
-    lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])
+    lisp.add_hook(lisp['python-mode-hook'], lisp['rope-turn-on'])
 
 def _started_from_pymacs():
     import inspect