1. Matt McClure
  2. ropemacs


Ali Gholami Rudi  committed cced183

Added rope-unload-hook for removing all registered hooks

  • Participants
  • Parent commits 408afe1
  • Branches trunk

Comments (0)

Files changed (2)

File docs/todo.txt

View file
  • Ignore whitespace
 * saving the old values of refacturing config
 * showing proposal type in code-assist
 * adding a menu
+* something like grep mode for find occurrences
+> Public Release 0.5c1

File ropemacs/__init__.py

View file
  • Ignore whitespace
             ('C-c g', lisp.rope_goto_definition),
             ('C-c C-d', lisp.rope_show_doc),
             ('C-c f', lisp.rope_find_occurrences)]
+        self.hooks = (
+            (lisp.before_save_hook, lisp.rope_before_save_actions),
+            (lisp.after_save_hook, lisp.rope_after_save_actions),
+            (lisp.kill_emacs_hook, lisp.rope_exiting_actions),
+            (lisp.python_mode_hook, lisp.rope_register_local_keys))
     def init(self):
         """Initialize rope mode"""
-        lisp.add_hook(lisp.before_save_hook, lisp.rope_before_save_actions)
-        lisp.add_hook(lisp.after_save_hook, lisp.rope_after_save_actions)
-        lisp.add_hook(lisp.kill_emacs_hook, lisp.rope_exiting_actions)
-        lisp.add_hook(lisp.python_mode_hook, lisp.rope_register_local_keys)
+        for hook, function in self.hooks:
+            lisp.add_hook(hook, function)
         prefix = lisp.ropemacs_global_prefix.value()
         if prefix is not None:
         if self.project is not None:
+    @lispfunction
+    def unload_hook(self):
+        """Unload registered hooks"""
+        for hook, function in self.hooks:
+            lisp.remove_hook(hook, function)
     def open_project(self):
         root = lisputils.ask_directory('Rope project root folder: ')
   :prefix 'rope-)
 (defcustom ropemacs-confirm-saving t
-  "Indicates whether to confirm saving modified buffers before refactorings
+  "Shows whether to confirm saving modified buffers before refactorings.
 If non-nil, you have to confirm saving all modified
 python files before refactorings; otherwise they are
 saved automatically.")
 (defcustom ropemacs-codeassist-maxfixes 1
-  "The number of errors to fix before code-assist
+  "The number of errors to fix before code-assist.
 How many errors to fix, at most, when proposing code completions.")
   'rope-code-assist-max-fixes 'ropemacs-codeassist-maxfixes)
 (defcustom ropemacs-local-prefix "C-c r"
-  "The prefix for ropemacs refactorings
+  "The prefix for ropemacs refactorings.
 Use nil to prevent binding keys.")
 (defcustom ropemacs-global-prefix "C-x p"
-  "The prefix for ropemacs project commands
+  "The prefix for ropemacs project commands.
 Use nil to prevent binding keys.")