more default changes

This commit is contained in:
Anthony Scopatz 2015-10-10 15:20:51 -04:00
parent eaf96afb3c
commit aa64655666
3 changed files with 11 additions and 15 deletions

View file

@ -181,9 +181,8 @@ class BaseShell(object):
term = env.get('TERM', None)
if term is None or term == 'linux':
return
if 'TITLE' in env:
t = env['TITLE']
else:
t = env.get('TITLE')
if t is None:
return
t = format_prompt(t)
if ON_WINDOWS and 'ANSICON' not in env:
@ -204,14 +203,11 @@ class BaseShell(object):
self.mlprompt = '<multiline prompt error> '
return self.mlprompt
env = builtins.__xonsh_env__
if 'PROMPT' in env:
p = env['PROMPT']
try:
p = format_prompt(p)
except Exception:
print_exception()
else:
p = "set '$PROMPT = ...' $ "
p = env.get('PROMPT')
try:
p = format_prompt(p)
except Exception:
print_exception()
self.settitle()
return p

View file

@ -529,7 +529,7 @@ RE_HIDDEN = re.compile('\001.*?\002')
def multiline_prompt():
"""Returns the filler text for the prompt in multiline scenarios."""
curr = builtins.__xonsh_env__.get('PROMPT', "set '$PROMPT = ...' $ ")
curr = builtins.__xonsh_env__.get('PROMPT')
curr = format_prompt(curr)
line = curr.rsplit('\n', 1)[1] if '\n' in curr else curr
line = RE_HIDDEN.sub('', line) # gets rid of colors
@ -539,7 +539,7 @@ def multiline_prompt():
# tail is the trailing whitespace
tail = line if headlen == 0 else line.rsplit(head[-1], 1)[1]
# now to constuct the actual string
dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT', '.')
dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT')
dots = dots() if callable(dots) else dots
if dots is None or len(dots) == 0:
return ''

View file

@ -79,7 +79,7 @@ class HistoryGC(Thread):
"""Finds the history files and returns the ones that are unlocked, this is
sorted by the last closed time. Returns a list of (timestamp, file) tuples.
"""
xdd = os.path.abspath(builtins.__xonsh_env__['XONSH_DATA_DIR'])
xdd = os.path.abspath(builtins.__xonsh_env__.get('XONSH_DATA_DIR'))
fs = [f for f in iglob(os.path.join(xdd, 'xonsh-*.json'))]
files = []
for f in fs:
@ -209,7 +209,7 @@ class History(object):
"""
self.sessionid = sid = uuid.uuid4() if sessionid is None else sessionid
if filename is None:
self.filename = os.path.join(builtins.__xonsh_env__['XONSH_DATA_DIR'],
self.filename = os.path.join(builtins.__xonsh_env__.get('XONSH_DATA_DIR'),
'xonsh-{0}.json'.format(sid))
else:
self.filename = filename