This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposed patch to system.XWinrc

Ken Brown wrote:
On 6/17/2009 3:17 PM, Jon TURNEY wrote:
+       emacs   exec    "bash -l -c /usr/bin/emacs"
        notepad exec    notepad
        xload   exec    "xload -display %display%"  # Comment

The most important part of this is changing the way emacs is called; the original version didn't work at all for me (i.e., emacs didn't start). This might be related to the fact that I've installed the emacs-23 packages, which use the alternatives system:

/usr/bin/emacs -> /etc/alternatives/emacs
/etc/alternatives/emacs -> /usr/bin/emacs-X11.exe

The command lines for menu items are just supplied to execl('/bin/sh -c ...') after a fork, so it should have no problem following symlinks, and a bare "emacs" works for me (I tested 23.0.92 under Cygwin 1.7)

It turns out that I was using a modified startxwin.bat that didn't set up the path correctly. So now it works for me too. Nevertheless, I prefer "bash -l -c /usr/bin/emacs" so that the bash initialization files are processed before emacs starts. For various reasons, I want the environment inside emacs to be the same as the usual bash environment. I suspect that most emacs users would want that, but I don't really know.

Yes, I think this is a general problem: when X is started directly from DOS and then programs are started from the tray menu, they aren't executed in a login environment. It seems unlikely this is what anyone would actually want (I notice my .Xwinrc is decorated with equivalent options.) So perhaps we should be launching everything using '/bin/sh -l -c'? Patch attached.

But even with this, there is a difference between 'exec xterm' and 'exec xterm -ls' (which will use the users shell of choice from /etc/passwd, which I shall assume is bash), which I think is due to /etc/profile setting PS1 differently depending on if the shell is sh or bash...

Hmm... and now I look at it, setup should probably be installing the system.XWinrc into /etc/defaults, rather than overwriting it whenever the package is updated...
diff --git a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
index 2360bfc..8e74d0c 100644
--- a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
+++ b/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
@@ -18,6 +18,9 @@
 #                               ^^ This command will have any "%display%"
 #                                  string replaced with the proper display
 #                                  variable (i.e.<display>.0)
+#                                  (This should only rarely be needed as
+#                                  the DISPLAY environment variable is also
+#                                  set correctly)
 #  or	<Menu Text>	MENU	<name-of-some-prior-defined-menu>
 #  or	<Menu Text>	ALWAYSONTOP
 #                         ^^ Sets the window to display above all others
@@ -79,8 +82,8 @@
 // Make some menus...
 menu apps {
-	xterm	exec	"xterm"
-	"Emacs"		exec	"emacs"
+	xterm	exec	"xterm -sb"
+	"Emacs"	exec	"emacs"
 	notepad	exec	notepad
 	xload	exec	"xload -display %display%"  # Comment
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index c5fd7eb..e837136 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -373,6 +373,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
 		      execl ("/bin/sh",
+			     "-l",

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]