File: enshell_plugin.py

package info (click to toggle)
python-envisageplugins 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,616 kB
  • ctags: 1,970
  • sloc: python: 7,047; makefile: 11; sh: 11; lisp: 1
file content (33 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
"""

# System library imports
from Pymacs import lisp

# ETS imports
from enthought.plugins.remote_editor.plugins.editor_plugin import \
        EditorPlugin


client = EditorPlugin()
client.register()

def run_text():
    start = lisp.point()
    end = lisp.mark(True)
    if start > end:
        start, end = end, start
    text = lisp.buffer_substring(start, end)
    if len(text):
        client.run_text(text)
    else:
        # TODO Complain in message bar
        pass

def run_file():
    path = lisp.buffer_file_name()
    if path is None:
        # TODO Complain in message bar
        pass
    else:
        client.run_file(path)