Пример #1
0
 def tellEmacs(self):
     # this isn't ideal, because it only takes into account one type of requirement
     # however that is the most common kind
     keywordString = "'(" + " ".join([("\"%s\"" % x[0]) for x in self.keywords]) + ")"
     for m in self.requirements:
         if isinstance(m, ModeRequirement):
             for mode in m.modes:
                 runEmacsCmd("(md-register-mode-keywords '%s %s)" % (mode, keywordString))
Пример #2
0
 def _print(self, words):
     # There's no good elisp way to handle putting characters into
     # the search box AFAIK. You can get text in there but giving it
     # focus disables search as you type.
     inSearchMode = runEmacsCmd("isearch-mode") != 'nil'
     inMiniBuffer = '*Minibuf-' in runEmacsCmd("(with-current-buffer (buffer-name))")
     words = words if not self.allCaps else [i.upper() for i in words]
     if inSearchMode or inMiniBuffer:
         Text._print(self, words)
     else:
         runEmacsCmd("(md-insert-text \"%s\" %s %s)" % (words, emacsBool(self.spaceCheck),
                     emacsBool(self.capitalCheck)), dolog=True,
                     queryOnly=False)
Пример #3
0
 def _select(self, cmd, choice):
     if runEmacsCmd("(md-at-start-of-erc-input-line)") == 't':
         # we're addressing them, include the colon
         EmacsText("%s: " % choice, lower=False, capitalCheck=False)()
     else:
         # we're referring to them, omit the colon
         EmacsText("%s" % choice, lower=False, capitalCheck=False)()
Пример #4
0
 def _select(self, cmd, choice):
     if runEmacsCmd("(md-at-start-of-erc-input-line)") == 't':
         # we're addressing them, include the colon
         EmacsText("%s: " % choice, lower=False, capitalCheck=False)()
     else:
         # we're referring to them, omit the colon
         EmacsText("%s" % choice, lower=False, capitalCheck=False)()
Пример #5
0
def _updateMajorMode(ev):
    global _majorMode, _oldMajorMode
    _majorMode = runEmacsCmd("(md-get-all-modes)")
    _majorMode = _getEmacsList(_majorMode)
    if _majorMode != _oldMajorMode:
        pushEvent(MajorModeEvent(_majorMode))
    _oldMajorMode = _majorMode
Пример #6
0
 def _print(self, words):
     # There's no good elisp way to handle putting characters into
     # the search box AFAIK. You can get text in there but giving it
     # focus disables search as you type.
     inSearchMode = runEmacsCmd("isearch-mode") != 'nil'
     inMiniBuffer = '*Minibuf-' in runEmacsCmd(
         "(with-current-buffer (buffer-name))")
     words = words if not self.allCaps else [i.upper() for i in words]
     if inSearchMode or inMiniBuffer:
         Text._print(self, words)
     else:
         runEmacsCmd("(md-insert-text \"%s\" %s %s)" %
                     (words, emacsBool(
                         self.spaceCheck), emacsBool(self.capitalCheck)),
                     dolog=True,
                     queryOnly=False)
Пример #7
0
def _updateMajorMode(ev):
    global _majorMode, _oldMajorMode
    _majorMode = runEmacsCmd("(md-get-all-modes)")
    _majorMode = _getEmacsList(_majorMode)
    if _majorMode != _oldMajorMode:
        log.info("Switching major mode: {}".format(_majorMode))
        pushEvent(MajorModeEvent(_majorMode))
    _oldMajorMode = _majorMode
Пример #8
0
def _updateMajorMode(ev):
    global _majorMode, _oldMajorMode
    _majorMode = runEmacsCmd("(md-get-all-modes)")
    _majorMode = _getEmacsList(_majorMode)
    if _majorMode != _oldMajorMode:
        log.info("Switching major mode: {}".format(_majorMode))
        pushEvent(MajorModeEvent(_majorMode))
    _oldMajorMode = _majorMode
Пример #9
0
    def _query(self, ev=None):
        output = runEmacsCmd(self.var)
        try:
            output = int(output)
        except ValueError:
            pass

        self._met(output == self.value)
