From: Adrian Robert Date: Fri, 23 Jan 2009 09:58:02 +0000 (+0000) Subject: * emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defa... X-Git-Tag: emacs-pretest-23.0.90~268 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3436b70cbe074ecfdf378c53d3dbe3566afbd791;p=emacs.git * emacs.c (ns_no_defaults): New declaration. (main): Use it. * nsterm.h (ns_no_defaults): New declaration. * nsfns.m (x_get_string_resource): Don't read when ns_no_defaults. * nsterm.m (ns_no_defaults): New variable. (ns_initialize): Don't read defaults when ns_no_defaults. --- diff --git a/src/emacs.c b/src/emacs.c index df5e4cdeeb4..1b4872bf4c9 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -202,6 +202,10 @@ extern int inherited_pgroup; int display_arg; #endif +#ifdef HAVE_NS +extern char ns_no_defaults; +#endif + /* An address near the bottom of the stack. Tells GC how to save a copy of the stack. */ char *stack_bottom; @@ -1473,6 +1477,16 @@ main (int argc, char **argv) { char *tmp; display_arg = 4; + if (argmatch (argv, argc, "-q", "--no-init-file", 6, NULL, &skip_args)) + { + 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) { diff --git a/src/nsfns.m b/src/nsfns.m index 218674d864b..f3b80c11622 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2184,9 +2184,10 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class) toCheck = name + (!strncmp (name, "emacs.", 6) ? 6 : 0); /*fprintf (stderr, "Checking '%s'\n", toCheck); */ - - res = [[[NSUserDefaults standardUserDefaults] objectForKey: - [NSString stringWithUTF8String: toCheck]] UTF8String]; + + res = ns_no_defaults ? NULL : + [[[NSUserDefaults standardUserDefaults] objectForKey: + [NSString stringWithUTF8String: toCheck]] UTF8String]; return !res ? NULL : (!strncasecmp (res, "YES", 3) ? "true" : (!strncasecmp (res, "NO", 2) ? "false" : res)); diff --git a/src/nsterm.h b/src/nsterm.h index d1e4843adb3..781d312bafc 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -726,6 +726,7 @@ extern void nxatoms_of_nsselect (); extern int ns_lisp_to_cursor_type (); extern Lisp_Object ns_cursor_type_to_lisp (int arg); extern Lisp_Object Qnone; +extern char ns_no_defaults; /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but this causes an #include snafu, so we can't declare it. */ diff --git a/src/nsterm.m b/src/nsterm.m index 37322b11adc..2f8eccbe7e9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -151,9 +151,17 @@ extern Lisp_Object Qcursor_color, Qcursor_type, Qns; EmacsPrefsController *prefsController; -/* Defaults managed through the OpenStep defaults system. These pertain to - the NS interface specifically. Although a customization group could be - created, it's more natural to manage them via defaults. */ +/* Preferences equivalent to those set by X resources under X are managed + through the OpenStep defaults system. These pertain to behavior of the + graphical interface components. The one difference from X is that the + values below are SET when the user chooses save-options. This makes + things easier for users, but sometimes violates expectations when some + user-set options appear when running under -q/Q. Therefore we depart + from X behavior and refuse to read defaults when started under these + options. */ + +/* Set in emacs.c. */ +char ns_no_defaults; /* Specifies which emacs modifier should be generated when NS receives the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ @@ -3801,9 +3809,6 @@ ns_term_init (Lisp_Object display_name) /* Put it on ns_display_name_list */ ns_display_name_list = Fcons (Fcons (display_name, Qnil), ns_display_name_list); -/* ns_display_name_list = Fcons (Fcons (display_name, - Fcons (Qnil, dpyinfo->xrdb)), - ns_display_name_list); */ dpyinfo->name_list_element = XCAR (ns_display_name_list); /* Set the name of the terminal. */ @@ -3815,34 +3820,38 @@ ns_term_init (Lisp_Object display_name) /* Read various user defaults. */ ns_set_default_prefs (); - ns_default ("AlternateModifier", &ns_alternate_modifier, - Qnil, Qnil, NO, YES); - if (NILP (ns_alternate_modifier)) - ns_alternate_modifier = Qmeta; - ns_default ("CommandModifier", &ns_command_modifier, - Qnil, Qnil, NO, YES); - if (NILP (ns_command_modifier)) - ns_command_modifier = Qsuper; - ns_default ("ControlModifier", &ns_control_modifier, - Qnil, Qnil, NO, YES); - if (NILP (ns_control_modifier)) - ns_control_modifier = Qcontrol; - ns_default ("FunctionModifier", &ns_function_modifier, - Qnil, Qnil, NO, YES); - if (NILP (ns_function_modifier)) - ns_function_modifier = Qnone; - ns_default ("ExpandSpace", &ns_expand_space, - make_float (0.5), make_float (0.0), YES, NO); - ns_default ("GSFontAntiAlias", &ns_antialias_text, - Qt, Qnil, NO, NO); - tmp = Qnil; - ns_default ("AppleAntiAliasingThreshold", &tmp, - make_float (10.0), make_float (6.0), YES, NO); - ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); - ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, - Qt, Qnil, NO, NO); - ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, - Qt, Qnil, NO, NO); + if (!ns_no_defaults) + { + ns_default ("AlternateModifier", &ns_alternate_modifier, + Qnil, Qnil, NO, YES); + if (NILP (ns_alternate_modifier)) + ns_alternate_modifier = Qmeta; + ns_default ("CommandModifier", &ns_command_modifier, + Qnil, Qnil, NO, YES); + if (NILP (ns_command_modifier)) + ns_command_modifier = Qsuper; + ns_default ("ControlModifier", &ns_control_modifier, + Qnil, Qnil, NO, YES); + if (NILP (ns_control_modifier)) + ns_control_modifier = Qcontrol; + ns_default ("FunctionModifier", &ns_function_modifier, + Qnil, Qnil, NO, YES); + if (NILP (ns_function_modifier)) + ns_function_modifier = Qnone; + ns_default ("ExpandSpace", &ns_expand_space, + make_float (0.5), make_float (0.0), YES, NO); + ns_default ("GSFontAntiAlias", &ns_antialias_text, + Qt, Qnil, NO, NO); + tmp = Qnil; + ns_default ("AppleAntiAliasingThreshold", &tmp, + make_float (10.0), make_float (6.0), YES, NO); + ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); + ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, + Qt, Qnil, NO, NO); + ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, + Qt, Qnil, NO, NO); + } + if (EQ (ns_use_system_highlight_color, Qt)) { ns_selection_color = [[NSUserDefaults standardUserDefaults]