From: Simon Strandgaard Date: 2004-04-19T18:19:07+09:00 Subject: Re: convert yield to proc On Mon, 19 Apr 2004 12:00:04 +0200, Robert Klemme wrote: [snip] > But what do you need that for? This isn't a real world example, is it? > > Just curious... > Its a tiny example of a configuration system for AEditor, where you can have different modes, for instance: define a ruby mode, where certain key gets bound with RI, rdoc. Where syntax hiliting gets configured. Much inspired by Rake. An example dotfile for AEditor: server> expand -t2 dotfile.rb # AEditor preferences for Simon Strandgaard mode :global do tabsize 4 #panel_format {|i| "#{i.y},#{i.xcell}-#{i.xchar}"} end mode :ruby => :global do tabsize 2 #on_execute_project {|i| "ruby -v main.rb"} #on_execute_buffer {|i| "ruby -v #{i.filename}"} # record errors, so we can jump to them #on_execute_tests "ruby test_all.rb" #on_execute_builddoc {|i| "rdoc #{i.filename}"} #on_help_context { |place| "ri place" } #on_debug_step "gdb" #mode_selftest do # check that ruby is working # check rdoc is present # check ri is prsent #end end file_suffix %w(rb rbx) => :ruby mode :rake => :ruby do # TODO: extract tasks, rules, files.. show choices #on_execute_buffer {|i| dialog('all', 'run', 'upload', 'validate')} end file_match %w(rakefile rakefile.rb) => :ruby mode :c => :global do end file_suffix 'c' => :c mode :cpp => :c do end file_suffix %w(cpp cc) => :cpp mode :xml => :global do #on_execute_buffer {|i| "xsltproc --validate #{i.filename}"} end file_suffix %w(xml xhtml) => :xml theme :morning do end theme :night do end server> The code for parsing it located here http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/projects/experimental/preferences/?cvsroot=aeditor Its a proof of concept.. Any suggestions? How would you like preferences to be ? -- Simon Strandgaard