* 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.

This commit is contained in:
Adrian Robert 2009-01-23 09:58:02 +00:00
parent b3243e6f1a
commit 3436b70cbe
4 changed files with 62 additions and 37 deletions

View file

@ -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)
{

View file

@ -2184,9 +2184,10 @@ and GNUstep implementations ("distributor-specific release
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));

View file

@ -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. */

View file

@ -151,9 +151,17 @@ Updated by Christian Limpach (chris@nice.ch)
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 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
/* 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 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
/* 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]