lib/textbringer/commands/misc.rb in textbringer-0.1.7 vs lib/textbringer/commands/misc.rb in textbringer-0.1.8
- old
+ new
@@ -225,20 +225,25 @@
Controller.current.recursive_edit
end
define_command(:shell_execute) do
|cmd = read_from_minibuffer("Shell execute: "),
- buffer_name = "*Shell output*"|
+ buffer_name: "*Shell output*",
+ mode: FundamentalMode|
buffer = Buffer.find_or_new(buffer_name)
switch_to_buffer(buffer)
+ buffer.apply_mode(mode)
buffer.read_only = false
buffer.clear
Window.redisplay
signals = [:INT, :TERM, :KILL]
begin
opts = /mswin32|mingw32/ =~ RUBY_PLATFORM ? {} : {pgroup: true}
- Open3.popen2e(cmd, opts) do |input, output, wait_thread|
+ if CONFIG[:shell_file_name]
+ cmd = [CONFIG[:shell_file_name], CONFIG[:shell_command_switch], cmd]
+ end
+ Open3.popen2e(*cmd, opts) do |input, output, wait_thread|
input.close
loop do
status = output.wait_readable(0.5)
if status
begin
@@ -275,8 +280,14 @@
end
end
ensure
buffer.read_only = true
end
+ end
+
+ define_command(:grep) do
+ |cmd = read_from_minibuffer("Grep: ",
+ initial_value: CONFIG[:grep_command] + " ")|
+ shell_execute(cmd, buffer_name: "*grep*", mode: BacktraceMode)
end
end
end