diff options
| author | Adrian Robert | 2009-01-23 09:58:02 +0000 |
|---|---|---|
| committer | Adrian Robert | 2009-01-23 09:58:02 +0000 |
| commit | 3436b70cbe074ecfdf378c53d3dbe3566afbd791 (patch) | |
| tree | 91f181b5de6a4637183d14f1682102ac3476d685 | |
| parent | b3243e6f1a45b2dc2dfda676332a0fd20d0e6e57 (diff) | |
| download | emacs-3436b70cbe074ecfdf378c53d3dbe3566afbd791.tar.gz emacs-3436b70cbe074ecfdf378c53d3dbe3566afbd791.zip | |
* 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.
| -rw-r--r-- | src/emacs.c | 14 | ||||
| -rw-r--r-- | src/nsfns.m | 7 | ||||
| -rw-r--r-- | src/nsterm.h | 1 | ||||
| -rw-r--r-- | src/nsterm.m | 77 |
4 files changed, 62 insertions, 37 deletions
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; | |||
| 202 | int display_arg; | 202 | int display_arg; |
| 203 | #endif | 203 | #endif |
| 204 | 204 | ||
| 205 | #ifdef HAVE_NS | ||
| 206 | extern char ns_no_defaults; | ||
| 207 | #endif | ||
| 208 | |||
| 205 | /* An address near the bottom of the stack. | 209 | /* An address near the bottom of the stack. |
| 206 | Tells GC how to save a copy of the stack. */ | 210 | Tells GC how to save a copy of the stack. */ |
| 207 | char *stack_bottom; | 211 | char *stack_bottom; |
| @@ -1473,6 +1477,16 @@ main (int argc, char **argv) | |||
| 1473 | { | 1477 | { |
| 1474 | char *tmp; | 1478 | char *tmp; |
| 1475 | display_arg = 4; | 1479 | display_arg = 4; |
| 1480 | if (argmatch (argv, argc, "-q", "--no-init-file", 6, NULL, &skip_args)) | ||
| 1481 | { | ||
| 1482 | ns_no_defaults = 1; | ||
| 1483 | skip_args--; | ||
| 1484 | } | ||
| 1485 | if (argmatch (argv, argc, "-Q", "--quick", 5, NULL, &skip_args)) | ||
| 1486 | { | ||
| 1487 | ns_no_defaults = 1; | ||
| 1488 | skip_args--; | ||
| 1489 | } | ||
| 1476 | #ifdef NS_IMPL_COCOA | 1490 | #ifdef NS_IMPL_COCOA |
| 1477 | if (skip_args < argc) | 1491 | if (skip_args < argc) |
| 1478 | { | 1492 | { |
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) | |||
| 2184 | toCheck = name + (!strncmp (name, "emacs.", 6) ? 6 : 0); | 2184 | toCheck = name + (!strncmp (name, "emacs.", 6) ? 6 : 0); |
| 2185 | 2185 | ||
| 2186 | /*fprintf (stderr, "Checking '%s'\n", toCheck); */ | 2186 | /*fprintf (stderr, "Checking '%s'\n", toCheck); */ |
| 2187 | 2187 | ||
| 2188 | res = [[[NSUserDefaults standardUserDefaults] objectForKey: | 2188 | res = ns_no_defaults ? NULL : |
| 2189 | [NSString stringWithUTF8String: toCheck]] UTF8String]; | 2189 | [[[NSUserDefaults standardUserDefaults] objectForKey: |
| 2190 | [NSString stringWithUTF8String: toCheck]] UTF8String]; | ||
| 2190 | return !res ? NULL : | 2191 | return !res ? NULL : |
| 2191 | (!strncasecmp (res, "YES", 3) ? "true" : | 2192 | (!strncasecmp (res, "YES", 3) ? "true" : |
| 2192 | (!strncasecmp (res, "NO", 2) ? "false" : res)); | 2193 | (!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 (); | |||
| 726 | extern int ns_lisp_to_cursor_type (); | 726 | extern int ns_lisp_to_cursor_type (); |
| 727 | extern Lisp_Object ns_cursor_type_to_lisp (int arg); | 727 | extern Lisp_Object ns_cursor_type_to_lisp (int arg); |
| 728 | extern Lisp_Object Qnone; | 728 | extern Lisp_Object Qnone; |
| 729 | extern char ns_no_defaults; | ||
| 729 | 730 | ||
| 730 | /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but | 731 | /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but |
| 731 | this causes an #include snafu, so we can't declare it. */ | 732 | 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; | |||
| 151 | 151 | ||
| 152 | EmacsPrefsController *prefsController; | 152 | EmacsPrefsController *prefsController; |
| 153 | 153 | ||
| 154 | /* Defaults managed through the OpenStep defaults system. These pertain to | 154 | /* Preferences equivalent to those set by X resources under X are managed |
| 155 | the NS interface specifically. Although a customization group could be | 155 | through the OpenStep defaults system. These pertain to behavior of the |
| 156 | created, it's more natural to manage them via defaults. */ | 156 | graphical interface components. The one difference from X is that the |
| 157 | values below are SET when the user chooses save-options. This makes | ||
| 158 | things easier for users, but sometimes violates expectations when some | ||
| 159 | user-set options appear when running under -q/Q. Therefore we depart | ||
| 160 | from X behavior and refuse to read defaults when started under these | ||
| 161 | options. */ | ||
| 162 | |||
| 163 | /* Set in emacs.c. */ | ||
| 164 | char ns_no_defaults; | ||
| 157 | 165 | ||
| 158 | /* Specifies which emacs modifier should be generated when NS receives | 166 | /* Specifies which emacs modifier should be generated when NS receives |
| 159 | the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ | 167 | the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ |
| @@ -3801,9 +3809,6 @@ ns_term_init (Lisp_Object display_name) | |||
| 3801 | /* Put it on ns_display_name_list */ | 3809 | /* Put it on ns_display_name_list */ |
| 3802 | ns_display_name_list = Fcons (Fcons (display_name, Qnil), | 3810 | ns_display_name_list = Fcons (Fcons (display_name, Qnil), |
| 3803 | ns_display_name_list); | 3811 | ns_display_name_list); |
| 3804 | /* ns_display_name_list = Fcons (Fcons (display_name, | ||
| 3805 | Fcons (Qnil, dpyinfo->xrdb)), | ||
| 3806 | ns_display_name_list); */ | ||
| 3807 | dpyinfo->name_list_element = XCAR (ns_display_name_list); | 3812 | dpyinfo->name_list_element = XCAR (ns_display_name_list); |
| 3808 | 3813 | ||
| 3809 | /* Set the name of the terminal. */ | 3814 | /* Set the name of the terminal. */ |
| @@ -3815,34 +3820,38 @@ ns_term_init (Lisp_Object display_name) | |||
| 3815 | 3820 | ||
| 3816 | /* Read various user defaults. */ | 3821 | /* Read various user defaults. */ |
| 3817 | ns_set_default_prefs (); | 3822 | ns_set_default_prefs (); |
| 3818 | ns_default ("AlternateModifier", &ns_alternate_modifier, | 3823 | if (!ns_no_defaults) |
| 3819 | Qnil, Qnil, NO, YES); | 3824 | { |
| 3820 | if (NILP (ns_alternate_modifier)) | 3825 | ns_default ("AlternateModifier", &ns_alternate_modifier, |
| 3821 | ns_alternate_modifier = Qmeta; | 3826 | Qnil, Qnil, NO, YES); |
| 3822 | ns_default ("CommandModifier", &ns_command_modifier, | 3827 | if (NILP (ns_alternate_modifier)) |
| 3823 | Qnil, Qnil, NO, YES); | 3828 | ns_alternate_modifier = Qmeta; |
| 3824 | if (NILP (ns_command_modifier)) | 3829 | ns_default ("CommandModifier", &ns_command_modifier, |
| 3825 | ns_command_modifier = Qsuper; | 3830 | Qnil, Qnil, NO, YES); |
| 3826 | ns_default ("ControlModifier", &ns_control_modifier, | 3831 | if (NILP (ns_command_modifier)) |
| 3827 | Qnil, Qnil, NO, YES); | 3832 | ns_command_modifier = Qsuper; |
| 3828 | if (NILP (ns_control_modifier)) | 3833 | ns_default ("ControlModifier", &ns_control_modifier, |
| 3829 | ns_control_modifier = Qcontrol; | 3834 | Qnil, Qnil, NO, YES); |
| 3830 | ns_default ("FunctionModifier", &ns_function_modifier, | 3835 | if (NILP (ns_control_modifier)) |
| 3831 | Qnil, Qnil, NO, YES); | 3836 | ns_control_modifier = Qcontrol; |
| 3832 | if (NILP (ns_function_modifier)) | 3837 | ns_default ("FunctionModifier", &ns_function_modifier, |
| 3833 | ns_function_modifier = Qnone; | 3838 | Qnil, Qnil, NO, YES); |
| 3834 | ns_default ("ExpandSpace", &ns_expand_space, | 3839 | if (NILP (ns_function_modifier)) |
| 3835 | make_float (0.5), make_float (0.0), YES, NO); | 3840 | ns_function_modifier = Qnone; |
| 3836 | ns_default ("GSFontAntiAlias", &ns_antialias_text, | 3841 | ns_default ("ExpandSpace", &ns_expand_space, |
| 3837 | Qt, Qnil, NO, NO); | 3842 | make_float (0.5), make_float (0.0), YES, NO); |
| 3838 | tmp = Qnil; | 3843 | ns_default ("GSFontAntiAlias", &ns_antialias_text, |
| 3839 | ns_default ("AppleAntiAliasingThreshold", &tmp, | 3844 | Qt, Qnil, NO, NO); |
| 3840 | make_float (10.0), make_float (6.0), YES, NO); | 3845 | tmp = Qnil; |
| 3841 | ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); | 3846 | ns_default ("AppleAntiAliasingThreshold", &tmp, |
| 3842 | ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, | 3847 | make_float (10.0), make_float (6.0), YES, NO); |
| 3843 | Qt, Qnil, NO, NO); | 3848 | ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); |
| 3844 | ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, | 3849 | ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, |
| 3845 | Qt, Qnil, NO, NO); | 3850 | Qt, Qnil, NO, NO); |
| 3851 | ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, | ||
| 3852 | Qt, Qnil, NO, NO); | ||
| 3853 | } | ||
| 3854 | |||
| 3846 | if (EQ (ns_use_system_highlight_color, Qt)) | 3855 | if (EQ (ns_use_system_highlight_color, Qt)) |
| 3847 | { | 3856 | { |
| 3848 | ns_selection_color = [[NSUserDefaults standardUserDefaults] | 3857 | ns_selection_color = [[NSUserDefaults standardUserDefaults] |