From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Patch to allow -nw to runemacs on w32 Date: Wed, 15 Nov 2006 14:44:25 +0100 Message-ID: <455B19B9.9000004@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040903050005020903050803" X-Trace: sea.gmane.org 1163598302 13505 80.91.229.2 (15 Nov 2006 13:45:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Nov 2006 13:45:02 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 15 14:45:01 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GkL4O-00006Z-NA for ged-emacs-devel@m.gmane.org; Wed, 15 Nov 2006 14:44:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkL4N-0007g7-QV for ged-emacs-devel@m.gmane.org; Wed, 15 Nov 2006 08:44:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GkL46-0007fp-S6 for emacs-devel@gnu.org; Wed, 15 Nov 2006 08:44:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GkL45-0007fQ-QX for emacs-devel@gnu.org; Wed, 15 Nov 2006 08:44:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkL45-0007fN-Lf for emacs-devel@gnu.org; Wed, 15 Nov 2006 08:44:33 -0500 Original-Received: from [80.76.149.212] (helo=ch-smtp01.sth.basefarm.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GkL45-0002Dz-I1 for emacs-devel@gnu.org; Wed, 15 Nov 2006 08:44:34 -0500 Original-Received: from [83.254.145.24] (port=62167 helo=[192.168.123.121]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1GkL40-0005if-4f for emacs-devel@gnu.org; Wed, 15 Nov 2006 14:44:31 +0100 User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) Original-To: Emacs Devel X-Scan-Result: No virus found in message 1GkL40-0005if-4f. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1GkL40-0005if-4f 0f39bec1c7f88d92091250baaf91db41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:62333 Archived-At: This is a multi-part message in MIME format. --------------040903050005020903050803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit In some situations you may want to be able to use the -nw option with runemacs.exe. All other options to emacs can be given to runemacs, but -nw currently gives a fatal error. The attached patch fixes this. --------------040903050005020903050803 Content-Type: text/plain; name="runemacs-allow-nw.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="runemacs-allow-nw.patch" Index: runemacs.c =================================================================== RCS file: /cvsroot/emacs/emacs/nt/runemacs.c,v retrieving revision 1.13 diff -u -r1.13 runemacs.c --- runemacs.c 29 Oct 2006 22:43:37 -0000 1.13 +++ runemacs.c 15 Nov 2006 13:30:18 -0000 @@ -51,11 +51,12 @@ SECURITY_ATTRIBUTES sec_attrs; PROCESS_INFORMATION child; int wait_for_child = FALSE; - DWORD priority_class = NORMAL_PRIORITY_CLASS; + DWORD creation_flags = NORMAL_PRIORITY_CLASS; DWORD ret_code = 0; char *new_cmdline; char *p; char modname[MAX_PATH]; + BOOL create_console = FALSE; if (!GetModuleFileName (NULL, modname, MAX_PATH)) goto error; @@ -113,12 +114,12 @@ } else if (strncmp (cmdline+1, "high", 4) == 0) { - priority_class = HIGH_PRIORITY_CLASS; + creation_flags = HIGH_PRIORITY_CLASS; cmdline += 5; } else if (strncmp (cmdline+1, "low", 3) == 0) { - priority_class = IDLE_PRIORITY_CLASS; + creation_flags = IDLE_PRIORITY_CLASS; cmdline += 4; } else @@ -129,6 +130,27 @@ strcat (new_cmdline, cmdline); + /* Look for -nw since it requires the console flag */ + while (cmdline[0] == '-' || cmdline[0] == '/') + { + if (strncmp (cmdline+1, "nw", 2) == 0) + { + creation_flags = creation_flags | CREATE_NEW_CONSOLE; + create_console = TRUE; + cmdline += 5; + } + else if (strncmp (cmdline+1, "-no-window-system", 17) == 0) + { + creation_flags = creation_flags | CREATE_NEW_CONSOLE; + create_console = TRUE; + cmdline += 18; + } + else + break; + /* Look for next argument. */ + while (*++cmdline == ' '); + } + /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0) { @@ -140,18 +162,20 @@ memset (&start, 0, sizeof (start)); start.cb = sizeof (start); - start.dwFlags = STARTF_USESHOWWINDOW | STARTF_USECOUNTCHARS; - start.wShowWindow = SW_HIDE; - /* Ensure that we don't waste memory if the user has specified a huge - default screen buffer for command windows. */ - start.dwXCountChars = 80; - start.dwYCountChars = 25; + if (!create_console) { + start.dwFlags = STARTF_USESHOWWINDOW | STARTF_USECOUNTCHARS; + start.wShowWindow = SW_HIDE; + /* Ensure that we don't waste memory if the user has specified a huge + default screen buffer for command windows. */ + start.dwXCountChars = 80; + start.dwYCountChars = 25; + } sec_attrs.nLength = sizeof (sec_attrs); sec_attrs.lpSecurityDescriptor = NULL; sec_attrs.bInheritHandle = FALSE; - if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, priority_class, + if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, creation_flags, NULL, NULL, &start, &child)) { if (wait_for_child) --------------040903050005020903050803 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------040903050005020903050803--