From: Lennart Borgman <lennart.borgman.073@student.lu.se>
Subject: Patch to allow -nw to runemacs on w32
Date: Wed, 15 Nov 2006 14:44:25 +0100 [thread overview]
Message-ID: <455B19B9.9000004@student.lu.se> (raw)
[-- Attachment #1: Type: text/plain, Size: 209 bytes --]
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.
[-- Attachment #2: runemacs-allow-nw.patch --]
[-- Type: text/plain, Size: 2876 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next reply other threads:[~2006-11-15 13:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-15 13:44 Lennart Borgman [this message]
2006-11-15 15:22 ` Patch to allow -nw to runemacs on w32 Jason Rumney
2006-11-15 15:34 ` Lennart Borgman
2006-11-15 15:47 ` Juanma Barranquero
2006-11-15 15:55 ` Juanma Barranquero
2006-11-15 16:12 ` Lennart Borgman
2006-11-15 16:37 ` Juanma Barranquero
2006-11-15 18:57 ` Juanma Barranquero
2006-11-15 21:35 ` Jason Rumney
2006-11-15 21:20 ` Lennart Borgman
2006-11-15 21:29 ` Juanma Barranquero
2006-11-15 17:41 ` Eli Zaretskii
2006-11-15 20:05 ` Lennart Borgman
2006-11-15 21:38 ` Jason Rumney
2006-11-15 22:02 ` Lennart Borgman
2006-11-16 4:40 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=455B19B9.9000004@student.lu.se \
--to=lennart.borgman.073@student.lu.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).