def newbuf(x)
Hash === x or raise ArgumentError, "argument must be a hash!"
x[:name] || x[:file] or raise ArgumentError, "`:name' or `:file' key is mandatory!"
x[:name] and b = get_buffer_create(x[:name])
x[:file] && !x[:name] and b = find_file_noselect(x[:file])
check = lambda{|key, type| x[key] && (type===x[key] or raise ArgumentError) }
with(:with_current_buffer, b) {
elvar.buffer_read_only = nil
x[:name] and erase_buffer
x[:name] && x[:file] and insert_file_contents(x[:file])
x[:contents] and insert x[:contents].to_s
check[:line,Integer] and goto_line x[:line]
check[:point,Integer] and goto_char x[:point]
block_given? and yield
x[:read_only] and elvar.buffer_read_only = true
}
case x[:display]
when :pop; pop_to_buffer b
when :only; delete_other_windows; switch_to_buffer b
when true; display_buffer b
else
end
x[:bury] and bury_buffer b
x[:current] and set_buffer b
b
end