diff --git a/xonsh/base_shell.py b/xonsh/base_shell.py index 845b6e75f..718c41bcb 100644 --- a/xonsh/base_shell.py +++ b/xonsh/base_shell.py @@ -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 = ' ' 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 diff --git a/xonsh/environ.py b/xonsh/environ.py index 06a8d7f49..21b9b7d74 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -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 '' diff --git a/xonsh/history.py b/xonsh/history.py index 6c858d1eb..e1518b826 100644 --- a/xonsh/history.py +++ b/xonsh/history.py @@ -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