all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: David De La Harpe Golden <david@harpegolden.net>,
	Emacs developers <emacs-devel@gnu.org>,
	Miles Bader <miles@gnu.org>
Subject: Re: Not loading the Registry settings
Date: Tue, 15 Sep 2009 16:27:16 +0200	[thread overview]
Message-ID: <f7ccd24b0909150727v1118643dp929d414615e1309d@mail.gmail.com> (raw)
In-Reply-To: <jwvab0wl4f9.fsf-monnier+emacs@gnu.org>

On Tue, Sep 15, 2009 at 15:34, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> 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).  For HOME settings, I think it's TRT.  For other
> variables, it's less clear, but I think it's OK for now.

OK

> I think it *should* obey myresource.  I 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) <inhibit-x-resources>: 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 set
+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-history.

 ** 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 = 1;
           skip_args--;
         }
-      if (argmatch (argv, argc, "-Q", "--quick", 5, NULL, &skip_args))
-        {
-          ns_no_defaults = 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 = 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 = 0;
+
   /* Make sure IS_DAEMON starts up as false.  */
   daemon_pipe[1] = 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;




  reply	other threads:[~2009-09-15 14:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 11:45 Not loading the Registry settings Juanma Barranquero
2009-09-12 12:28 ` David De La Harpe Golden
2009-09-12 12:50   ` Adrian Robert
2009-09-12 14:22   ` Juanma Barranquero
2009-09-12 19:14     ` Stefan Monnier
2009-09-13  2:29       ` Miles Bader
2009-09-14  0:34         ` Juanma Barranquero
2009-09-14 13:29           ` Stefan Monnier
2009-09-14 13:48             ` Juanma Barranquero
2009-09-14 13:54               ` Juanma Barranquero
2009-09-14 21:53                 ` Stefan Monnier
2009-09-14 22:24                   ` Juanma Barranquero
2009-09-15  1:31                     ` Stefan Monnier
2009-09-15  9:26                       ` Juanma Barranquero
2009-09-15 13:34                         ` Stefan Monnier
2009-09-15 14:27                           ` Juanma Barranquero [this message]
2009-09-14 14:51               ` Adrian Robert
     [not found]               ` <jwv63bl5onb.fsf-monnier+emacs@gnu.org>
2009-09-14 19:39                 ` Adrian Robert
2009-09-17 23:09                   ` Juanma Barranquero

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0909150727v1118643dp929d414615e1309d@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=david@harpegolden.net \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.