Proper support for user selected text editor on linux #259

Closed
ryanatball opened this Issue Feb 24, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@ryanatball
Member

ryanatball commented Feb 24, 2016

When prompted to "Open Exception Log in Text Editor", I always find that COSMOS tries to invoke gedit, which is not installed on my debian system. I expected it to use the EDITOR or VISUAL environment variable.

I tracked the problem down to the test for which gedit in /var/lib/gems/2.1.0/gems/cosmos-3.0.1/lib/cosmos/top_level.rb (the latest git version of top_level.rb has the same problem).

On my system, which gedit returns an empty string. Note that on debian, /bin/sh is a symlink to /bin/dash.

My workaround was to change the test from

if which_gedit =~ /Command not found/i or which_gedit =~ /no .* in/i

to simply

if which_gedit == ""

However, I think that the logic should be as follows:

if $VISUAL or $EDITOR exists
then
if xterm or gnome-terminal or rxvt or urxvt exists then
system_call = "TERMINAL -e $EDITOR filename"
else
system_call = "VISUAL filename"
endif
else try gedit

That is, EDITOR or VISUAL should take precedence over gedit. The use of VISUAL here assumes that it represents an X windows editor such as gedit.

@ryanatball ryanatball added the feature label Feb 24, 2016

@ryanatball ryanatball changed the title from Proper support for user selected text edit on linux to Proper support for user selected text editor on linux Feb 24, 2016

@ryanatball ryanatball self-assigned this May 5, 2016

@ryanatball ryanatball modified the milestone: v3.8.1 May 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment