Пример #1
0
 def _init_ropemacs(self):
     global_prefix = lisp.ropemacs_global_prefix.value()
     local_prefix = lisp.ropemacs_local_prefix.value()
     enable_shortcuts = lisp['ropemacs-enable-shortcuts'].value()
     for attrname in dir(self):
         attr = getattr(self, attrname)
         if not callable(attr):
             continue
         kind = getattr(attr, 'kind', None)
         name = decorators._lisp_name(attr)
         if kind == 'local':
             local_key = getattr(attr, 'local_key', None)
             shortcut_key = getattr(attr, 'shortcut_key', None)
             if local_prefix is not None and local_key:
                 self._bind_local_key(attr.lisp_name,
                                      local_prefix + ' ' + local_key)
             if enable_shortcuts and shortcut_key:
                 self._bind_local_key(attr.lisp_name, shortcut_key)
         if kind == 'global':
             global_key = getattr(attr, 'global_key', None)
             if global_key:
                 key = self._key_sequence(global_prefix + ' ' + global_key)
                 lisp.global_set_key(key, lisp[attr.lisp_name])
         if kind == 'hook':
             hook = getattr(attr, 'hook', None)
             lisp.add_hook(lisp[hook], lisp[attr.lisp_name])
     lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])
Пример #2
0
 def add_hook(self, name, callback, hook):
     mapping = {
         'before_save': 'before-save-hook',
         'after_save': 'after-save-hook',
         'exit': 'kill-emacs-hook'
     }
     globals()[name] = callback
     lisp.add_hook(lisp[mapping[hook]], lisp[_lisp_name(name)])
Пример #3
0
def _load_ropemacs():
    global _interface
    ropemode.decorators.logger.message = message
    lisp(DEFVARS)
    _interface = ropemode.interface.RopeMode(env=LispUtils())
    _interface.init()
    lisp(MINOR_MODE)

    if LispUtils().get('enable_shortcuts'):
        for key, command in shortcuts:
            LispUtils()._bind_local(command, key)

    lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])
Пример #4
0
def _load_ropemacs():
    global _interface
    ropemode.decorators.logger.message = message
    lisp(DEFVARS)
    _interface = ropemode.interface.RopeMode(env=LispUtils())
    _interface.init()
    lisp(MINOR_MODE)

    if LispUtils().get('enable_shortcuts'):
        for key, command in shortcuts:
            LispUtils()._bind_local(command, key)

    lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])
Пример #5
0
 def add_hook(self, name, callback, hook):
     mapping = {'before_save': 'before-save-hook',
                'after_save': 'after-save-hook',
                'exit': 'kill-emacs-hook'}
     globals()[name] = callback
     lisp.add_hook(lisp[mapping[hook]], lisp[_lisp_name(name)])
Пример #6
0
  "Try to guess the project when needed.

If non-nil, ropemacs tries to guess and open the project that contains
a file on which the rope command is performed when no project is
already opened.")

(provide 'ropemacs)
"""

MINOR_MODE = """\
(define-minor-mode ropemacs-mode
 "ropemacs, rope in emacs!" nil " Rope" ropemacs-local-keymap
  :global nil)
)
"""

shortcuts = [('M-/', 'rope-code-assist'), ('M-?', 'rope-lucky-assist'),
             ('C-c g', 'rope-goto-definition'), ('C-c d', 'rope-show-doc'),
             ('C-c f', 'rope-find-occurrences')]

ropemode.decorators.logger.message = message
lisp(DEFVARS)
_interface = ropemode.interface.RopeMode(env=LispUtils())
_interface.init()
lisp(MINOR_MODE)

for key, command in shortcuts:
    LispUtils()._bind_local(command, key)

lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])
Пример #7
0
a file on which the rope command is performed when no project is
already opened.")

(provide 'ropemacs)
"""

MINOR_MODE = """\
(define-minor-mode ropemacs-mode
 "ropemacs, rope in emacs!" nil " Rope" ropemacs-local-keymap
  :global nil)
)
"""

shortcuts = [('M-/', 'rope-code-assist'),
             ('M-?', 'rope-lucky-assist'),
             ('C-c g', 'rope-goto-definition'),
             ('C-c d', 'rope-show-doc'),
             ('C-c f', 'rope-find-occurrences')]


ropemode.decorators.logger.message = message
lisp(DEFVARS)
_interface = ropemode.interface.RopeMode(env=LispUtils())
_interface.init()
lisp(MINOR_MODE)

for key, command in shortcuts:
    LispUtils()._bind_local(command, key)

lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode'])