diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 53 | ||||
| -rw-r--r-- | src/fileio.c | 21 | ||||
| -rw-r--r-- | src/xfns.c | 139 | ||||
| -rw-r--r-- | src/xmenu.c | 43 |
4 files changed, 169 insertions, 87 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 24db3a9c55a..b09d6ccdad9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,32 @@ | |||
| 1 | 2005-03-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * xmenu.c (ENCODE_MENU_STRING): Explicitly use string_make_unibyte. | ||
| 4 | (list_of_panes, list_of_items, Fx_popup_menu): Use XCAR/XCDR. | ||
| 5 | (digest_single_submenu, xmenu_show): Use ENCODE_MENU_STRING. | ||
| 6 | |||
| 7 | * xfns.c (xic_defaut_fontset): New constant. | ||
| 8 | (xic_create_fontsetname): New function. | ||
| 9 | Extracted from create_frame_xic. Try to generate a slightly | ||
| 10 | better fontset. | ||
| 11 | (xic_create_xfontset): Use it. | ||
| 12 | (create_frame_xic): Simplify. | ||
| 13 | |||
| 14 | 2005-03-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 15 | |||
| 16 | * fileio.c (Fmake_symbolic_link): Fix last change. | ||
| 17 | |||
| 18 | 2005-03-11 Richard M. Stallman <rms@gnu.org> | ||
| 19 | |||
| 20 | * fileio.c (Frename_file, Fadd_name_to_file) | ||
| 21 | (Fmake_symbolic_link): If NEWNAME or LINKNAME is a directory, | ||
| 22 | expand the basename of FILE relative to it. | ||
| 23 | |||
| 24 | 2005-03-11 Kenichi Handa <handa@m17n.org> | ||
| 25 | |||
| 26 | * fileio.c (Finsert_file_contents): Call Fcheck_coding_system | ||
| 27 | before calling setup_coding_system so that autoloading of a coding | ||
| 28 | system work. | ||
| 29 | |||
| 1 | 2005-03-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 30 | 2005-03-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 31 | ||
| 3 | * xfns.c (hourglass_started): New function. | 32 | * xfns.c (hourglass_started): New function. |
| @@ -20,8 +49,7 @@ | |||
| 20 | available font is found. | 49 | available font is found. |
| 21 | 50 | ||
| 22 | * fontset.c (set_default_ascii_font): New function. | 51 | * fontset.c (set_default_ascii_font): New function. |
| 23 | (syms_of_fontset): Don't set FONTSET_ASCII (Vdefault_fontset) | 52 | (syms_of_fontset): Don't set FONTSET_ASCII (Vdefault_fontset) here. |
| 24 | here. | ||
| 25 | 53 | ||
| 26 | * fontset.h (set_default_ascii_font): Extern it. | 54 | * fontset.h (set_default_ascii_font): Extern it. |
| 27 | 55 | ||
| @@ -82,13 +110,11 @@ | |||
| 82 | * emacs.c (main): Change `#ifdef HAVE_CARBON' to `#if | 110 | * emacs.c (main): Change `#ifdef HAVE_CARBON' to `#if |
| 83 | defined (MAC_OSX) && defined (HAVE_CARBON)'. | 111 | defined (MAC_OSX) && defined (HAVE_CARBON)'. |
| 84 | 112 | ||
| 85 | * image.c [!MAC_OSX && TARGET_API_MAC_CARBON]: Include | 113 | * image.c [!MAC_OSX && TARGET_API_MAC_CARBON]: Include QuickTime.h. |
| 86 | QuickTime.h. | ||
| 87 | 114 | ||
| 88 | * mac.c [!MAC_OSX && HAVE_CARBON]: Include Carbon.h. | 115 | * mac.c [!MAC_OSX && HAVE_CARBON]: Include Carbon.h. |
| 89 | [!MAC_OSX] (select) [TARGET_API_MAC_CARBON]: Use ReceiveNextEvent. | 116 | [!MAC_OSX] (select) [TARGET_API_MAC_CARBON]: Use ReceiveNextEvent. |
| 90 | (posix_pathname_to_fsspec, fsspec_to_posix_pathname): New | 117 | (posix_pathname_to_fsspec, fsspec_to_posix_pathname): New functions. |
| 91 | functions. | ||
| 92 | (mac_clear_font_name_table): Move extern to macterm.h. | 118 | (mac_clear_font_name_table): Move extern to macterm.h. |
| 93 | 119 | ||
| 94 | * macfns.c (install_window_handler): Move extern to macterm.h. | 120 | * macfns.c (install_window_handler): Move extern to macterm.h. |
| @@ -96,16 +122,15 @@ | |||
| 96 | valid. Don't check !NILP (dir) because it is already checked with | 122 | valid. Don't check !NILP (dir) because it is already checked with |
| 97 | CHECK_STRING. | 123 | CHECK_STRING. |
| 98 | (Fx_file_dialog) [!MAC_OSX]: Use FSSpec instead of FSRef for | 124 | (Fx_file_dialog) [!MAC_OSX]: Use FSSpec instead of FSRef for |
| 99 | specifying the default location and obtaining the selected | 125 | specifying the default location and obtaining the selected filename. |
| 100 | filename. | ||
| 101 | 126 | ||
| 102 | * macgui.h [!MAC_OSX && HAVE_CARBON]: Include Carbon.h. | 127 | * macgui.h [!MAC_OSX && HAVE_CARBON]: Include Carbon.h. |
| 103 | 128 | ||
| 104 | * macmenu.c [TARGET_API_MAC_CARBON]: Don't include headers that | 129 | * macmenu.c [TARGET_API_MAC_CARBON]: Don't include headers that |
| 105 | are included via Carbon.h. | 130 | are included via Carbon.h. |
| 106 | 131 | ||
| 107 | * macterm.c [TARGET_API_MAC_CARBON && !MAC_OSX]: Define | 132 | * macterm.c [TARGET_API_MAC_CARBON && !MAC_OSX]: |
| 108 | USE_CARBON_EVENTS to 1. | 133 | Define USE_CARBON_EVENTS to 1. |
| 109 | (qd) [__MRC__ && TARGET_API_MAC_CARBON]: Don't declare. | 134 | (qd) [__MRC__ && TARGET_API_MAC_CARBON]: Don't declare. |
| 110 | (x_free_frame_resources): Call remove_window_handler for | 135 | (x_free_frame_resources): Call remove_window_handler for |
| 111 | non-tooltip windows. | 136 | non-tooltip windows. |
| @@ -118,12 +143,12 @@ | |||
| 118 | (install_window_handler) [TARGET_API_MAC_CARBON]: Create UPPs for | 143 | (install_window_handler) [TARGET_API_MAC_CARBON]: Create UPPs for |
| 119 | drag-and-drop handler functions and register them. | 144 | drag-and-drop handler functions and register them. |
| 120 | (remove_window_handler): New function. | 145 | (remove_window_handler): New function. |
| 121 | (do_ae_open_documents, mac_do_receive_drag) [!MAC_OSX]: Use | 146 | (do_ae_open_documents, mac_do_receive_drag) [!MAC_OSX]: |
| 122 | fsspec_to_posix_pathname. | 147 | Use fsspec_to_posix_pathname. |
| 123 | (main): Change #if !TARGET_API_MAC_CARBON to #ifdef MAC_OS8. | 148 | (main): Change #if !TARGET_API_MAC_CARBON to #ifdef MAC_OS8. |
| 124 | (XTread_socket) [!MAC_OSX]: Don't pass keyboard events to TSM. | 149 | (XTread_socket) [!MAC_OSX]: Don't pass keyboard events to TSM. |
| 125 | [MAC_OS8] (make_mac_terminal_frame) [TARGET_API_MAC_CARBON]: Set | 150 | [MAC_OS8] (make_mac_terminal_frame) [TARGET_API_MAC_CARBON]: |
| 126 | default cursors. | 151 | Set default cursors. |
| 127 | (mac_initialize) [USE_CARBON_EVENTS && !MAC_OSX] : Don't call | 152 | (mac_initialize) [USE_CARBON_EVENTS && !MAC_OSX] : Don't call |
| 128 | init_service_handler or init_quit_char_handler. | 153 | init_service_handler or init_quit_char_handler. |
| 129 | (mac_initialize) [!MAC_OSX]: Don't call MakeMeTheFrontProcess. | 154 | (mac_initialize) [!MAC_OSX]: Don't call MakeMeTheFrontProcess. |
diff --git a/src/fileio.c b/src/fileio.c index db511aad887..c62c1e88042 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* File IO for GNU Emacs. | 1 | /* File IO for GNU Emacs. |
| 2 | Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, | 2 | Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, |
| 3 | 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. | 3 | 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -2696,7 +2696,11 @@ This is what happens in interactive use with M-x. */) | |||
| 2696 | CHECK_STRING (file); | 2696 | CHECK_STRING (file); |
| 2697 | CHECK_STRING (newname); | 2697 | CHECK_STRING (newname); |
| 2698 | file = Fexpand_file_name (file, Qnil); | 2698 | file = Fexpand_file_name (file, Qnil); |
| 2699 | newname = Fexpand_file_name (newname, Qnil); | 2699 | |
| 2700 | if (!NILP (Ffile_directory_p (newname))) | ||
| 2701 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); | ||
| 2702 | else | ||
| 2703 | newname = Fexpand_file_name (newname, Qnil); | ||
| 2700 | 2704 | ||
| 2701 | /* If the file name has special constructs in it, | 2705 | /* If the file name has special constructs in it, |
| 2702 | call the corresponding file handler. */ | 2706 | call the corresponding file handler. */ |
| @@ -2779,7 +2783,11 @@ This is what happens in interactive use with M-x. */) | |||
| 2779 | CHECK_STRING (file); | 2783 | CHECK_STRING (file); |
| 2780 | CHECK_STRING (newname); | 2784 | CHECK_STRING (newname); |
| 2781 | file = Fexpand_file_name (file, Qnil); | 2785 | file = Fexpand_file_name (file, Qnil); |
| 2782 | newname = Fexpand_file_name (newname, Qnil); | 2786 | |
| 2787 | if (!NILP (Ffile_directory_p (newname))) | ||
| 2788 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); | ||
| 2789 | else | ||
| 2790 | newname = Fexpand_file_name (newname, Qnil); | ||
| 2783 | 2791 | ||
| 2784 | /* If the file name has special constructs in it, | 2792 | /* If the file name has special constructs in it, |
| 2785 | call the corresponding file handler. */ | 2793 | call the corresponding file handler. */ |
| @@ -2846,7 +2854,11 @@ This happens for interactive use with M-x. */) | |||
| 2846 | we want to permit links to relative file names. */ | 2854 | we want to permit links to relative file names. */ |
| 2847 | if (SREF (filename, 0) == '~') | 2855 | if (SREF (filename, 0) == '~') |
| 2848 | filename = Fexpand_file_name (filename, Qnil); | 2856 | filename = Fexpand_file_name (filename, Qnil); |
| 2849 | linkname = Fexpand_file_name (linkname, Qnil); | 2857 | |
| 2858 | if (!NILP (Ffile_directory_p (linkname))) | ||
| 2859 | linkname = Fexpand_file_name (Ffile_name_nondirectory (filename), linkname); | ||
| 2860 | else | ||
| 2861 | linkname = Fexpand_file_name (linkname, Qnil); | ||
| 2850 | 2862 | ||
| 2851 | /* If the file name has special constructs in it, | 2863 | /* If the file name has special constructs in it, |
| 2852 | call the corresponding file handler. */ | 2864 | call the corresponding file handler. */ |
| @@ -4508,7 +4520,6 @@ actually used. */) | |||
| 4508 | if (CONSP (coding_system)) | 4520 | if (CONSP (coding_system)) |
| 4509 | coding_system = XCAR (coding_system); | 4521 | coding_system = XCAR (coding_system); |
| 4510 | } | 4522 | } |
| 4511 | |||
| 4512 | unbind_to (count, Qnil); | 4523 | unbind_to (count, Qnil); |
| 4513 | inserted = Z_BYTE - BEG_BYTE; | 4524 | inserted = Z_BYTE - BEG_BYTE; |
| 4514 | } | 4525 | } |
diff --git a/src/xfns.c b/src/xfns.c index c45845e00ce..0522fc4137e 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1939,6 +1939,88 @@ static XIMStyle supported_xim_styles[] = | |||
| 1939 | 1939 | ||
| 1940 | /* Create an X fontset on frame F with base font name BASE_FONTNAME. */ | 1940 | /* Create an X fontset on frame F with base font name BASE_FONTNAME. */ |
| 1941 | 1941 | ||
| 1942 | char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; | ||
| 1943 | |||
| 1944 | char * | ||
| 1945 | xic_create_fontsetname (base_fontname) | ||
| 1946 | char *base_fontname; | ||
| 1947 | { | ||
| 1948 | /* Make a fontset name from the base font name. */ | ||
| 1949 | if (xic_defaut_fontset == base_fontname) | ||
| 1950 | /* There is no base font name, use the default. */ | ||
| 1951 | return base_fontname; | ||
| 1952 | else | ||
| 1953 | { | ||
| 1954 | /* Make a fontset name from the base font name. | ||
| 1955 | The font set will be made of the following elements: | ||
| 1956 | - the base font. | ||
| 1957 | - the base font where the charset spec is replaced by -*-*. | ||
| 1958 | - the same but with the family also replaced with -*-*-. */ | ||
| 1959 | char *p = base_fontname; | ||
| 1960 | char *fontsetname; | ||
| 1961 | int i; | ||
| 1962 | |||
| 1963 | for (i = 0; *p; p++) | ||
| 1964 | if (*p == '-') i++; | ||
| 1965 | if (i != 14) | ||
| 1966 | { /* As the font name doesn't conform to XLFD, we can't | ||
| 1967 | modify it to generalize it to allcs and allfamilies. | ||
| 1968 | Use the specified font plus the default. */ | ||
| 1969 | int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 2; | ||
| 1970 | fontsetname = xmalloc (len); | ||
| 1971 | bzero (fontsetname, len); | ||
| 1972 | strcpy (fontsetname, base_fontname); | ||
| 1973 | strcat (fontsetname, ","); | ||
| 1974 | strcat (fontsetname, xic_defaut_fontset); | ||
| 1975 | } | ||
| 1976 | else | ||
| 1977 | { | ||
| 1978 | int len; | ||
| 1979 | char *p1 = NULL; | ||
| 1980 | char *font_allcs = NULL; | ||
| 1981 | char *font_allfamilies = NULL; | ||
| 1982 | char *allcs = "*-*-*-*-*-*-*"; | ||
| 1983 | char *allfamilies = "-*-*-"; | ||
| 1984 | |||
| 1985 | for (i = 0, p = base_fontname; i < 8; p++) | ||
| 1986 | { | ||
| 1987 | if (*p == '-') | ||
| 1988 | { | ||
| 1989 | i++; | ||
| 1990 | if (i == 3) | ||
| 1991 | p1 = p + 1; | ||
| 1992 | } | ||
| 1993 | } | ||
| 1994 | /* Build the font spec that matches all charsets. */ | ||
| 1995 | len = p - base_fontname + strlen (allcs) + 1; | ||
| 1996 | font_allcs = (char *) alloca (len); | ||
| 1997 | bzero (font_allcs, len); | ||
| 1998 | bcopy (base_fontname, font_allcs, p - base_fontname); | ||
| 1999 | strcat (font_allcs, allcs); | ||
| 2000 | |||
| 2001 | /* Build the font spec that matches all families. */ | ||
| 2002 | len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; | ||
| 2003 | font_allfamilies = (char *) alloca (len); | ||
| 2004 | bzero (font_allfamilies, len); | ||
| 2005 | strcpy (font_allfamilies, allfamilies); | ||
| 2006 | bcopy (p1, font_allfamilies + (strlen (allfamilies)), p - p1); | ||
| 2007 | strcat (font_allfamilies, allcs); | ||
| 2008 | |||
| 2009 | /* Build the actual font set name. */ | ||
| 2010 | len = strlen (base_fontname) + strlen (font_allcs) | ||
| 2011 | + strlen (font_allfamilies) + 3; | ||
| 2012 | fontsetname = xmalloc (len); | ||
| 2013 | bzero (fontsetname, len); | ||
| 2014 | strcpy (fontsetname, base_fontname); | ||
| 2015 | strcat (fontsetname, ","); | ||
| 2016 | strcat (fontsetname, font_allcs); | ||
| 2017 | strcat (fontsetname, ","); | ||
| 2018 | strcat (fontsetname, font_allfamilies); | ||
| 2019 | } | ||
| 2020 | return fontsetname; | ||
| 2021 | } | ||
| 2022 | } | ||
| 2023 | |||
| 1942 | static XFontSet | 2024 | static XFontSet |
| 1943 | xic_create_xfontset (f, base_fontname) | 2025 | xic_create_xfontset (f, base_fontname) |
| 1944 | struct frame *f; | 2026 | struct frame *f; |
| @@ -1950,6 +2032,9 @@ xic_create_xfontset (f, base_fontname) | |||
| 1950 | char *def_string; | 2032 | char *def_string; |
| 1951 | Lisp_Object rest, frame; | 2033 | Lisp_Object rest, frame; |
| 1952 | 2034 | ||
| 2035 | if (!base_fontname) | ||
| 2036 | base_fontname = xic_defaut_fontset; | ||
| 2037 | |||
| 1953 | /* See if there is another frame already using same fontset. */ | 2038 | /* See if there is another frame already using same fontset. */ |
| 1954 | FOR_EACH_FRAME (rest, frame) | 2039 | FOR_EACH_FRAME (rest, frame) |
| 1955 | { | 2040 | { |
| @@ -1966,12 +2051,16 @@ xic_create_xfontset (f, base_fontname) | |||
| 1966 | 2051 | ||
| 1967 | if (!xfs) | 2052 | if (!xfs) |
| 1968 | { | 2053 | { |
| 2054 | char *fontsetname = xic_create_fontsetname (base_fontname); | ||
| 2055 | |||
| 1969 | /* New fontset. */ | 2056 | /* New fontset. */ |
| 1970 | xfs = XCreateFontSet (FRAME_X_DISPLAY (f), | 2057 | xfs = XCreateFontSet (FRAME_X_DISPLAY (f), |
| 1971 | base_fontname, &missing_list, | 2058 | fontsetname, &missing_list, |
| 1972 | &missing_count, &def_string); | 2059 | &missing_count, &def_string); |
| 1973 | if (missing_list) | 2060 | if (missing_list) |
| 1974 | XFreeStringList (missing_list); | 2061 | XFreeStringList (missing_list); |
| 2062 | if (fontsetname != base_fontname) | ||
| 2063 | xfree (fontsetname); | ||
| 1975 | } | 2064 | } |
| 1976 | 2065 | ||
| 1977 | if (FRAME_XIC_BASE_FONTNAME (f)) | 2066 | if (FRAME_XIC_BASE_FONTNAME (f)) |
| @@ -2053,6 +2142,11 @@ create_frame_xic (f) | |||
| 2053 | if (FRAME_XIC (f)) | 2142 | if (FRAME_XIC (f)) |
| 2054 | return; | 2143 | return; |
| 2055 | 2144 | ||
| 2145 | /* Create X fontset. */ | ||
| 2146 | xfs = xic_create_xfontset | ||
| 2147 | (f, (FRAME_FONTSET (f) < 0) ? NULL | ||
| 2148 | : (char *) SDATA (fontset_ascii (FRAME_FONTSET (f)))); | ||
| 2149 | |||
| 2056 | xim = FRAME_X_XIM (f); | 2150 | xim = FRAME_X_XIM (f); |
| 2057 | if (xim) | 2151 | if (xim) |
| 2058 | { | 2152 | { |
| @@ -2060,52 +2154,9 @@ create_frame_xic (f) | |||
| 2060 | XPoint spot; | 2154 | XPoint spot; |
| 2061 | XVaNestedList preedit_attr; | 2155 | XVaNestedList preedit_attr; |
| 2062 | XVaNestedList status_attr; | 2156 | XVaNestedList status_attr; |
| 2063 | char *base_fontname; | ||
| 2064 | int fontset; | ||
| 2065 | 2157 | ||
| 2066 | s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1; | 2158 | s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1; |
| 2067 | spot.x = 0; spot.y = 1; | 2159 | spot.x = 0; spot.y = 1; |
| 2068 | /* Create X fontset. */ | ||
| 2069 | fontset = FRAME_FONTSET (f); | ||
| 2070 | if (fontset < 0) | ||
| 2071 | base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; | ||
| 2072 | else | ||
| 2073 | { | ||
| 2074 | /* Determine the base fontname from the ASCII font name of | ||
| 2075 | FONTSET. */ | ||
| 2076 | char *ascii_font = (char *) SDATA (fontset_ascii (fontset)); | ||
| 2077 | char *p = ascii_font; | ||
| 2078 | int i; | ||
| 2079 | |||
| 2080 | for (i = 0; *p; p++) | ||
| 2081 | if (*p == '-') i++; | ||
| 2082 | if (i != 14) | ||
| 2083 | /* As the font name doesn't conform to XLFD, we can't | ||
| 2084 | modify it to get a suitable base fontname for the | ||
| 2085 | frame. */ | ||
| 2086 | base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; | ||
| 2087 | else | ||
| 2088 | { | ||
| 2089 | int len = strlen (ascii_font) + 1; | ||
| 2090 | char *p1 = NULL; | ||
| 2091 | |||
| 2092 | for (i = 0, p = ascii_font; i < 8; p++) | ||
| 2093 | { | ||
| 2094 | if (*p == '-') | ||
| 2095 | { | ||
| 2096 | i++; | ||
| 2097 | if (i == 3) | ||
| 2098 | p1 = p + 1; | ||
| 2099 | } | ||
| 2100 | } | ||
| 2101 | base_fontname = (char *) alloca (len); | ||
| 2102 | bzero (base_fontname, len); | ||
| 2103 | strcpy (base_fontname, "-*-*-"); | ||
| 2104 | bcopy (p1, base_fontname + 5, p - p1); | ||
| 2105 | strcat (base_fontname, "*-*-*-*-*-*-*"); | ||
| 2106 | } | ||
| 2107 | } | ||
| 2108 | xfs = xic_create_xfontset (f, base_fontname); | ||
| 2109 | 2160 | ||
| 2110 | /* Determine XIC style. */ | 2161 | /* Determine XIC style. */ |
| 2111 | if (xic_style == 0) | 2162 | if (xic_style == 0) |
diff --git a/src/xmenu.c b/src/xmenu.c index e98ee7534a4..07d6fe3d730 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* X Communication module for terminals which understand the X protocol. | 1 | /* X Communication module for terminals which understand the X protocol. |
| 2 | Copyright (C) 1986, 1988, 1993, 1994, 1996, 1999, 2000, 2001, 2003, 2004 | 2 | Copyright (C) 1986, 1988, 1993, 1994, 1996, 1999, 2000, 2001, 2003, 2004, |
| 3 | Free Software Foundation, Inc. | 3 | 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -138,12 +138,7 @@ static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | |||
| 138 | /* gtk just uses utf-8. */ | 138 | /* gtk just uses utf-8. */ |
| 139 | # define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) | 139 | # define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) |
| 140 | #else | 140 | #else |
| 141 | /* I'm not convinced ENCODE_SYSTEM is defined correctly, or maybe | 141 | # define ENCODE_MENU_STRING(str) string_make_unibyte (str) |
| 142 | something else should be used here. Except under MS-Windows it | ||
| 143 | just converts to unibyte, but encoding with `locale-coding-system' | ||
| 144 | seems better -- X may actually display the result correctly, and | ||
| 145 | it's not necessarily equivalent to the unibyte text. -- fx */ | ||
| 146 | # define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str) | ||
| 147 | #endif | 142 | #endif |
| 148 | 143 | ||
| 149 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 144 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| @@ -645,10 +640,10 @@ list_of_panes (menu) | |||
| 645 | 640 | ||
| 646 | init_menu_items (); | 641 | init_menu_items (); |
| 647 | 642 | ||
| 648 | for (tail = menu; !NILP (tail); tail = Fcdr (tail)) | 643 | for (tail = menu; CONSP (tail); tail = XCDR (tail)) |
| 649 | { | 644 | { |
| 650 | Lisp_Object elt, pane_name, pane_data; | 645 | Lisp_Object elt, pane_name, pane_data; |
| 651 | elt = Fcar (tail); | 646 | elt = XCAR (tail); |
| 652 | pane_name = Fcar (elt); | 647 | pane_name = Fcar (elt); |
| 653 | CHECK_STRING (pane_name); | 648 | CHECK_STRING (pane_name); |
| 654 | push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil); | 649 | push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil); |
| @@ -668,22 +663,22 @@ list_of_items (pane) | |||
| 668 | { | 663 | { |
| 669 | Lisp_Object tail, item, item1; | 664 | Lisp_Object tail, item, item1; |
| 670 | 665 | ||
| 671 | for (tail = pane; !NILP (tail); tail = Fcdr (tail)) | 666 | for (tail = pane; CONSP (tail); tail = XCDR (tail)) |
| 672 | { | 667 | { |
| 673 | item = Fcar (tail); | 668 | item = XCAR (tail); |
| 674 | if (STRINGP (item)) | 669 | if (STRINGP (item)) |
| 675 | push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt, | 670 | push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt, |
| 676 | Qnil, Qnil, Qnil, Qnil); | 671 | Qnil, Qnil, Qnil, Qnil); |
| 677 | else if (NILP (item)) | 672 | else if (CONSP (item)) |
| 678 | push_left_right_boundary (); | ||
| 679 | else | ||
| 680 | { | 673 | { |
| 681 | CHECK_CONS (item); | 674 | item1 = XCAR (item); |
| 682 | item1 = Fcar (item); | ||
| 683 | CHECK_STRING (item1); | 675 | CHECK_STRING (item1); |
| 684 | push_menu_item (ENCODE_MENU_STRING (item1), Qt, Fcdr (item), | 676 | push_menu_item (ENCODE_MENU_STRING (item1), Qt, XCDR (item), |
| 685 | Qt, Qnil, Qnil, Qnil, Qnil); | 677 | Qt, Qnil, Qnil, Qnil, Qnil); |
| 686 | } | 678 | } |
| 679 | else | ||
| 680 | push_left_right_boundary (); | ||
| 681 | |||
| 687 | } | 682 | } |
| 688 | } | 683 | } |
| 689 | 684 | ||
| @@ -802,8 +797,8 @@ cached information about equivalent key sequences. */) | |||
| 802 | if (CONSP (tem)) | 797 | if (CONSP (tem)) |
| 803 | { | 798 | { |
| 804 | window = Fcar (Fcdr (position)); | 799 | window = Fcar (Fcdr (position)); |
| 805 | x = Fcar (tem); | 800 | x = XCAR (tem); |
| 806 | y = Fcar (Fcdr (tem)); | 801 | y = Fcar (XCDR (tem)); |
| 807 | } | 802 | } |
| 808 | else | 803 | else |
| 809 | { | 804 | { |
| @@ -931,11 +926,11 @@ cached information about equivalent key sequences. */) | |||
| 931 | 926 | ||
| 932 | /* The first keymap that has a prompt string | 927 | /* The first keymap that has a prompt string |
| 933 | supplies the menu title. */ | 928 | supplies the menu title. */ |
| 934 | for (tem = menu, i = 0; CONSP (tem); tem = Fcdr (tem)) | 929 | for (tem = menu, i = 0; CONSP (tem); tem = XCDR (tem)) |
| 935 | { | 930 | { |
| 936 | Lisp_Object prompt; | 931 | Lisp_Object prompt; |
| 937 | 932 | ||
| 938 | maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0); | 933 | maps[i++] = keymap = get_keymap (XCAR (tem), 1, 0); |
| 939 | 934 | ||
| 940 | prompt = Fkeymap_prompt (keymap); | 935 | prompt = Fkeymap_prompt (keymap); |
| 941 | if (NILP (title) && !NILP (prompt)) | 936 | if (NILP (title) && !NILP (prompt)) |
| @@ -1750,7 +1745,7 @@ digest_single_submenu (start, end, top_level_items) | |||
| 1750 | #ifndef HAVE_MULTILINGUAL_MENU | 1745 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1751 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) | 1746 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
| 1752 | { | 1747 | { |
| 1753 | pane_name = ENCODE_SYSTEM (pane_name); | 1748 | pane_name = ENCODE_MENU_STRING (pane_name); |
| 1754 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; | 1749 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; |
| 1755 | } | 1750 | } |
| 1756 | #endif | 1751 | #endif |
| @@ -2695,7 +2690,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2695 | #ifndef HAVE_MULTILINGUAL_MENU | 2690 | #ifndef HAVE_MULTILINGUAL_MENU |
| 2696 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) | 2691 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
| 2697 | { | 2692 | { |
| 2698 | pane_name = ENCODE_SYSTEM (pane_name); | 2693 | pane_name = ENCODE_MENU_STRING (pane_name); |
| 2699 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; | 2694 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; |
| 2700 | } | 2695 | } |
| 2701 | #endif | 2696 | #endif |