Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/xi/repl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,21 @@ def start(irb: false)
def configure
prepare_config_dir

if ENV["INSIDE_EMACS"]
prompts = if ENV["INSIDE_EMACS"]
Pry.config.correct_indent = false
Pry.config.pager = false
Pry.config.prompt = [ proc { "" }, proc { "" }]
[ proc { "" }, proc { "" }]
else
Pry.config.prompt = [ proc { "xi> " }, proc { "..> " }]
[ proc { "xi> " }, proc { "..> " }]
end
Pry::Prompt.new("Guard", "Guard Pry prompt", prompts)

Pry.config.history.file = history_path
# Pry >= 0.13
if Pry.config.respond_to?(:history_file=)
Pry.config.history_file = history_path
else
Pry.config.history.file = history_path
end

Pry.hooks.add_hook(:after_eval, "check_for_errors") do |result, pry|
more_errors = ErrorLog.instance.more_errors?
Expand All @@ -55,7 +61,7 @@ def load_init_script
def prepare_config_dir
FileUtils.mkdir_p(CONFIG_PATH)

unless File.exists?(init_script_path)
unless File.exist?(init_script_path)
File.write(init_script_path, DEFAULT_INIT_SCRIPT)
end
end
Expand Down