Ticket #816 (closed task: fixed)

Opened 6 years ago

Last modified 5 years ago

In addition of $EDITOR, support $VISUAL too

Reported by: tuju Owned by: dgollub
Priority: low Milestone:
Component: osynctool/msynctool Version: 0.37
Severity: trivial Keywords:
Cc:

Description

man less

       v      Invokes an editor to edit the current file being viewed. The editor 
              is taken from the  environment variable VISUAL if defined, or EDITOR
              if VISUAL is not defined, or defaults to "vi" if neither VISUAL nor
              EDITOR is defined.

I wouldn't be surprised that it's been defined in some POSIX specs, but regardless of that, we could support old farts using the $VISUAL too. :)

Change History

comment:1 Changed 6 years ago by bricks

Should we switch EDITOR and VISUAL?

#ifdef _WIN32
	editcmd = g_strdup_printf("notepad %s", tmpfile);
#else
	if (!(editor = getenv("EDITOR")))
		editor = getenv("VISUAL");
	
	if (editor)
		editcmd = g_strdup_printf("%s %s", editor, tmpfile);
	else	
		editcmd = g_strdup_printf("vi %s", tmpfile);
#endif

comment:2 Changed 6 years ago by tuju

Didn't find POSIX definition for this, but many other sources claim VISUAL over EDITOR like:

http://www.mkssoftware.com/docs/man1/sh.1.asp#ENVIRONMENT_VARIABLES http://seejeffrun.blogspot.com/2008/07/setting-defaults-properly.html

and when failing on those, then trying to launch vi.

comment:3 Changed 6 years ago by dgollub

  • Priority changed from normal to low
  • Severity changed from normal to trivial
  • Milestone 0.38 deleted

I don't care - feel free to switch this. This should not block any release.

comment:4 Changed 5 years ago by felixmoeller

  • Status changed from new to closed
  • Resolution set to fixed

I committed this with r382 of msynctool.

Note: See TracTickets for help on using tickets.