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 16:27:16 +0200 Message-ID: References: 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 1253024892 15631 80.91.229.12 (15 Sep 2009 14:28:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Sep 2009 14:28:12 +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 16:28:04 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 1MnZ0j-0004I0-HA for ged-emacs-devel@m.gmane.org; Tue, 15 Sep 2009 16:28:02 +0200 Original-Received: from localhost ([127.0.0.1]:58833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnZ0i-0001VQ-RT for ged-emacs-devel@m.gmane.org; Tue, 15 Sep 2009 10:28:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnZ0W-0001Sn-2z for emacs-devel@gnu.org; Tue, 15 Sep 2009 10:27:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnZ0Q-0001QX-83 for emacs-devel@gnu.org; Tue, 15 Sep 2009 10:27:46 -0400 Original-Received: from [199.232.76.173] (port=47799 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnZ0P-0001QR-PD for emacs-devel@gnu.org; Tue, 15 Sep 2009 10:27:41 -0400 Original-Received: from mail-bw0-f220.google.com ([209.85.218.220]:50446) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MnZ0N-0001Y1-Q4; Tue, 15 Sep 2009 10:27:40 -0400 Original-Received: by bwz20 with SMTP id 20so2960460bwz.42 for ; Tue, 15 Sep 2009 07:27:37 -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=QrWlcvPP30elS2ohib3A/QOeX8Sv46MRKGY+WFvx8iU=; b=V3IRTb7TVH/52VJYZxBbXyQVE81oubAEDyNARZflJotoWdIKp9zdRDhcQyYbZs5Taz 7LKqvjehKhv8jphsHazmmLBTCELaQygpIAGE+vffEYaQZiXgtsoikWDo7zjNrnBY6i4T GWi/km2BE8RfM1e50lG5qUN5eiZ6Ttvon63h0= 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=BF3bISwzPFXtOjskVkbm9s0Sv8YCI15uuGw6UXTanN4xd8NxIP43x0MM453nu4ofpL b0F/b3TIA+dnh6UabcK2Pc/hTI6WdhEmU8gSl54UM39ccCkpmfbaVF9DmoboeIBRAPnM 71auBm6F7EUdsq0a6RleF/JcqpU3cZHeFwQV8= Original-Received: by 10.239.134.226 with SMTP id a34mr720990hba.7.1253024856200; Tue, 15 Sep 2009 07:27:36 -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:115353 Archived-At: On Tue, Sep 15, 2009 at 15:34, Stefan Monnier wr= ote: > OTOH, it's just the same behavior as under POSIX where environment > variables are not provided via xrm but directly (and -Q does not > override them). =C2=A0For HOME settings, I think it's TRT. =C2=A0For othe= r > variables, it's less clear, but I think it's OK for now. OK > I think it *should* obey myresource. =C2=A0I don't know how to implement = that > behavior, tho. On Windows it is trivial, so I'll add it to my patch. OK, there it goes. I've added the "if (...) return" code to xrdb.c:x_get_string_resource, so I'd be glad if someone on GNU/Linux can test that it works as expected (or at least that it does nothing bad). Once that is verified and you've installed your startup.el patch, I can go on installing this and then Adrian can tweak for NextStep and the X integration can be ironed out. Juanma * NEWS: Mention new behavior of -Q and new variable `inhibit-x-resources'. * startup.el (emacs-quick-startup): Remove variable and all uses. (command-line): Set `inhibit-x-resources' instead. (command-line-1): Use `inhibit-x-resources' instead. * emacs.c (inhibit_x_resources): New variable. (main) [HAVE_NS]: Don't process --quick command line option. (syms_of_emacs) : DEFVAR_BOOL it. * lisp.h (inhibit_x_resources): Declare it extern. * w32reg.c (x_get_string_resource): * xrdb.c (x_get_string_resource): Obey inhibit_x_resources. diff --git a/etc/NEWS b/etc/NEWS index 3db3f53..9e3a2f8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -38,6 +38,11 @@ world-readable install. * Changes in Emacs 23.2 +** Command-line option -Q (--quick) now also disables loading X resources. +On Windows, Registry settings are ignored, though environment variables se= t +on the Registry are still honored. The new variable `inhibit-x-resources' +shows whether X resources were loaded or not. + ** New completion-style `initials' to complete M-x lch to list-command-his= tory. ** Unibyte sessions are declared obsolete. 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..2b5b352 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -76,7 +76,7 @@ w32_get_rdb_resource (rdb, resource) return NULL; } -LPBYTE +static LPBYTE w32_get_string_resource (name, class, dwexptype) char *name, *class; DWORD dwexptype; @@ -160,6 +160,10 @@ x_get_string_resource (rdb, name, class) return resource; } + if (inhibit_x_resources) + /* --quick was passed, so this is a no-op. */ + return NULL; + return (w32_get_string_resource (name, class, REG_SZ)); } diff --git a/src/xrdb.c b/src/xrdb.c index 0a74c08..fac97e4 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -693,6 +693,10 @@ x_get_string_resource (rdb, name, class) { XrmValue value; + if (inhibit_x_resources) + /* --quick was passed, so this is a no-op. */ + return NULL; + if (x_get_resource (rdb, name, class, x_rm_string, &value)) return (char *) value.addr;