How to use the rules.emacs.Cmd.runEmacsCmd function in rules

To help you get started, we’ve selected a few rules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jgarvin / mandimus / rules / emacs / Mic.py View on Github external
def tellEmacs(self, state):
        # log.info("telling emacs cursor state: %s" % state)
        runEmacsCmd("(md-new-mic-state \"%s\")" % state)
github jgarvin / mandimus / rules / emacs / BufferNames.py View on Github external
def _noChoice(self):
        runEmacsCmd("(md-switch-to-next-buffer-in-list %s)" % self.query, queryOnly=False)
github jgarvin / mandimus / requirements / VarRequirement.py View on Github external
def _query(self, ev=None):
        output = runEmacsCmd(self.var)
        try:
            output = int(output)
        except ValueError:
            pass

        self._met(output == self.value)
github jgarvin / mandimus / rules / emacs / BufferNames.py View on Github external
def _select(self, cmd, choice):
        runEmacsCmd("(switch-to-buffer \"%s\")" % choice, queryOnly=False)
github jgarvin / mandimus / rules / emacs / Text.py View on Github external
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)
github jgarvin / mandimus / rules / emacs / Keywords.py View on Github external
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))
github jgarvin / mandimus / rules / emacs / ModeLine.py View on Github external
def onWordEvent(ev):
    runEmacsCmd(u"(mandimus-word-event \"%s\")" % ev.words)