parent
7a374ea5b1
commit
437c9bacb2
|
@ -2,23 +2,10 @@
|
|||
import curses, curses.ascii, getpass, os, re, string, sets, sys, termios, time
|
||||
import traceback
|
||||
|
||||
import buffer2, bufferlist, color, completer, keyinput, method, minibuffer
|
||||
import buffer2, bufferlist, color, completer, keyinput, method, minibuffer, mode2
|
||||
import util, window2
|
||||
from point2 import Point
|
||||
|
||||
# modes
|
||||
import mode2
|
||||
import mode.mini, mode.search, mode.replace, mode.which
|
||||
import mode.console, mode.consolemini
|
||||
import mode.c, mode.python, mode.perl, mode.nasm, mode.sql, mode.java
|
||||
import mode.sh, mode.make
|
||||
import mode.lisp, mode.elisp, mode.scheme, mode.ocaml
|
||||
import mode.blame, mode.diff, mode.dir
|
||||
import mode.xml, mode.tt, mode.css, mode.javascript, mode.html, mode.hex
|
||||
import mode.text, mode.text2, mode.mutt
|
||||
#import mode.bds
|
||||
import mode.rst
|
||||
|
||||
def run(buffers, jump_to_line=None, init_mode=None):
|
||||
# save terminal state so we can restore it when the program exits
|
||||
attr = termios.tcgetattr(sys.stdin)
|
||||
|
@ -93,39 +80,14 @@ class Application(object):
|
|||
self.mode_extensions = {}
|
||||
self.mode_detection = {}
|
||||
|
||||
#mode2.Fundamental.install(self)
|
||||
# ok, now let's load all the "standard" modes
|
||||
mode2.install(self)
|
||||
mode.blame.install(self)
|
||||
mode.c.install(self)
|
||||
mode.console.install(self)
|
||||
mode.consolemini.install(self)
|
||||
mode.css.install(self)
|
||||
mode.diff.install(self)
|
||||
mode.dir.install(self)
|
||||
mode.elisp.install(self)
|
||||
mode.hex.install(self)
|
||||
mode.html.install(self)
|
||||
mode.java.install(self)
|
||||
mode.javascript.install(self)
|
||||
mode.lisp.install(self)
|
||||
mode.make.install(self)
|
||||
mode.mini.install(self)
|
||||
mode.mutt.install(self)
|
||||
mode.nasm.install(self)
|
||||
mode.ocaml.install(self)
|
||||
mode.perl.install(self)
|
||||
mode.python.install(self)
|
||||
mode.replace.install(self)
|
||||
mode.rst.install(self)
|
||||
mode.scheme.install(self)
|
||||
mode.search.install(self)
|
||||
mode.sh.install(self)
|
||||
mode.sql.install(self)
|
||||
mode.tt.install(self)
|
||||
mode.text.install(self)
|
||||
mode.text2.Text2.install(self)
|
||||
mode.which.install(self)
|
||||
mode.xml.install(self)
|
||||
for name in ('blame', 'c', 'console', 'consolemini', 'css', 'diff',
|
||||
'dir', 'elisp', 'hex', 'html', 'java', 'javascript',
|
||||
'lisp', 'make', 'mini', 'mutt', 'nasm', 'ocaml', 'perl',
|
||||
'python', 'replace', 'rst', 'scheme', 'search', 'sh',
|
||||
'sql', 'tt', 'text', 'text2', 'which', 'xml'):
|
||||
exec("import mode.%s; mode.%s.install(self)" % (name, name))
|
||||
|
||||
# initialize our methods
|
||||
self.methods = {}
|
||||
|
@ -153,6 +115,9 @@ class Application(object):
|
|||
# note that the first buffer in buffers will be initially visible
|
||||
buffers.append(buffer2.ScratchBuffer())
|
||||
buffers.append(buffer2.ConsoleBuffer())
|
||||
if self.rcerror:
|
||||
buffers.insert(0, buffer2.DataBuffer('*RcError*', self.rcerror))
|
||||
|
||||
self.bufferlist = bufferlist.BufferList(height, width)
|
||||
self.active_slot = 0
|
||||
|
||||
|
@ -197,6 +162,8 @@ class Application(object):
|
|||
curses.noecho()
|
||||
curses.nonl()
|
||||
|
||||
# this sets up a mode, as well as optionally adding information on when to
|
||||
# auto-load the mode
|
||||
def setmode(self, name, cls, paths=[], basenames=[], extensions=[], detection=[]):
|
||||
self.modes[name] = cls
|
||||
for p in paths:
|
||||
|
@ -439,10 +406,6 @@ class Application(object):
|
|||
def eval(self, s):
|
||||
return eval(s)
|
||||
|
||||
#
|
||||
def loadmode(self, name, path):
|
||||
pass
|
||||
|
||||
# load user configuration NOW
|
||||
def loadrc(self):
|
||||
path = os.path.join(os.getenv('HOME'), '.pmc', 'conf')
|
||||
|
@ -450,7 +413,8 @@ class Application(object):
|
|||
try:
|
||||
execfile(path)
|
||||
except Exception, e:
|
||||
self.rcerror = e
|
||||
s = traceback.format_exc()
|
||||
self.rcerror = 'There was an error during startup:\n\n%s' % s
|
||||
|
||||
# the mighty run-loop!
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue