From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Not loading the Registry settings Date: Tue, 15 Sep 2009 11:26:25 +0200 Message-ID: References: <87skerr30v.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1253006833 20026 80.91.229.12 (15 Sep 2009 09:27:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Sep 2009 09:27:13 +0000 (UTC) Cc: David De La Harpe Golden , Emacs developers , Miles Bader To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 15 11:27:05 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MnUJV-0003mf-6n for ged-emacs-devel@m.gmane.org; Tue, 15 Sep 2009 11:27:05 +0200 Original-Received: from localhost ([127.0.0.1]:39837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnUJU-0001q4-JA for ged-emacs-devel@m.gmane.org; Tue, 15 Sep 2009 05:27:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnUJN-0001oL-Dv for emacs-devel@gnu.org; Tue, 15 Sep 2009 05:26:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnUJI-0001ha-C8 for emacs-devel@gnu.org; Tue, 15 Sep 2009 05:26:56 -0400 Original-Received: from [199.232.76.173] (port=51565 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnUJH-0001h9-RZ for emacs-devel@gnu.org; Tue, 15 Sep 2009 05:26:51 -0400 Original-Received: from mail-bw0-f220.google.com ([209.85.218.220]:45973) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MnUJC-0007YJ-ST; Tue, 15 Sep 2009 05:26:47 -0400 Original-Received: by bwz20 with SMTP id 20so2766475bwz.42 for ; Tue, 15 Sep 2009 02:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=zoelgEnF8DWu9BKBK1/1CwIKlFcyhzar0wX+7tQAVgE=; b=HpNhnVB3GcqcVOUbC/3ns8OXipP86fBNG+JGYylLk+s5pyAe+Kh6kXeGI0PydZPfKD df8+I8CuWb+HUqhmNvp3WEh7UBhygF6bo67Rx+c9O7c1Sh4XTZroGRR1Vg63XkyXH/Rg jUkso/pqHo93DNDZ3dy+quoYpBg0xhzwrM9pI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=gnSHZ7i+JzgbUI9gmdWye7PaU4LDiJM6UJlvRwbRzRfqaQDfBzjEv+rugL7kn7lHFh SyYjWKtmTAGf0JDInG6JHt7FqQJDTY8h0AC01Y5l7MCu+PNyT0CSpeIQwfk7a5mL2o7J lDjfYbjS1ZbIgge/8InzWlONXHdZaWmqSY+3E= Original-Received: by 10.239.179.101 with SMTP id c37mr717069hbg.4.1253006805079; Tue, 15 Sep 2009 02:26:45 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:115345 Archived-At: On Tue, Sep 15, 2009 at 03:31, Stefan Monnier wr= ote: > Thanks. =C2=A0The patch below should address this issue (it just moves co= de > around). After your patch, setting the variable in Lisp woks (see code below; it does not include X changes, only Windows). The only drawback is that, on Windows, environment variables (HOME, SHELL, TERM, LANG, PRELOAD_WINSOCK and a few others) can also be defined in the registry, and they are loaded in w32.c:init_environment(), so -Q will not affect them. That is bad, because it negates one of the advantages of this change, i.e., making emacs -Q more useful for testing. > Well, I'm not sure if it would be useful, but the name seems to reflect > more precisely the effect of the variable, and indeed it can later on > be changed from Lisp, tho it's not clear whether that would be useful. BTW, the question of whether "emacs -Q -xrm myresouce" should obey myresource or not is still open. Juanma diff --git a/lisp/startup.el b/lisp/startup.el index 72c185c..3ffc4b8 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -366,8 +366,6 @@ from being initialized." string) :group 'auto-save) -(defvar emacs-quick-startup nil) - (defvar emacs-basic-display nil) (defvar init-file-debug nil) @@ -799,7 +797,7 @@ opening the first frame (e.g. open a connection to an X server).") ((member argi '("-Q" "-quick")) (setq init-file-user nil site-run-file nil - emacs-quick-startup t)) + inhibit-x-resources t)) ((member argi '("-D" "-basic-display")) (setq no-blinking-cursor t emacs-basic-display t) @@ -2272,7 +2270,7 @@ A fancy display is used on graphic displays, normal otherwise." (if (or inhibit-startup-screen initial-buffer-choice noninteractive - emacs-quick-startup) + inhibit-x-resources) ;; Not displaying a startup screen. If 3 or more files ;; visited, and not all visible, show user what they all are. diff --git a/src/emacs.c b/src/emacs.c index 2c14be5..9538e3c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -239,6 +239,9 @@ int noninteractive; int noninteractive1; +/* Nonzero means Emacs was run in --quick mode. */ +int inhibit_x_resources; + /* Name for the server started by the daemon.*/ static char *daemon_name; @@ -1483,11 +1486,6 @@ main (int argc, char **argv) ns_no_defaults =3D 1; skip_args--; } - if (argmatch (argv, argc, "-Q", "--quick", 5, NULL, &skip_args)) - { - ns_no_defaults =3D 1; - skip_args--; - } #ifdef NS_IMPL_COCOA if (skip_args < argc) { @@ -2680,6 +2678,10 @@ was found. */); This is nil during initialization. */); Vafter_init_time =3D Qnil; + DEFVAR_BOOL ("inhibit-x-resources", &inhibit_x_resources, + doc: /* If non-nil, X resources and Windows Registry settings are not used. */); + inhibit_x_resources =3D 0; + /* Make sure IS_DAEMON starts up as false. */ daemon_pipe[1] =3D 0; } diff --git a/src/lisp.h b/src/lisp.h index 820c258..f837708 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3143,6 +3143,9 @@ void shut_down_emacs P_ ((int, int, Lisp_Object)); /* Nonzero means don't do interactive redisplay and don't change tty modes= */ extern int noninteractive; +/* Nonzero means don't load X resources or Windows Registry settings. */ +extern int inhibit_x_resources; + /* Pipe used to send exit notification to the daemon parent at startup. */ extern int daemon_pipe[2]; diff --git a/src/w32reg.c b/src/w32reg.c index d2330e7..e31fba0 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -150,6 +150,10 @@ x_get_string_resource (rdb, name, class) XrmDatabase rdb; char *name, *class; { + if (inhibit_x_resources) + /* --quick was passed, so this is a no-op. */ + return NULL; + if (rdb) { char *resource;