[holy ruby programmers batman!] Editor Defaults

Avdi Grimm avdi at avdi.org
Tue Dec 18 11:04:06 EST 2007


Here's an update to the smart editor defaults patch I sent Giles a
little while ago.  Short version: this patch adds smart defaulting to
the edit_interactively() method, which will try to determine your
preferred editor if none is specified.

Changes:
 * I've added support for the freedesktop.org xdg-open command that
comes with modern Linux distros ilke Ubuntu.
 * I've experimentally moved the interactive editor commands into
their own module which is included in the IRB environment with
#extend, rather than monkeypatching Object.  It seems to work OK, and
it removes some unnecessary pollution of Object (unnecessary because
the editor commands don't need to be called on specific objects).

Todo:
 * Still no Windows support, although I think I have a better idea now
which registry keys are pertinent to providing it.  Unfortunately I
can't just use the Windows "start" command, because that typically
tells Windows to run the file, not to edit it.

Question for Giles: is there any reason the edited file is read using
Object.class_eval(`cat #{@file.path}`) rather than
Object.class_eval(@file.read)?

-- 
Avdi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: editor_defaults.patch
Type: application/octet-stream
Size: 6527 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/utilitybelt-tinkering/attachments/20071218/81745387/attachment-0001.obj 


More information about the Utilitybelt-tinkering mailing list