Пример #10
0
    def _query(self, ev=None):
        output = runEmacsCmd(self.var)
        try:
            output = int(output)
        except ValueError:
            pass

        self._met(output == self.value)
Пример #11
0
    def update(self, ev=None):
        window = ev.window if ev else getFocusedWindow()
        newOutput = runEmacsCmd(self.cmd, inFrame=self.inFrame,
                                allowError=self.allowError,
                                dolog=(self.logging or self.clsLogging))
        newOutput = self._postProcess(newOutput)

        if newOutput == self.lastOutput:
            return
        self.lastOutput = newOutput
        #log.info("New output!")
        pushEvent(self._makeEvent(newOutput))
Пример #12
0
    def update(self, ev=None):
        window = ev.window if ev else getFocusedWindow()
        newOutput = runEmacsCmd(self.cmd,
                                inFrame=self.inFrame,
                                allowError=self.allowError,
                                dolog=(self.logging or self.clsLogging))
        newOutput = self._postProcess(newOutput)

        if newOutput == self.lastOutput:
            return
        self.lastOutput = newOutput
        #log.info("New output!")
        pushEvent(self._makeEvent(newOutput))
Пример #13
0
 def _select(self, cmd, choice):
     runEmacsCmd("(switch-to-buffer \"%s\")" % choice, queryOnly=False)
Пример #14
0
 def _currentChoice(self):
     buf = runEmacsCmd("(buffer-name (current-buffer))")
     return buf.strip().strip('"')
Пример #15
0
 def tellEmacs(self, state):
     # log.info("telling emacs cursor state: %s" % state)
     runEmacsCmd("(md-new-mic-state \"%s\")" % state)
Пример #16
0
def _onModeChange(self):
    snippetList = grammar.getStringList(runEmacsCmd("(md-get-snippet-names)"))
    log.info("Snippet names: [%s]" % snippetList)
    pushEvent(WordListEvent("SnippetList", snippetList))
Пример #17
0
 def _noChoice(self):
     runEmacsCmd("(switch-to-buffer nil)", queryOnly=False)                
Пример #18
0
def _onModeChange(self):
    snippetList = grammar.getStringList(runEmacsCmd("(md-get-snippet-names)"))
    log.info("Snippet names: [%s]" % snippetList)
    pushEvent(WordListEvent("SnippetList", snippetList))
Пример #19
0
 def _select(self, cmd, choice):
     runEmacsCmd("(switch-to-buffer \"%s\")" % choice, queryOnly=False)
Пример #20
0
def onWordEvent(ev):
    runEmacsCmd(u"(mandimus-word-event \"%s\")" % ev.words)
Пример #21
0
 def _currentChoice(self):
     return runEmacsCmd("(when (md-current-path) (file-relative-name (md-current-path) (projectile-project-root))))").strip("\"")
Пример #22
0
 def _select(self, cmd, choice):
     runEmacsCmd("(projectile-switch-project-by-name \"%s\")" % choice, queryOnly=False)
Пример #23
0
 def _currentChoice(self):
     return runEmacsCmd("(projectile-project-name)").strip("\"")
Пример #24
0
 def _noChoice(self):
     runEmacsCmd("(md-switch-to-next-buffer-in-list %s)" % self.query, queryOnly=False)
Пример #25
0
 def _noChoice(self):
     runEmacsCmd("(md-folder-switch)", queryOnly=False)
Пример #26
0
 def _noChoice(self):
     runEmacsCmd("(md-switch-to-next-buffer-in-list %s)" % self.query,
                 queryOnly=False)
Пример #27
0
 def _noChoice(self):
     runEmacsCmd("(md-folder-switch)", queryOnly=False)
Пример #28
0
 def _select(self, cmd, choice):
     runEmacsCmd(_openProjetileFileEl % choice)
Пример #29
0
def onWordEvent(ev):
    runEmacsCmd(u"(mandimus-word-event \"%s\")" % ev.words)
Пример #30
0
 def _currentChoice(self):
     buf = runEmacsCmd("(buffer-name (current-buffer))")
     return buf.strip().strip('"')