diff options
| author | Eli Zaretskii | 2013-11-18 18:45:48 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-11-18 18:45:48 +0200 |
| commit | 18b35e2c7a3ff95fb4a07e58c3f57c70c65c0701 (patch) | |
| tree | 7a837a755a7c22d3258408cb384d01479ad88232 /src | |
| parent | df87c56cdf6c8c13e8760bdc409e2eb0fda55b0b (diff) | |
| parent | 37c790b38599cc80a16c6a76152abbf8160fe2a1 (diff) | |
| download | emacs-18b35e2c7a3ff95fb4a07e58c3f57c70c65c0701.tar.gz emacs-18b35e2c7a3ff95fb4a07e58c3f57c70c65c0701.zip | |
Merge from mainline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 725 | ||||
| -rw-r--r-- | src/ChangeLog.12 | 4 | ||||
| -rw-r--r-- | src/Makefile.in | 57 | ||||
| -rw-r--r-- | src/alloc.c | 559 | ||||
| -rw-r--r-- | src/buffer.c | 134 | ||||
| -rw-r--r-- | src/buffer.h | 8 | ||||
| -rw-r--r-- | src/bytecode.c | 2 | ||||
| -rw-r--r-- | src/callproc.c | 11 | ||||
| -rw-r--r-- | src/casefiddle.c | 2 | ||||
| -rw-r--r-- | src/category.c | 41 | ||||
| -rw-r--r-- | src/category.h | 12 | ||||
| -rw-r--r-- | src/ccl.c | 8 | ||||
| -rw-r--r-- | src/character.h | 2 | ||||
| -rw-r--r-- | src/chartab.c | 7 | ||||
| -rw-r--r-- | src/coding.c | 23 | ||||
| -rw-r--r-- | src/commands.h | 4 | ||||
| -rw-r--r-- | src/composite.c | 2 | ||||
| -rw-r--r-- | src/composite.h | 8 | ||||
| -rw-r--r-- | src/conf_post.h | 2 | ||||
| -rw-r--r-- | src/data.c | 209 | ||||
| -rw-r--r-- | src/dispextern.h | 57 | ||||
| -rw-r--r-- | src/dispnew.c | 7 | ||||
| -rw-r--r-- | src/disptab.h | 2 | ||||
| -rw-r--r-- | src/doc.c | 6 | ||||
| -rw-r--r-- | src/dosfns.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 1 | ||||
| -rw-r--r-- | src/emacs.c | 52 | ||||
| -rw-r--r-- | src/eval.c | 22 | ||||
| -rw-r--r-- | src/fileio.c | 47 | ||||
| -rw-r--r-- | src/floatfns.c | 13 | ||||
| -rw-r--r-- | src/fns.c | 57 | ||||
| -rw-r--r-- | src/font.c | 10 | ||||
| -rw-r--r-- | src/font.h | 4 | ||||
| -rw-r--r-- | src/fontset.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 16 | ||||
| -rw-r--r-- | src/fringe.c | 2 | ||||
| -rw-r--r-- | src/ftfont.c | 4 | ||||
| -rw-r--r-- | src/ftxfont.c | 6 | ||||
| -rw-r--r-- | src/gmalloc.c | 49 | ||||
| -rw-r--r-- | src/gnutls.c | 31 | ||||
| -rw-r--r-- | src/gtkutil.c | 11 | ||||
| -rw-r--r-- | src/image.c | 80 | ||||
| -rw-r--r-- | src/indent.c | 6 | ||||
| -rw-r--r-- | src/insdel.c | 59 | ||||
| -rw-r--r-- | src/keyboard.c | 104 | ||||
| -rw-r--r-- | src/keymap.c | 7 | ||||
| -rw-r--r-- | src/lisp.h | 160 | ||||
| -rw-r--r-- | src/lread.c | 32 | ||||
| -rw-r--r-- | src/macfont.h | 3 | ||||
| -rw-r--r-- | src/macfont.m | 380 | ||||
| -rw-r--r-- | src/macros.c | 6 | ||||
| -rw-r--r-- | src/menu.h | 4 | ||||
| -rw-r--r-- | src/minibuf.c | 14 | ||||
| -rw-r--r-- | src/msdos.c | 2 | ||||
| -rw-r--r-- | src/nsfns.m | 111 | ||||
| -rw-r--r-- | src/nsfont.m | 37 | ||||
| -rw-r--r-- | src/nsterm.h | 4 | ||||
| -rw-r--r-- | src/nsterm.m | 57 | ||||
| -rw-r--r-- | src/print.c | 5 | ||||
| -rw-r--r-- | src/process.c | 43 | ||||
| -rw-r--r-- | src/regex.c | 2 | ||||
| -rw-r--r-- | src/regex.h | 2 | ||||
| -rw-r--r-- | src/search.c | 70 | ||||
| -rw-r--r-- | src/term.c | 104 | ||||
| -rw-r--r-- | src/w32.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 6 | ||||
| -rw-r--r-- | src/w32font.c | 32 | ||||
| -rw-r--r-- | src/w32font.h | 2 | ||||
| -rw-r--r-- | src/w32inevt.c | 2 | ||||
| -rw-r--r-- | src/w32menu.c | 2 | ||||
| -rw-r--r-- | src/w32term.c | 24 | ||||
| -rw-r--r-- | src/w32term.h | 1 | ||||
| -rw-r--r-- | src/w32uniscribe.c | 4 | ||||
| -rw-r--r-- | src/window.c | 42 | ||||
| -rw-r--r-- | src/window.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 306 | ||||
| -rw-r--r-- | src/xfaces.c | 281 | ||||
| -rw-r--r-- | src/xfns.c | 17 | ||||
| -rw-r--r-- | src/xfont.c | 18 | ||||
| -rw-r--r-- | src/xftfont.c | 27 | ||||
| -rw-r--r-- | src/xmenu.c | 4 | ||||
| -rw-r--r-- | src/xrdb.c | 4 | ||||
| -rw-r--r-- | src/xselect.c | 3 | ||||
| -rw-r--r-- | src/xsettings.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 34 | ||||
| -rw-r--r-- | src/xterm.h | 1 |
86 files changed, 2790 insertions, 1543 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b973b5b8d04..a2dfa5bf613 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,706 @@ | |||
| 1 | 2013-11-18 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * insdel.c (invalidate_buffer_caches): New function, consolidated | ||
| 4 | from part of prepare_to_modify_buffer. | ||
| 5 | (insert_from_gap, prepare_to_modify_buffer): | ||
| 6 | * coding.c (code_convert_region, code_convert_string): Call | ||
| 7 | invalidate_buffer_caches. (Bug#15841) | ||
| 8 | |||
| 9 | * lisp.h (invalidate_buffer_caches): Add prototype. | ||
| 10 | |||
| 11 | 2013-11-17 Eli Zaretskii <eliz@gnu.org> | ||
| 12 | |||
| 13 | * w32term.c (x_update_window_end): Don't invalidate the entire | ||
| 14 | mouse-highlight info, just signal frame_up_to_date_hook that mouse | ||
| 15 | highlight needs to be redisplayed. (Bug#15913) | ||
| 16 | |||
| 17 | 2013-11-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 18 | |||
| 19 | * lisp.h (DEBUGGER_SEES_C_MACROS): Remove. | ||
| 20 | |||
| 21 | 2013-11-16 Eli Zaretskii <eliz@gnu.org> | ||
| 22 | |||
| 23 | * doc.c (Fsubstitute_command_keys): Inhibit modification hooks | ||
| 24 | while we are using Vprin1_to_string_buffer. | ||
| 25 | |||
| 26 | * keymap.c (describe_map): Don't crash if PT is 1 both before and | ||
| 27 | after inserting the description string. (Bug#15907) | ||
| 28 | |||
| 29 | 2013-11-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 30 | |||
| 31 | * data.c: Work around bogus GCC diagnostic about shift count. | ||
| 32 | Reported by Eli Zaretskii in | ||
| 33 | <http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00489.html>. | ||
| 34 | (pre_value): New function. | ||
| 35 | (count_trailing_zero_bits): Use it. | ||
| 36 | |||
| 37 | 2013-11-15 Eli Zaretskii <eliz@gnu.org> | ||
| 38 | |||
| 39 | * lisp.h (DEBUGGER_SEES_C_MACROS) [GCC < v3.5]: Pessimistically | ||
| 40 | assume C macros are not supported even under -g3 in these old GCC | ||
| 41 | versions. | ||
| 42 | |||
| 43 | 2013-11-15 Leo Liu <sdl.web@gmail.com> | ||
| 44 | |||
| 45 | * minibuf.c (Ftry_completion, Fall_completions) | ||
| 46 | (Ftest_completion): Use FUNCTIONP. (Bug#15889) | ||
| 47 | |||
| 48 | 2013-11-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 49 | |||
| 50 | * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): | ||
| 51 | Define to empty if DEBUGGER_SEES_C_MACROS is defined. | ||
| 52 | This avoids placing unnecessary constants into the Emacs code. | ||
| 53 | |||
| 54 | 2013-11-14 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change) | ||
| 55 | |||
| 56 | * keyboard.c (make_ctrl_char) [HAVE_NTGUI]: Now externally visible | ||
| 57 | for Cygwin w32 build. | ||
| 58 | |||
| 59 | * xdisp.c (erase_phys_cursor) [HAVE_NTGUI]: Now externally visible | ||
| 60 | for Cygwin w32 build. (Bug#15892) | ||
| 61 | |||
| 62 | 2013-11-14 Paul Eggert <eggert@cs.ucla.edu> | ||
| 63 | |||
| 64 | Simplify, port and tune bool vector implementation. | ||
| 65 | * alloc.c (bool_vector_exact_payload_bytes) | ||
| 66 | (bool_vector_payload_bytes): Remove. | ||
| 67 | (bool_vector_fill): Return its argument. | ||
| 68 | * alloc.c (bool_vector_fill): | ||
| 69 | * lread.c (read1): | ||
| 70 | * print.c (print_object): | ||
| 71 | Simplify by using bool_vector_bytes. | ||
| 72 | * alloc.c (make_uninit_bool_vector): | ||
| 73 | New function, broken out from Fmake_bool_vector. | ||
| 74 | (Fmake_bool_vector): Use it. Use tail call. | ||
| 75 | (make_uninit_bool_vector, vector_nbytes): Simplify size calculations. | ||
| 76 | * data.c (BITS_PER_ULL): New constant. | ||
| 77 | (ULLONG_MAX, count_one_bits_ll): Fall back on long counterparts | ||
| 78 | if long long versions don't exist. | ||
| 79 | (shift_right_ull): New function. | ||
| 80 | (count_one_bits_word): New function, replacing popcount_bits_word | ||
| 81 | macro. Don't assume that bits_word is no wider than long long. | ||
| 82 | (count_one_bits_word, count_trailing_zero_bits): | ||
| 83 | Don't assume that bits_word is no wider than long long. | ||
| 84 | * data.c (bool_vector_binop_driver, bool_vector_not): | ||
| 85 | * fns.c (Fcopy_sequence): | ||
| 86 | * lread.c (read1): | ||
| 87 | Create an uninitialized destination, to avoid needless work. | ||
| 88 | (internal_equal): Simplify. | ||
| 89 | (Ffillarray): Prefer tail call. | ||
| 90 | * data.c (bool_vector_binop_driver): Don't assume bit vectors always | ||
| 91 | contain at least one word. | ||
| 92 | (bits_word_to_host_endian): Prefer if to #if. Don't assume | ||
| 93 | chars are narrower than ints. | ||
| 94 | * data.c (Fbool_vector_count_matches, Fbool_vector_count_matches_at): | ||
| 95 | * fns.c (Fcopy_sequence): | ||
| 96 | Simplify and tune. | ||
| 97 | * lisp.h (bits_word, BITS_WORD_MAX, BITS_PER_BITS_WORD): | ||
| 98 | Don't try to port to hosts where bits_word values have holes; the | ||
| 99 | code wouldn't work there anyway. Verify this assumption, though. | ||
| 100 | (bool_vector_bytes): New function. | ||
| 101 | (make_uninit_bool_vector): New decl. | ||
| 102 | (bool_vector_fill): Now returns Lisp_Object. | ||
| 103 | |||
| 104 | * xfns.c (xic_create_fontsetname): | ||
| 105 | * xrdb.c (gethomedir): Prefer tail calls. | ||
| 106 | |||
| 107 | 2013-11-12 Paul Eggert <eggert@cs.ucla.edu> | ||
| 108 | |||
| 109 | * xterm.c (syms_of_xterm): staticpro Qmodifier_value, Qalt, Qhyper, | ||
| 110 | Qmeta, and Qsuper. This is safer, and it's what w32fns.c does. | ||
| 111 | |||
| 112 | * buffer.c (Fforce_mode_line_update): Don't fall off end of function | ||
| 113 | that requires a return value. | ||
| 114 | (Fset_buffer_modified_p): Take advantage of this change to do | ||
| 115 | a tail call. | ||
| 116 | |||
| 117 | 2013-11-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 118 | |||
| 119 | * buffer.c (Frestore_buffer_modified_p): Sync it with | ||
| 120 | Fset_buffer_modified_p. | ||
| 121 | (Fforce_mode_line_update): New function, moved from subr.el. | ||
| 122 | (Fset_buffer_modified_p): Use them. | ||
| 123 | (syms_of_buffer): Defsubr Fforce_mode_line_update. | ||
| 124 | |||
| 125 | 2013-11-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 126 | |||
| 127 | * search.c (find_newline): Rewrite to prefer offsets to pointers. | ||
| 128 | This avoids undefined behavior when subtracting pointers into | ||
| 129 | different aways. On my platform it also makes the code a tad | ||
| 130 | smaller and presumably faster. | ||
| 131 | |||
| 132 | 2013-11-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 133 | |||
| 134 | * keyboard.c (command_loop_1): Use region-extract-function. | ||
| 135 | * insdel.c (Qregion_extract_function): Not static any more (can we | ||
| 136 | stop pretending that these vars can benefit from being marked static?). | ||
| 137 | |||
| 138 | 2013-11-09 Eli Zaretskii <eliz@gnu.org> | ||
| 139 | |||
| 140 | * search.c (find_newline): If buffer text is relocated during the | ||
| 141 | "dumb loop", adjust C pointers into buffer text to follow suit. | ||
| 142 | (Bug#15841) | ||
| 143 | |||
| 144 | 2013-11-09 Łukasz Stelmach <stlman@poczta.fm> (tiny change) | ||
| 145 | |||
| 146 | * gtkutil.c (xg_check_special_colors): Use rgb: instead of rgbi: | ||
| 147 | for conversion (Bug#15837). | ||
| 148 | |||
| 149 | 2013-11-09 Eli Zaretskii <eliz@gnu.org> | ||
| 150 | |||
| 151 | * fileio.c (Finsert_file_contents): Invalidate the newline cache | ||
| 152 | for the entire range of inserted characters. (Bug#15841) | ||
| 153 | |||
| 154 | 2013-11-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 155 | |||
| 156 | * xfaces.c (lface_fully_specified_p): Let distant-foreground be | ||
| 157 | unspecified. | ||
| 158 | (realize_default_face): Remove assignment to distant-foreground if | ||
| 159 | unspecified (Bug#15815). | ||
| 160 | |||
| 161 | 2013-11-08 Eli Zaretskii <eliz@gnu.org> | ||
| 162 | |||
| 163 | * xdisp.c (message_dolog): Make sure the *Messages* buffer has its | ||
| 164 | cache-long-scans disabled, since we don't want to call | ||
| 165 | prepare_to_modify_buffer (in insert_1_both) for each message we | ||
| 166 | display. | ||
| 167 | |||
| 168 | * buffer.h (bset_cache_long_scans): New INLINE function, moved | ||
| 169 | from buffer.c. Improve commentary to the buffer field setter | ||
| 170 | functions. | ||
| 171 | |||
| 172 | * buffer.c (bset_cache_long_scans): Static function deleted. | ||
| 173 | Improve commentary to the buffer field setter functions. | ||
| 174 | (init_buffer_once): Default for cache-long-scans changed to t. | ||
| 175 | (Bug#15797) | ||
| 176 | |||
| 177 | 2013-11-08 Paul Eggert <eggert@cs.ucla.edu> | ||
| 178 | |||
| 179 | * gmalloc.c (special_realloc, calloc, mallochook): Use tail calls. | ||
| 180 | |||
| 181 | * chartab.c (make_sub_char_table): Fix size typo (Bug#15825). | ||
| 182 | This bug was introduced in my 2013-06-21 change, and caused | ||
| 183 | struct Lisp_Sub_Char_Table objects to be given too many slots, | ||
| 184 | which broke 'make -C admin/unidata'. | ||
| 185 | |||
| 186 | 2013-11-07 Jan Djärv <jan.h.d@swipnet.se> | ||
| 187 | |||
| 188 | Import changes from mac-port 4.5. | ||
| 189 | * macfont.m (mac_font_copy_default_descriptors_for_language) | ||
| 190 | (mac_font_copy_default_name_for_charset_and_languages): Declare. | ||
| 191 | (cf_charset_table): big-5-0 has uniquifier 0x4EDC. | ||
| 192 | (macfont_language_default_font_names): New. | ||
| 193 | (macfont_list): Rearrange language/charset code. | ||
| 194 | (macfont_close): Don't check for macfont_info->cache. | ||
| 195 | (mac_ctfont_create_preferred_family_for_attributes): New font | ||
| 196 | selection code, call | ||
| 197 | mac_font_copy_default_name_for_charset_and_languages. | ||
| 198 | (mac_font_copy_default_descriptors_for_language) | ||
| 199 | (mac_font_copy_default_name_for_charset_and_languages): New functions. | ||
| 200 | |||
| 201 | * macfont.h (kCTVersionNumber10_9): Define if not defined. | ||
| 202 | |||
| 203 | 2013-11-07 Paul Eggert <eggert@cs.ucla.edu> | ||
| 204 | |||
| 205 | Port to C11 aligned_alloc, and fix some integer overflows. | ||
| 206 | * alloc.c (USE_ALIGNED_ALLOC): New symbol. | ||
| 207 | (USE_POSIX_MEMALIGN): Remove. All uses replaced with USE_ALIGNED_ALLOC, | ||
| 208 | and use of posix_memalign replaced with aligned_alloc. | ||
| 209 | (aligned_alloc): New function, defined or declared as needed. | ||
| 210 | * conf_post.h (HAVE_POSIX_MEMALIGN) [DARWIN_OS]: | ||
| 211 | Don't undef; configure.ac now does this. | ||
| 212 | * gmalloc.c (aligned_alloc) [MSDOS]: New decl. | ||
| 213 | (calloc, aligned_alloc): Check for integer overflow. | ||
| 214 | (aligned_alloc): Rename from memalign. All uses changed. | ||
| 215 | (memalign): New function, an alias for aligned_alloc. | ||
| 216 | |||
| 217 | 2013-11-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 218 | |||
| 219 | * xdisp.c (redisplay_internal): Fix typo in last change. | ||
| 220 | |||
| 221 | 2013-11-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 222 | |||
| 223 | * regex.c: Fix --enable-gcc-warning glitch with GCC 4.5.2. | ||
| 224 | |||
| 225 | 2013-11-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 226 | |||
| 227 | * xdisp.c (syms_of_xdisp): New vars redisplay--all-windows-cause and | ||
| 228 | redisplay--mode-lines-cause. | ||
| 229 | (redisplay_internal): Keep them uptodate. Remove redundant check of | ||
| 230 | buffer_shared_and_changed. | ||
| 231 | * *.[chm]: Number every assignment to update_mode_lines so we | ||
| 232 | can track why it is set. | ||
| 233 | |||
| 234 | 2013-11-06 Eli Zaretskii <eliz@gnu.org> | ||
| 235 | |||
| 236 | * editfns.c (Fformat_time_string): Doc fix. (Bug#15816) | ||
| 237 | |||
| 238 | 2013-11-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 239 | |||
| 240 | * *.[chm]: Number every assignment to windows_or_buffers_changed so we | ||
| 241 | can track why it is set. | ||
| 242 | |||
| 243 | 2013-11-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 244 | |||
| 245 | Integer-related fixes for term.c etc. | ||
| 246 | * dispextern.h (face_tty_specified_color): New function. | ||
| 247 | * term.c (turn_on_face): Don't rely on undefined behavior when | ||
| 248 | assigning an out-of-range value to 'long'. | ||
| 249 | Simplify test for toggling highlight. | ||
| 250 | (tty_capable_p): Omit last two (unused) args. All callers changed. | ||
| 251 | * term.c (tty_capable_p, tty_menu_display, tty_menu_add_selection) | ||
| 252 | (read_menu_input, tty_menu_activate, tty_menu_show): | ||
| 253 | * xfaces.c (x_supports_face_attributes_p) | ||
| 254 | (tty_supports_face_attributes_p): | ||
| 255 | Use bool for boolean. All callers changed. | ||
| 256 | (tty_supports_face_attributes_p): Omit defaults for color indices; | ||
| 257 | no longer needed. Simplify tail call. | ||
| 258 | |||
| 259 | 2013-11-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 260 | |||
| 261 | * xdisp.c (prepare_menu_bars): Mark static. | ||
| 262 | * lisp.h (prepare_menu_bars): Don't declare. | ||
| 263 | * xselect.c (x_handle_selection_clear): | ||
| 264 | * callproc.c (call_process): Remove redundant call to prepare_menu_bars. | ||
| 265 | |||
| 266 | 2013-11-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 267 | |||
| 268 | * keyboard.c (Fcommand_error_default_function): Fix pointer signedness | ||
| 269 | glitch. Eliminate 'sz' prefix; Hungarian notation is not helpful here. | ||
| 270 | |||
| 271 | 2013-11-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 272 | |||
| 273 | * keyboard.c (Fcommand_error_default_function): Rename from | ||
| 274 | Fdefault_error_output. | ||
| 275 | |||
| 276 | 2013-11-05 Jarek Czekalski <jarekczek@poczta.onet.pl> (tiny change) | ||
| 277 | |||
| 278 | * keyboard.c (Fdefault_error_output): New function, extracted from | ||
| 279 | cmd_error_internal. | ||
| 280 | (syms_of_keyboard): Use it for Vcommand_error_function. | ||
| 281 | |||
| 282 | 2013-11-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 283 | |||
| 284 | * eval.c (handlerlist_sentinel): New variable (bug#15802). | ||
| 285 | (init_eval): Use it to ensure handlerlist is non-NULL. | ||
| 286 | (unwind_to_catch): Make sure we never set handlerlist to NULL. | ||
| 287 | (Fsignal): Adjust NULLness test of handlerlist. | ||
| 288 | * lisp.h (PUSH_HANDLER): Assume handlerlist is non-NULL. | ||
| 289 | |||
| 290 | 2013-11-05 Eli Zaretskii <eliz@gnu.org> | ||
| 291 | |||
| 292 | * callproc.c (call_process): Call prepare_to_modify_buffer before | ||
| 293 | decoding text read from the sub-process, as the decoded stuff will | ||
| 294 | be inserted into the buffer. This will invalidate the various | ||
| 295 | caches maintained for the buffer. (Bug#15148) | ||
| 296 | |||
| 297 | 2013-11-05 Xue Fuqiao <xfq.free@gmail.com> | ||
| 298 | |||
| 299 | * xdisp.c (syms_of_xdisp): Mention the active display table in doc | ||
| 300 | string of glyphless-char-display. | ||
| 301 | |||
| 302 | 2013-11-05 Jan Djärv <jan.h.d@swipnet.se> | ||
| 303 | |||
| 304 | * nsfns.m (ns_get_name_from_ioreg): New function. | ||
| 305 | (ns_screen_name): Don't use deprecated CGDisplayIOServicePort on | ||
| 306 | OSX >= 10.9. Use ns_get_name_from_ioreg. | ||
| 307 | |||
| 308 | 2013-11-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 309 | |||
| 310 | Simplify and port recent bool vector changes. | ||
| 311 | * alloc.c (ROUNDUP): Move here from lisp.h, since it's now used | ||
| 312 | only in this file. Use a more-efficient implementation if the | ||
| 313 | second argument is a power of 2. | ||
| 314 | (ALIGN): Rewrite in terms of ROUNDUP. Make it a function. | ||
| 315 | Remove no-longer-necessary compile-time checks. | ||
| 316 | (bool_vector_exact_payload_bytes): New function. | ||
| 317 | (bool_vector_payload_bytes): Remove 2nd arg; callers that need | ||
| 318 | exact payload changed to call the new function. Do not assume | ||
| 319 | that the arg or result fits in ptrdiff_t. | ||
| 320 | (bool_vector_fill): New function. | ||
| 321 | (Fmake_bool_vector): Use it. Don't assume bit counts fit | ||
| 322 | in ptrdiff_t. | ||
| 323 | (vroundup_ct): Don't assume arg fits in size_t. | ||
| 324 | * category.c (SET_CATEGORY_SET): Remove. All callers now just | ||
| 325 | invoke set_category_set. | ||
| 326 | (set_category_set): 2nd arg is now EMACS_INT and 3rd is now bool. | ||
| 327 | All callers changed. Use bool_vector_set. | ||
| 328 | * category.h (XCATEGORY_SET): Remove; no longer needed. | ||
| 329 | (CATEGORY_MEMBER): Now a function. Rewrite in terms of | ||
| 330 | bool_vector_bitref. | ||
| 331 | * data.c (Faref): Use bool_vector_ref. | ||
| 332 | (Faset): Use bool_vector_set. | ||
| 333 | (bits_word_to_host_endian): Don't assume you can shift by CHAR_BIT. | ||
| 334 | (Fbool_vector_not, Fbool_vector_count_matches) | ||
| 335 | (Fbool_vector_count_matches_at): Don't assume CHAR_BIT == 8. | ||
| 336 | * fns.c (concat): Use bool_vector_ref. | ||
| 337 | (Ffillarray): Use bool_vector_fill. | ||
| 338 | (mapcar1): Use bool_vector_ref. | ||
| 339 | (sxhash_bool_vector): Hash words, not bytes. | ||
| 340 | * lisp.h (BOOL_VECTOR_BITS_PER_CHAR): Now a macro as well as | ||
| 341 | a constant, since it's now used in #if. | ||
| 342 | (bits_word, BITS_WORD_MAX, BITS_PER_BITS_WORD): Fall back on | ||
| 343 | unsigned char on unusual architectures, so that we no longer | ||
| 344 | assume that the number of bits per bits_word is a power of two or | ||
| 345 | is a multiple of 8 or of CHAR_BIT. | ||
| 346 | (Qt): Add forward decl. | ||
| 347 | (struct Lisp_Bool_Vector): Don't assume EMACS_INT is aligned | ||
| 348 | at least as strictly as bits_word. | ||
| 349 | (bool_vector_data, bool_vector_uchar_data): New accessors. | ||
| 350 | All data structure accesses changed to use them. | ||
| 351 | (bool_vector_words, bool_vector_bitref, bool_vector_ref) | ||
| 352 | (bool_vector_set): New functions. | ||
| 353 | (bool_vector_fill): New decl. | ||
| 354 | (ROUNDUP): Move to alloc.c as described above. | ||
| 355 | |||
| 356 | Fix recent gnutls changes. | ||
| 357 | * gnutls.c (Fgnutls_boot): Don't assume C99. | ||
| 358 | * process.c (wait_reading_process_output): Fix typo in recent change. | ||
| 359 | |||
| 360 | 2013-11-05 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 361 | |||
| 362 | * process.c (wait_reading_process_output, read_process_output) | ||
| 363 | (send_process): Check gnutls_state is not NULL. | ||
| 364 | |||
| 365 | * gnutls.c (emacs_gnutls_handle_error): Adjust log level for EAGAIN. | ||
| 366 | (Fgnutls_boot): Set process gnutls_p later, after initialization. | ||
| 367 | |||
| 368 | 2013-11-04 Jan Djärv <jan.h.d@swipnet.se> | ||
| 369 | |||
| 370 | * nsterm.m (init, run, stop:): New methods in EmacsApp for | ||
| 371 | OSX >= 10.9 to prevent memory leak of GCD dispatch source. | ||
| 372 | |||
| 373 | * nsterm.h (EmacsApp): Add shouldKeepRunning and isFirst for | ||
| 374 | OSX >= 10.9. | ||
| 375 | |||
| 376 | * nsfns.m (Fx_create_frame): Fix memory leak. | ||
| 377 | |||
| 378 | * macfont.m (CG_SET_FILL_COLOR_WITH_GC_FOREGROUND) | ||
| 379 | (CG_SET_FILL_COLOR_WITH_GC_BACKGROUND) | ||
| 380 | (CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND): Fix memory leak. | ||
| 381 | |||
| 382 | 2013-11-04 Eli Zaretskii <eliz@gnu.org> | ||
| 383 | |||
| 384 | * xdisp.c (message3_nolog, message_with_string): Encode the string | ||
| 385 | before writing it to the terminal in a non-interactive session. | ||
| 386 | |||
| 387 | * lread.c (openp): If both FILENAME and SUFFIX are unibyte, make | ||
| 388 | sure we concatenate them into a unibyte string. | ||
| 389 | |||
| 390 | * fileio.c (make_temp_name): Encode PREFIX, and decode the | ||
| 391 | resulting temporary name before returning it to the caller. | ||
| 392 | (Fexpand_file_name): If NAME is pure-ASCII and DEFAULT_DIRECTORY | ||
| 393 | is a unibyte string, convert NAME to a unibyte string to ensure | ||
| 394 | that the result is also a unibyte string. | ||
| 395 | |||
| 396 | * emacs.c (init_cmdargs): Use build_unibyte_string to make sure we | ||
| 397 | create unibyte strings from default paths and directory/file | ||
| 398 | names. | ||
| 399 | |||
| 400 | * coding.h (ENCODE_FILE): Do not attempt to encode a unibyte | ||
| 401 | string. | ||
| 402 | |||
| 403 | * callproc.c (init_callproc): Use build_unibyte_string to make | ||
| 404 | sure we create unibyte strings from default paths and | ||
| 405 | directory/file names. | ||
| 406 | |||
| 407 | * buffer.c (init_buffer): Don't store default-directory of | ||
| 408 | *scratch* in multibyte form. The original problem which led to | ||
| 409 | that is described in | ||
| 410 | http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00532.html, | ||
| 411 | but it was solved long ago. (Bug#15260) | ||
| 412 | |||
| 413 | 2013-11-04 Paul Eggert <eggert@cs.ucla.edu> | ||
| 414 | |||
| 415 | Port to stricter C99 platforms. | ||
| 416 | Especially, C99 prohibits nesting a struct X inside struct Y if | ||
| 417 | struct X has a flexible array member. | ||
| 418 | * alloc.c (struct sdata): New type. | ||
| 419 | (sdata): Implement in terms of struct sdata. | ||
| 420 | Remove u member; all uses replaced by next_vector, set_next_vector. | ||
| 421 | (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change. | ||
| 422 | (SDATA_DATA_OFFSET): Now a constant, not a macro. | ||
| 423 | (struct sblock): Rename first_data member to data, which is now | ||
| 424 | a flexible array member. All uses changed. | ||
| 425 | (next_vector, set_next_vector, large_vector_vec): New functions. | ||
| 426 | (vector_alignment): New constant. | ||
| 427 | (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too. | ||
| 428 | (struct large-vector): Now merely a NEXT member, since the old approach | ||
| 429 | ran afoul of stricter C99. All uses changed to use | ||
| 430 | large_vector_vec or large_vector_offset. | ||
| 431 | (large_vector_offset): New constant. | ||
| 432 | * dispnew.c: Include tparam.h, for tgetent. | ||
| 433 | Do not include term.h; no longer needed. | ||
| 434 | * gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn. | ||
| 435 | * lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int. | ||
| 436 | (struct Lisp_Vector): Use a flexible array member for contents, | ||
| 437 | instead of a union with a member that is an array of size 1. | ||
| 438 | All uses changed. | ||
| 439 | (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the | ||
| 440 | fact that the struct no longer contains a union. | ||
| 441 | (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay) | ||
| 442 | (struct Lisp_Save_Value, struct Lisp_Free): | ||
| 443 | Use unsigned, not int, for spacers, to avoid c99 warning. | ||
| 444 | (union specbinding): Use unsigned, not bool, for bitfield, as | ||
| 445 | bool is not portable to pre-C99 hosts. | ||
| 446 | |||
| 447 | 2013-11-04 Glenn Morris <rgm@gnu.org> | ||
| 448 | |||
| 449 | * emacs.c (usage_message): Mention that `-L :...' appends. | ||
| 450 | |||
| 451 | 2013-11-02 Glenn Morris <rgm@gnu.org> | ||
| 452 | |||
| 453 | * Makefile.in (abs_builddir): Remove. | ||
| 454 | (bootstrap_exe): Use relative filename. | ||
| 455 | |||
| 456 | Use relative filenames in TAGS files. | ||
| 457 | * Makefile.in (abs_srcdir): Remove it again. | ||
| 458 | (.PHONY): Remove frc. | ||
| 459 | (maintainer-clean): No more TAGS-LISP file. | ||
| 460 | (TAGS): Pass relative file names to etags. | ||
| 461 | (../lisp/TAGS): Rename from TAGS-LISP. Work in ../lisp. | ||
| 462 | |||
| 463 | * Makefile.in (abs_srcdir): New, set by configure. | ||
| 464 | (lispdir): Remove. | ||
| 465 | (maintainer-clean): Remove pointless echo. That should be in the | ||
| 466 | top-level Makefile, if anywhere. Delete TAGS-LISP. | ||
| 467 | (extraclean): No s/ and m/ directories for some time. | ||
| 468 | (TAGS): Also depend on ctagsfiles3. | ||
| 469 | Remove no-longer-defined S_FILE. | ||
| 470 | Pass absolute filenames to etags once more. | ||
| 471 | (TAGS-LISP): Replace lispdir with its expansion. | ||
| 472 | (TAGS-LISP, $(lwlibdir)/TAGS): Correctly pass ETAGS to sub-makes. | ||
| 473 | ($(lwlibdir)/TAGS): Remove useless subshell, check cd return value. | ||
| 474 | |||
| 475 | 2013-11-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 476 | |||
| 477 | * xfaces.c (check_lface_attrs, realize_default_face): | ||
| 478 | Add LFACE_DISTANT_FOREGROUND_INDEX (Bug#15788). | ||
| 479 | (realize_default_face): Set DISTANT_FOREGROUND to unspecified_fg. | ||
| 480 | |||
| 481 | 2013-11-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 482 | |||
| 483 | * emacs.c (original_pwd): Remove global var by making it local. | ||
| 484 | (init_cmdargs): New arg ORIGINAL_PWD; caller changed. | ||
| 485 | |||
| 486 | 2013-11-01 Jan Djärv <jan.h.d@swipnet.se> | ||
| 487 | |||
| 488 | * xfaces.c: Declare color_distance. | ||
| 489 | (QCdistant_foreground): New variable. | ||
| 490 | (NEAR_SAME_COLOR_THRESHOLD): New define. | ||
| 491 | (load_color2): New function. | ||
| 492 | (load_color): Call load_color2. | ||
| 493 | (load_face_colors): Call load_color2 and if distant-color is specified | ||
| 494 | calculate distant and use distant-color if colors are near. | ||
| 495 | (LFACE_DISTANT_FOREGROUND): New define. | ||
| 496 | (merge_face_ref, Finternal_set_lisp_face_attribute) | ||
| 497 | (Finternal_get_lisp_face_attribute) | ||
| 498 | (x_supports_face_attributes_p): Handle distant-foreground similar to | ||
| 499 | foreground. | ||
| 500 | (syms_of_xfaces): DEFSYM QCdistant_foreground. | ||
| 501 | |||
| 502 | * dispextern.h (lface_attribute_index): | ||
| 503 | Add LFACE_DISTANT_FOREGROUND_INDEX. | ||
| 504 | |||
| 505 | 2013-11-01 Claudio Bley <claudio.bley@googlemail.com> | ||
| 506 | |||
| 507 | * image.c (pbm_next_char): New function. | ||
| 508 | See http://netpbm.sourceforge.net/doc/pbm.html for the details. | ||
| 509 | (pbm_scan_number): Use it. | ||
| 510 | (Qlibjpeg_version): New variable. | ||
| 511 | (syms_of_image): DEFSYM and initialize it. | ||
| 512 | |||
| 513 | 2013-10-31 Jan Djärv <jan.h.d@swipnet.se> | ||
| 514 | |||
| 515 | * emacs.c (main): Skip -psn args on OSX even if ! isatty (0). | ||
| 516 | |||
| 517 | 2013-10-31 Glenn Morris <rgm@gnu.org> | ||
| 518 | |||
| 519 | * emacs.c (original_pwd): New char. | ||
| 520 | (main): If using --chdir, store original_pwd. | ||
| 521 | (init_cmdargs): When setting Vinvocation_directory based on a | ||
| 522 | relative argv[0], use original_pwd if set. (Bug#15768) | ||
| 523 | |||
| 524 | 2013-10-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 525 | |||
| 526 | * keyboard.c (command_loop_1): If command is nil, call `undefined'. | ||
| 527 | |||
| 528 | 2013-10-29 Paul Eggert <eggert@cs.ucla.edu> | ||
| 529 | |||
| 530 | * insdel.c: Fix minor problems found by static checking. | ||
| 531 | (Qregion_extract_function): Now static. | ||
| 532 | (prepare_to_modify_buffer_1): Remove unused locals. | ||
| 533 | |||
| 534 | 2013-10-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 535 | |||
| 536 | * xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function. | ||
| 537 | (syms_of_xdisp): Declare pre-redisplay-function. | ||
| 538 | (markpos_of_region): Remove function. | ||
| 539 | (init_iterator, compute_stop_pos, handle_face_prop) | ||
| 540 | (face_before_or_after_it_pos, reseat_to_string) | ||
| 541 | (get_next_display_element, window_buffer_changed) | ||
| 542 | (redisplay_internal, try_cursor_movement, redisplay_window) | ||
| 543 | (try_window_reusing_current_matrix, try_window_id, display_line) | ||
| 544 | (note_mode_line_or_margin_highlight, note_mouse_highlight) | ||
| 545 | (display_string, mouse_face_from_buffer_pos): Remove region handling. | ||
| 546 | * window.h (struct window): Remove field `region_showing'. | ||
| 547 | * dispextern.h (struct it): Remove region_beg/end_charpos. | ||
| 548 | (face_at_buffer_position, face_for_overlay_string) | ||
| 549 | (face_at_string_position): Update prototypes. | ||
| 550 | * xfaces.c (face_at_buffer_position, face_for_overlay_string) | ||
| 551 | (face_at_string_position): Remove `region_beg' and `region_end' args. | ||
| 552 | * fontset.c (Finternal_char_font): | ||
| 553 | * font.c (font_at, font_range): Adjust calls accordingly. | ||
| 554 | * insdel.c (Qregion_extract_function): New var. | ||
| 555 | (syms_of_insdel): Initialize it. | ||
| 556 | (prepare_to_modify_buffer_1): Use it. | ||
| 557 | |||
| 558 | 2013-10-29 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 559 | |||
| 560 | Prefer 'unsigned long' to 'long unsigned int' and 'unsigned long int'. | ||
| 561 | * ftxfont.c (ftxfont_get_gcs): | ||
| 562 | * gtkutil.c (xg_set_widget_bg, xg_set_background_color): | ||
| 563 | * xfaces.c (x_free_colors, x_free_dpy_colors) | ||
| 564 | (x_create_gc, unload_color): | ||
| 565 | * xselect.c (x_property_data_to_lisp): | ||
| 566 | * xsettings.c (parse_settings): | ||
| 567 | * xterm.c (x_copy_color, x_alloc_lighter_color, x_setup_relief_color) | ||
| 568 | (get_bits_and_offset): Adjust definition. | ||
| 569 | * frame.c (XParseGeometry): Adjust locals. | ||
| 570 | * lisp.h (toplevel): Adjust EMACS_UINT type definition. | ||
| 571 | * regex.h (toplevel): Likewise for reg_syntax_t. | ||
| 572 | |||
| 573 | 2013-10-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 574 | |||
| 575 | * eval.c (run_hook_with_args): Use FUNCTIONP. | ||
| 576 | |||
| 577 | 2013-10-29 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 578 | |||
| 579 | * xterm.h (struct x_output): For 'black_relief' and 'white_relief' | ||
| 580 | fields, drop 'allocated_p' member and use -1 for uninitialized value. | ||
| 581 | * w32term.h (struct w32_output): Similarly but do not use -1 because... | ||
| 582 | * xfaces.c (unload_color) [HAVE_X_WINDOWS]: ...this function is a no-op | ||
| 583 | on MS-Windows anyway. | ||
| 584 | (free_face_colors): Define only if HAVE_X_WINDOWS and... | ||
| 585 | (free_realized_face): ...adjust user. | ||
| 586 | * xfns.c (Fx_create_frame, x_create_tip_frame): Initialize black and | ||
| 587 | white relief pixels to -1. | ||
| 588 | * xterm.c (x_setup_relief_color, x_free_frame_resources): Adjust users. | ||
| 589 | * w32term.c (w32_setup_relief_color, x_free_frame_resources): Likewise. | ||
| 590 | * dispextern.h (unload_color): Move prototype under HAVE_X_WINDOWS. | ||
| 591 | |||
| 592 | 2013-10-28 Paul Eggert <eggert@cs.ucla.edu> | ||
| 593 | |||
| 594 | * dispextern.h, image.c (x_bitmap_height, x_bitmap_width): Now static. | ||
| 595 | * xfaces.c (load_pixmap): Omit last two args, which are always NULL | ||
| 596 | in practice now. All callers changed. | ||
| 597 | |||
| 598 | 2013-10-28 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 599 | |||
| 600 | * dispextern.h (struct face): Use bitfields for 'underline_type' | ||
| 601 | and 'box' members. Remove set-but-unused members 'pixmap_w' and | ||
| 602 | 'pixmap_h'. If not HAVE_WINDOW_SYSTEM, also remove dummy | ||
| 603 | 'stipple' member. Move 'lface' member up to help... | ||
| 604 | * xfaces.c (make_realized_face): ...this function to find and | ||
| 605 | clear just the members that need clearing. | ||
| 606 | (load_face_colors, realize_x_face): | ||
| 607 | * xdisp.c (extend_face_to_end_of_line): Adjust user. | ||
| 608 | |||
| 609 | 2013-10-27 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 610 | |||
| 611 | * xftfont.c (struct xftfont_info): Remove set-but-unused | ||
| 612 | 'screen' member. | ||
| 613 | (xftfont_open): Adjust user. | ||
| 614 | (xftfont_get_colors): Remove useless prototype. | ||
| 615 | |||
| 616 | 2013-10-26 Eli Zaretskii <eliz@gnu.org> | ||
| 617 | |||
| 618 | * emacs.c (Fdump_emacs): Encode FILENAME and SYMFILE arguments | ||
| 619 | before passing them to 'unexec'. (Bug#15260) | ||
| 620 | |||
| 621 | 2013-10-26 Xue Fuqiao <xfq.free@gmail.com> | ||
| 622 | |||
| 623 | * fringe.c (set_fringe_bitmap_face): Add usage note from lispref. | ||
| 624 | |||
| 625 | 2013-10-25 Eli Zaretskii <eliz@gnu.org> | ||
| 626 | |||
| 627 | * w32uniscribe.c (uniscribe_close): Adjust the argument list to | ||
| 628 | the changed signature of the font driver's 'close' method. | ||
| 629 | |||
| 630 | * w32font.h (w32font_close): Adjust the prototype to the change in | ||
| 631 | function definition. | ||
| 632 | |||
| 633 | * w32font.c (w32font_close): Reintroduce deleted declaration of i. | ||
| 634 | |||
| 635 | * w32uniscribe.c (uniscribe_close): Adapt the call to | ||
| 636 | w32font_close to its new prototype. | ||
| 637 | |||
| 638 | 2013-10-25 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 639 | |||
| 640 | Omit unused frame argument of font API's close function. | ||
| 641 | * font.h (struct font): Drop frame argument. Adjust comment. | ||
| 642 | * font.c (font_clear_cache, font_close_object): Adjust users. | ||
| 643 | * ftfont.c (ftfont_close): | ||
| 644 | * ftxfont.c (ftxfont_close): | ||
| 645 | * macfont.m (macfont_close): | ||
| 646 | * nsfont.m (nsfont_close): | ||
| 647 | * w32font.c (w32font_close): | ||
| 648 | * xfont.c (xfont_close): | ||
| 649 | * xftfont.c (xftfont_close): Adjust driver-specific close functions, | ||
| 650 | tweak comments and make functions safe if called more than once for | ||
| 651 | the same font object. | ||
| 652 | |||
| 653 | Perform font-specific cleanup when font object is swept by GC. See | ||
| 654 | http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00740.html. | ||
| 655 | * alloc.c (cleanup_vector): New function. | ||
| 656 | (sweep_vector): Call it for each reclaimed vector object. | ||
| 657 | * font.h (struct font): Adjust comment. | ||
| 658 | |||
| 659 | 2013-10-24 Glenn Morris <rgm@gnu.org> | ||
| 660 | |||
| 661 | * Makefile.in (abs_top_srcdir): New, set by configure. | ||
| 662 | |||
| 663 | 2013-10-23 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 664 | |||
| 665 | Adjust recent font-related changes to fix bug#15686. | ||
| 666 | * alloc.c (mark_object) [HAVE_WINDOW_SYSTEM]: If marked frame | ||
| 667 | is a live window system frame, mark its default font too. | ||
| 668 | |||
| 669 | 2013-10-23 Glenn Morris <rgm@gnu.org> | ||
| 670 | |||
| 671 | * Makefile.in (RUN_TEMACS): Make relative (again). | ||
| 672 | ($(leimdir)/leim-list.el, .el.elc, $(lispsource)/loaddefs.el) | ||
| 673 | (bootstrap-emacs$(EXEEXT)): | ||
| 674 | Quote entities that might contain whitespace. | ||
| 675 | |||
| 676 | 2013-10-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 677 | |||
| 678 | Port to Solaris 10 and its bundled GCC. | ||
| 679 | Problem reported by Timothy C. Burt. | ||
| 680 | * floatfns.c (isfinite, isnan): Redefine unconditionally. | ||
| 681 | |||
| 682 | 2013-10-21 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 683 | |||
| 684 | Do not allow font caches to grow too large. | ||
| 685 | * alloc.c (compact_font_cache_entry, compact_font_caches): | ||
| 686 | New functions or stub if not HAVE_WINDOW_SYSTEM. | ||
| 687 | (compact_undo_list): Factor out from Fgarbage_collect. | ||
| 688 | Add comment. | ||
| 689 | (mark_face_cache): Mark face font. Move down to avoid | ||
| 690 | extra prototypes. | ||
| 691 | (mark_terminals): Do not mark font cache here. | ||
| 692 | (Fgarbage_collect): Call compaction functions described | ||
| 693 | above. Adjust comment. | ||
| 694 | |||
| 695 | 2013-10-20 Jan Djärv <jan.h.d@swipnet.se> | ||
| 696 | |||
| 697 | * emacs.c (main): On Cocoa, if GUI session and 0 is not a tty, | ||
| 698 | chdir to HOME (bug#15607). | ||
| 699 | |||
| 700 | * nsterm.m (Qcocoa, Qgnustep): New variables. | ||
| 701 | (syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one. | ||
| 702 | (ns_get_color): Make selection color work for GNUStep also. | ||
| 703 | |||
| 1 | 2013-10-18 Eli Zaretskii <eliz@gnu.org> | 704 | 2013-10-18 Eli Zaretskii <eliz@gnu.org> |
| 2 | 705 | ||
| 3 | * keyboard.c (make_lispy_event): Remove GPM-specific code that | 706 | * keyboard.c (make_lispy_event): Remove GPM-specific code that |
| @@ -100,8 +803,8 @@ | |||
| 100 | (get_adapters_info): New wrapper function. | 803 | (get_adapters_info): New wrapper function. |
| 101 | (globals_of_w32): Initialize g_b_init_get_adapters_info. | 804 | (globals_of_w32): Initialize g_b_init_get_adapters_info. |
| 102 | 805 | ||
| 103 | * process.h (network_interface_list, network_interface_info): New | 806 | * process.h (network_interface_list, network_interface_info): |
| 104 | prototypes. | 807 | New prototypes. |
| 105 | 808 | ||
| 106 | * process.c (conv_sockaddr_to_lisp): Now externally-visible. | 809 | * process.c (conv_sockaddr_to_lisp): Now externally-visible. |
| 107 | (Fnetwork_interface_list, Fnetwork_interface_info): Define for | 810 | (Fnetwork_interface_list, Fnetwork_interface_info): Define for |
| @@ -432,8 +1135,8 @@ | |||
| 432 | (xw_popup_dialog): New function, with X-specific bits of popup | 1135 | (xw_popup_dialog): New function, with X-specific bits of popup |
| 433 | dialogs. | 1136 | dialogs. |
| 434 | 1137 | ||
| 435 | * xdisp.c (deep_copy_glyph_row, display_tty_menu_item): New | 1138 | * xdisp.c (deep_copy_glyph_row, display_tty_menu_item): |
| 436 | functions. | 1139 | New functions. |
| 437 | 1140 | ||
| 438 | * window.c (Fset_window_configuration): Use run-time tests of the | 1141 | * window.c (Fset_window_configuration): Use run-time tests of the |
| 439 | frame type instead of compile-time conditionals, when menu-bar | 1142 | frame type instead of compile-time conditionals, when menu-bar |
| @@ -498,11 +1201,11 @@ | |||
| 498 | of, or in addition to, compile-time conditionals. | 1201 | of, or in addition to, compile-time conditionals. |
| 499 | (menu_item_width, Fmenu_bar_menu_at_x_y): New functions. | 1202 | (menu_item_width, Fmenu_bar_menu_at_x_y): New functions. |
| 500 | (Fx_popup_menu): Detect when the function is called from keyboard | 1203 | (Fx_popup_menu): Detect when the function is called from keyboard |
| 501 | on a TTY. Don't barf when invoked on a text-mode frame. Check | 1204 | on a TTY. Don't barf when invoked on a text-mode frame. |
| 502 | frame type at run time, instead of compile-time conditionals for | 1205 | Check frame type at run time, instead of compile-time conditionals for |
| 503 | invoking terminal-specific menu-show functions. Call | 1206 | invoking terminal-specific menu-show functions. |
| 504 | tty_menu_show on text-mode frames. | 1207 | Call tty_menu_show on text-mode frames. |
| 505 | (Fx_popup_dialog): Moved here from xmenu.c. Test frame types at | 1208 | (Fx_popup_dialog): Move here from xmenu.c. Test frame types at |
| 506 | run time to determine which alternative to invoke; support dialogs | 1209 | run time to determine which alternative to invoke; support dialogs |
| 507 | on TTYs. | 1210 | on TTYs. |
| 508 | 1211 | ||
| @@ -5384,7 +6087,7 @@ | |||
| 5384 | 6087 | ||
| 5385 | * keyboard.c (read_decoded_char): Don't decode under w32 (bug#14403). | 6088 | * keyboard.c (read_decoded_char): Don't decode under w32 (bug#14403). |
| 5386 | 6089 | ||
| 5387 | 2013-05-22 Barry OReilly <gundaetiapo@gmail.com> (tiny change) | 6090 | 2013-05-22 Barry O'Reilly <gundaetiapo@gmail.com> |
| 5388 | 6091 | ||
| 5389 | * casetab.c (init_casetab_once): Fix last change (bug#14424). | 6092 | * casetab.c (init_casetab_once): Fix last change (bug#14424). |
| 5390 | 6093 | ||
| @@ -5409,7 +6112,7 @@ | |||
| 5409 | character numbers counted by detect_coding_utf_8. Fix detection | 6112 | character numbers counted by detect_coding_utf_8. Fix detection |
| 5410 | of BOM for utf-8. | 6113 | of BOM for utf-8. |
| 5411 | 6114 | ||
| 5412 | 2013-05-21 Barry OReilly <gundaetiapo@gmail.com> (tiny change) | 6115 | 2013-05-21 Barry O'Reilly <gundaetiapo@gmail.com> |
| 5413 | 6116 | ||
| 5414 | * search.c (looking_at_1): Only set last_thing_searched if the match | 6117 | * search.c (looking_at_1): Only set last_thing_searched if the match |
| 5415 | changed the match-data (bug#14281). | 6118 | changed the match-data (bug#14281). |
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12 index 053baa3d487..b14ce20ede3 100644 --- a/src/ChangeLog.12 +++ b/src/ChangeLog.12 | |||
| @@ -6862,7 +6862,7 @@ | |||
| 6862 | is undefined. See Stefan Monnier in | 6862 | is undefined. See Stefan Monnier in |
| 6863 | <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00762.html>. | 6863 | <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00762.html>. |
| 6864 | 6864 | ||
| 6865 | 2012-08-26 Barry OReilly <gundaetiapo@gmail.com> (tiny change) | 6865 | 2012-08-26 Barry O'Reilly <gundaetiapo@gmail.com> |
| 6866 | 6866 | ||
| 6867 | * lisp.h (functionp): New function (extracted from Ffunctionp). | 6867 | * lisp.h (functionp): New function (extracted from Ffunctionp). |
| 6868 | (FUNCTIONP): Use it. | 6868 | (FUNCTIONP): Use it. |
| @@ -7567,7 +7567,7 @@ | |||
| 7567 | * editfns.c (Fformat): Doc fix (Bug#12059). | 7567 | * editfns.c (Fformat): Doc fix (Bug#12059). |
| 7568 | (Fsave_current_buffer): Doc fix (Bug#11542). | 7568 | (Fsave_current_buffer): Doc fix (Bug#11542). |
| 7569 | 7569 | ||
| 7570 | 2012-08-14 Barry OReilly <gundaetiapo@gmail.com> (tiny change) | 7570 | 2012-08-14 Barry O'Reilly <gundaetiapo@gmail.com> |
| 7571 | 7571 | ||
| 7572 | * keyboard.c (access_keymap_keyremap): Accept anonymous functions | 7572 | * keyboard.c (access_keymap_keyremap): Accept anonymous functions |
| 7573 | (bug#12022). | 7573 | (bug#12022). |
diff --git a/src/Makefile.in b/src/Makefile.in index 254aa175d49..ca0b25a2f69 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ### @configure_input@ | 1 | ### @configure_input@ |
| 2 | 2 | ||
| 3 | # Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2013 Free Software | 3 | # Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2013 |
| 4 | # Foundation, Inc. | 4 | # Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | # This file is part of GNU Emacs. | 6 | # This file is part of GNU Emacs. |
| 7 | 7 | ||
| @@ -28,8 +28,9 @@ SHELL = @SHELL@ | |||
| 28 | # Here are the things that we expect ../configure to edit. | 28 | # Here are the things that we expect ../configure to edit. |
| 29 | # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH. | 29 | # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH. |
| 30 | srcdir = @srcdir@ | 30 | srcdir = @srcdir@ |
| 31 | # MinGW CPPFLAGS may use this. | ||
| 32 | abs_top_srcdir=@abs_top_srcdir@ | ||
| 31 | ntsource = $(srcdir)/../nt | 33 | ntsource = $(srcdir)/../nt |
| 32 | abs_builddir = @abs_builddir@ | ||
| 33 | VPATH = $(srcdir) | 34 | VPATH = $(srcdir) |
| 34 | CC = @CC@ | 35 | CC = @CC@ |
| 35 | WINDRES = @WINDRES@ | 36 | WINDRES = @WINDRES@ |
| @@ -54,12 +55,11 @@ etc = ../etc | |||
| 54 | leimdir = ../leim | 55 | leimdir = ../leim |
| 55 | oldXMenudir = ../oldXMenu | 56 | oldXMenudir = ../oldXMenu |
| 56 | lwlibdir = ../lwlib | 57 | lwlibdir = ../lwlib |
| 57 | lispdir = ../lisp | ||
| 58 | 58 | ||
| 59 | # Configuration files for .o files to depend on. | 59 | # Configuration files for .o files to depend on. |
| 60 | config_h = config.h $(srcdir)/conf_post.h | 60 | config_h = config.h $(srcdir)/conf_post.h |
| 61 | 61 | ||
| 62 | bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) | 62 | bootstrap_exe = ../src/bootstrap-emacs$(EXEEXT) |
| 63 | 63 | ||
| 64 | ## ns-app if HAVE_NS, else empty. | 64 | ## ns-app if HAVE_NS, else empty. |
| 65 | OTHER_FILES = @OTHER_FILES@ | 65 | OTHER_FILES = @OTHER_FILES@ |
| @@ -313,7 +313,7 @@ INTERVALS_H = dispextern.h intervals.h composite.h | |||
| 313 | 313 | ||
| 314 | GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ | 314 | GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ |
| 315 | 315 | ||
| 316 | RUN_TEMACS = `/bin/pwd`/temacs | 316 | RUN_TEMACS = ./temacs |
| 317 | 317 | ||
| 318 | ## Invoke ../nt/addsection for MinGW, ":" elsewhere. | 318 | ## Invoke ../nt/addsection for MinGW, ":" elsewhere. |
| 319 | TEMACS_POST_LINK = @TEMACS_POST_LINK@ | 319 | TEMACS_POST_LINK = @TEMACS_POST_LINK@ |
| @@ -437,7 +437,7 @@ all: emacs$(EXEEXT) $(OTHER_FILES) | |||
| 437 | .PHONY: all | 437 | .PHONY: all |
| 438 | 438 | ||
| 439 | $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) | 439 | $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) |
| 440 | cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe) | 440 | cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS="$(bootstrap_exe)" |
| 441 | 441 | ||
| 442 | ## The dumped Emacs is as functional and more efficient than | 442 | ## The dumped Emacs is as functional and more efficient than |
| 443 | ## bootstrap-emacs, so we replace the latter with the former. | 443 | ## bootstrap-emacs, so we replace the latter with the former. |
| @@ -555,7 +555,7 @@ ns-app: emacs$(EXEEXT) | |||
| 555 | cd ../nextstep && $(MAKE) $(MFLAGS) all | 555 | cd ../nextstep && $(MAKE) $(MFLAGS) all |
| 556 | 556 | ||
| 557 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean | 557 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean |
| 558 | .PHONY: versionclean extraclean frc | 558 | .PHONY: versionclean extraclean |
| 559 | 559 | ||
| 560 | mostlyclean: | 560 | mostlyclean: |
| 561 | rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a | 561 | rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a |
| @@ -578,40 +578,45 @@ bootstrap-clean: clean | |||
| 578 | if test -f "$(srcdir)/.gdbinit"; then rm -f ./.gdbinit.save; \ | 578 | if test -f "$(srcdir)/.gdbinit"; then rm -f ./.gdbinit.save; \ |
| 579 | else mv ./.gdbinit.save ./.gdbinit; fi; \ | 579 | else mv ./.gdbinit.save ./.gdbinit; fi; \ |
| 580 | fi | 580 | fi |
| 581 | ## This is used in making a distribution. | 581 | |
| 582 | ## Do not use it on development directories! | ||
| 583 | distclean: bootstrap-clean | 582 | distclean: bootstrap-clean |
| 584 | rm -f Makefile | 583 | rm -f Makefile |
| 584 | |||
| 585 | maintainer-clean: distclean | 585 | maintainer-clean: distclean |
| 586 | @echo "This command is intended for maintainers to use;" | ||
| 587 | @echo "it deletes files that may require special tools to rebuild." | ||
| 588 | rm -f TAGS | 586 | rm -f TAGS |
| 589 | versionclean: | 587 | versionclean: |
| 590 | -rm -f emacs$(EXEEXT) emacs-*.*.*$(EXEEXT) ../etc/DOC* | 588 | -rm -f emacs$(EXEEXT) emacs-*.*.*$(EXEEXT) ../etc/DOC* |
| 591 | extraclean: distclean | 589 | extraclean: distclean |
| 592 | -rm -f *~ \#* m/?*~ s/?*~ | 590 | -rm -f *~ \#* |
| 591 | |||
| 593 | 592 | ||
| 594 | ## Arrange to make a tags table TAGS-LISP for ../lisp, | 593 | ETAGS = ../lib-src/etags |
| 595 | ## plus TAGS for the C files, which includes ../lisp/TAGS by reference. | ||
| 596 | 594 | ||
| 597 | ctagsfiles1 = [xyzXYZ]*.[hc] | 595 | ctagsfiles1 = [xyzXYZ]*.[hc] |
| 598 | ctagsfiles2 = [a-wA-W]*.[hc] | 596 | ctagsfiles2 = [a-wA-W]*.[hc] |
| 599 | ctagsfiles3 = [a-zA-Z]*.m | 597 | ctagsfiles3 = [a-zA-Z]*.m |
| 600 | 598 | ||
| 601 | TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) | 599 | ## FIXME? In out-of-tree builds, should TAGS be generated in srcdir? |
| 602 | ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ | 600 | |
| 601 | ## This does not need to depend on ../lisp and ../lwlib TAGS files, | ||
| 602 | ## because etags "--include" only includes a pointer to the file, | ||
| 603 | ## rather than the file contents. | ||
| 604 | TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(srcdir)/$(ctagsfiles3) | ||
| 605 | "$(ETAGS)" --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ | ||
| 603 | --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ | 606 | --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ |
| 604 | $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) \ | 607 | $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) \ |
| 605 | --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ | 608 | --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ |
| 606 | $(srcdir)/$(ctagsfiles3) | 609 | $(srcdir)/$(ctagsfiles3) |
| 607 | frc: | 610 | |
| 608 | TAGS-LISP: frc | 611 | ## Arrange to make tags tables for ../lisp and ../lwlib, |
| 609 | $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags | 612 | ## which the above TAGS file for the C files includes by reference. |
| 613 | ../lisp/TAGS: | ||
| 614 | cd ../lisp && $(MAKE) TAGS ETAGS="$(ETAGS)" | ||
| 610 | 615 | ||
| 611 | $(lwlibdir)/TAGS: | 616 | $(lwlibdir)/TAGS: |
| 612 | (cd $(lwlibdir); $(MAKE) -f $(lwlibdir)/Makefile tags ETAGS=../lib-src/etags) | 617 | cd $(lwlibdir) && $(MAKE) TAGS ETAGS="$(ETAGS)" |
| 613 | 618 | ||
| 614 | tags: TAGS TAGS-LISP $(lwlibdir)/TAGS | 619 | tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS |
| 615 | .PHONY: tags | 620 | .PHONY: tags |
| 616 | 621 | ||
| 617 | 622 | ||
| @@ -646,7 +651,7 @@ tags: TAGS TAGS-LISP $(lwlibdir)/TAGS | |||
| 646 | ## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" | 651 | ## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" |
| 647 | .el.elc: | 652 | .el.elc: |
| 648 | @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \ | 653 | @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \ |
| 649 | THEFILE=$< EMACS=$(bootstrap_exe) | 654 | THEFILE=$< EMACS="$(bootstrap_exe)" |
| 650 | 655 | ||
| 651 | ## Since the .el.elc rule cannot specify an extra dependency, we do it here. | 656 | ## Since the .el.elc rule cannot specify an extra dependency, we do it here. |
| 652 | $(lisp): $(BOOTSTRAPEMACS) | 657 | $(lisp): $(BOOTSTRAPEMACS) |
| @@ -657,7 +662,7 @@ $(lisp): $(BOOTSTRAPEMACS) | |||
| 657 | VCSWITNESS = | 662 | VCSWITNESS = |
| 658 | 663 | ||
| 659 | $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) | 664 | $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) |
| 660 | cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=$(bootstrap_exe) | 665 | cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS="$(bootstrap_exe)" |
| 661 | 666 | ||
| 662 | ## Dump an Emacs executable named bootstrap-emacs containing the | 667 | ## Dump an Emacs executable named bootstrap-emacs containing the |
| 663 | ## files from loadup.el in source form. | 668 | ## files from loadup.el in source form. |
| @@ -672,7 +677,7 @@ bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) | |||
| 672 | mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ | 677 | mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ |
| 673 | fi | 678 | fi |
| 674 | @: Compile some files earlier to speed up further compilation. | 679 | @: Compile some files earlier to speed up further compilation. |
| 675 | cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=$(bootstrap_exe) | 680 | cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS="$(bootstrap_exe)" |
| 676 | 681 | ||
| 677 | ## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. | 682 | ## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. |
| 678 | @deps_frag@ | 683 | @deps_frag@ |
diff --git a/src/alloc.c b/src/alloc.c index 02deaa94af1..f12fdc5c861 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -361,13 +361,21 @@ static int staticidx; | |||
| 361 | 361 | ||
| 362 | static void *pure_alloc (size_t, int); | 362 | static void *pure_alloc (size_t, int); |
| 363 | 363 | ||
| 364 | /* Return X rounded to the next multiple of Y. Arguments should not | ||
| 365 | have side effects, as they are evaluated more than once. Assume X | ||
| 366 | + Y - 1 does not overflow. Tune for Y being a power of 2. */ | ||
| 364 | 367 | ||
| 365 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. | 368 | #define ROUNDUP(x, y) ((y) & ((y) - 1) \ |
| 366 | ALIGNMENT must be a power of 2. */ | 369 | ? ((x) + (y) - 1) - ((x) + (y) - 1) % (y) \ |
| 370 | : ((x) + (y) - 1) & ~ ((y) - 1)) | ||
| 367 | 371 | ||
| 368 | #define ALIGN(ptr, ALIGNMENT) \ | 372 | /* Return PTR rounded up to the next multiple of ALIGNMENT. */ |
| 369 | ((void *) (((uintptr_t) (ptr) + (ALIGNMENT) - 1) \ | 373 | |
| 370 | & ~ ((ALIGNMENT) - 1))) | 374 | static void * |
| 375 | ALIGN (void *ptr, int alignment) | ||
| 376 | { | ||
| 377 | return (void *) ROUNDUP ((uintptr_t) ptr, alignment); | ||
| 378 | } | ||
| 371 | 379 | ||
| 372 | static void | 380 | static void |
| 373 | XFLOAT_INIT (Lisp_Object f, double n) | 381 | XFLOAT_INIT (Lisp_Object f, double n) |
| @@ -912,8 +920,20 @@ lisp_free (void *block) | |||
| 912 | /* The entry point is lisp_align_malloc which returns blocks of at most | 920 | /* The entry point is lisp_align_malloc which returns blocks of at most |
| 913 | BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */ | 921 | BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */ |
| 914 | 922 | ||
| 915 | #if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC) | 923 | #if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC |
| 916 | #define USE_POSIX_MEMALIGN 1 | 924 | # define USE_ALIGNED_ALLOC 1 |
| 925 | /* Defined in gmalloc.c. */ | ||
| 926 | void *aligned_alloc (size_t, size_t); | ||
| 927 | #elif defined HAVE_ALIGNED_ALLOC | ||
| 928 | # define USE_ALIGNED_ALLOC 1 | ||
| 929 | #elif defined HAVE_POSIX_MEMALIGN | ||
| 930 | # define USE_ALIGNED_ALLOC 1 | ||
| 931 | static void * | ||
| 932 | aligned_alloc (size_t alignment, size_t size) | ||
| 933 | { | ||
| 934 | void *p; | ||
| 935 | return posix_memalign (&p, alignment, size) == 0 ? p : 0; | ||
| 936 | } | ||
| 917 | #endif | 937 | #endif |
| 918 | 938 | ||
| 919 | /* BLOCK_ALIGN has to be a power of 2. */ | 939 | /* BLOCK_ALIGN has to be a power of 2. */ |
| @@ -923,7 +943,7 @@ lisp_free (void *block) | |||
| 923 | malloc a chance to minimize the amount of memory wasted to alignment. | 943 | malloc a chance to minimize the amount of memory wasted to alignment. |
| 924 | It should be tuned to the particular malloc library used. | 944 | It should be tuned to the particular malloc library used. |
| 925 | On glibc-2.3.2, malloc never tries to align, so a padding of 0 is best. | 945 | On glibc-2.3.2, malloc never tries to align, so a padding of 0 is best. |
| 926 | posix_memalign on the other hand would ideally prefer a value of 4 | 946 | aligned_alloc on the other hand would ideally prefer a value of 4 |
| 927 | because otherwise, there's 1020 bytes wasted between each ablocks. | 947 | because otherwise, there's 1020 bytes wasted between each ablocks. |
| 928 | In Emacs, testing shows that those 1020 can most of the time be | 948 | In Emacs, testing shows that those 1020 can most of the time be |
| 929 | efficiently used by malloc to place other objects, so a value of 0 can | 949 | efficiently used by malloc to place other objects, so a value of 0 can |
| @@ -968,7 +988,7 @@ struct ablocks | |||
| 968 | struct ablock blocks[ABLOCKS_SIZE]; | 988 | struct ablock blocks[ABLOCKS_SIZE]; |
| 969 | }; | 989 | }; |
| 970 | 990 | ||
| 971 | /* Size of the block requested from malloc or posix_memalign. */ | 991 | /* Size of the block requested from malloc or aligned_alloc. */ |
| 972 | #define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING) | 992 | #define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING) |
| 973 | 993 | ||
| 974 | #define ABLOCK_ABASE(block) \ | 994 | #define ABLOCK_ABASE(block) \ |
| @@ -980,7 +1000,7 @@ struct ablocks | |||
| 980 | #define ABLOCKS_BUSY(abase) ((abase)->blocks[0].abase) | 1000 | #define ABLOCKS_BUSY(abase) ((abase)->blocks[0].abase) |
| 981 | 1001 | ||
| 982 | /* Pointer to the (not necessarily aligned) malloc block. */ | 1002 | /* Pointer to the (not necessarily aligned) malloc block. */ |
| 983 | #ifdef USE_POSIX_MEMALIGN | 1003 | #ifdef USE_ALIGNED_ALLOC |
| 984 | #define ABLOCKS_BASE(abase) (abase) | 1004 | #define ABLOCKS_BASE(abase) (abase) |
| 985 | #else | 1005 | #else |
| 986 | #define ABLOCKS_BASE(abase) \ | 1006 | #define ABLOCKS_BASE(abase) \ |
| @@ -1019,13 +1039,8 @@ lisp_align_malloc (size_t nbytes, enum mem_type type) | |||
| 1019 | mallopt (M_MMAP_MAX, 0); | 1039 | mallopt (M_MMAP_MAX, 0); |
| 1020 | #endif | 1040 | #endif |
| 1021 | 1041 | ||
| 1022 | #ifdef USE_POSIX_MEMALIGN | 1042 | #ifdef USE_ALIGNED_ALLOC |
| 1023 | { | 1043 | abase = base = aligned_alloc (BLOCK_ALIGN, ABLOCKS_BYTES); |
| 1024 | int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES); | ||
| 1025 | if (err) | ||
| 1026 | base = NULL; | ||
| 1027 | abase = base; | ||
| 1028 | } | ||
| 1029 | #else | 1044 | #else |
| 1030 | base = malloc (ABLOCKS_BYTES); | 1045 | base = malloc (ABLOCKS_BYTES); |
| 1031 | abase = ALIGN (base, BLOCK_ALIGN); | 1046 | abase = ALIGN (base, BLOCK_ALIGN); |
| @@ -1280,28 +1295,32 @@ mark_interval (register INTERVAL i, Lisp_Object dummy) | |||
| 1280 | 1295 | ||
| 1281 | #define LARGE_STRING_BYTES 1024 | 1296 | #define LARGE_STRING_BYTES 1024 |
| 1282 | 1297 | ||
| 1283 | /* Struct or union describing string memory sub-allocated from an sblock. | 1298 | /* The SDATA typedef is a struct or union describing string memory |
| 1284 | This is where the contents of Lisp strings are stored. */ | 1299 | sub-allocated from an sblock. This is where the contents of Lisp |
| 1285 | 1300 | strings are stored. */ | |
| 1286 | #ifdef GC_CHECK_STRING_BYTES | ||
| 1287 | 1301 | ||
| 1288 | typedef struct | 1302 | struct sdata |
| 1289 | { | 1303 | { |
| 1290 | /* Back-pointer to the string this sdata belongs to. If null, this | 1304 | /* Back-pointer to the string this sdata belongs to. If null, this |
| 1291 | structure is free, and the NBYTES member of the union below | 1305 | structure is free, and NBYTES (in this structure or in the union below) |
| 1292 | contains the string's byte size (the same value that STRING_BYTES | 1306 | contains the string's byte size (the same value that STRING_BYTES |
| 1293 | would return if STRING were non-null). If non-null, STRING_BYTES | 1307 | would return if STRING were non-null). If non-null, STRING_BYTES |
| 1294 | (STRING) is the size of the data, and DATA contains the string's | 1308 | (STRING) is the size of the data, and DATA contains the string's |
| 1295 | contents. */ | 1309 | contents. */ |
| 1296 | struct Lisp_String *string; | 1310 | struct Lisp_String *string; |
| 1297 | 1311 | ||
| 1312 | #ifdef GC_CHECK_STRING_BYTES | ||
| 1298 | ptrdiff_t nbytes; | 1313 | ptrdiff_t nbytes; |
| 1314 | #endif | ||
| 1315 | |||
| 1299 | unsigned char data[FLEXIBLE_ARRAY_MEMBER]; | 1316 | unsigned char data[FLEXIBLE_ARRAY_MEMBER]; |
| 1300 | } sdata; | 1317 | }; |
| 1301 | 1318 | ||
| 1319 | #ifdef GC_CHECK_STRING_BYTES | ||
| 1320 | |||
| 1321 | typedef struct sdata sdata; | ||
| 1302 | #define SDATA_NBYTES(S) (S)->nbytes | 1322 | #define SDATA_NBYTES(S) (S)->nbytes |
| 1303 | #define SDATA_DATA(S) (S)->data | 1323 | #define SDATA_DATA(S) (S)->data |
| 1304 | #define SDATA_SELECTOR(member) member | ||
| 1305 | 1324 | ||
| 1306 | #else | 1325 | #else |
| 1307 | 1326 | ||
| @@ -1309,12 +1328,16 @@ typedef union | |||
| 1309 | { | 1328 | { |
| 1310 | struct Lisp_String *string; | 1329 | struct Lisp_String *string; |
| 1311 | 1330 | ||
| 1312 | /* When STRING is non-null. */ | 1331 | /* When STRING is nonnull, this union is actually of type 'struct sdata', |
| 1313 | struct | 1332 | which has a flexible array member. However, if implemented by |
| 1314 | { | 1333 | giving this union a member of type 'struct sdata', the union |
| 1315 | struct Lisp_String *string; | 1334 | could not be the last (flexible) member of 'struct sblock', |
| 1316 | unsigned char data[FLEXIBLE_ARRAY_MEMBER]; | 1335 | because C99 prohibits a flexible array member from having a type |
| 1317 | } u; | 1336 | that is itself a flexible array. So, comment this member out here, |
| 1337 | but remember that the option's there when using this union. */ | ||
| 1338 | #if 0 | ||
| 1339 | struct sdata u; | ||
| 1340 | #endif | ||
| 1318 | 1341 | ||
| 1319 | /* When STRING is null. */ | 1342 | /* When STRING is null. */ |
| 1320 | struct | 1343 | struct |
| @@ -1325,13 +1348,11 @@ typedef union | |||
| 1325 | } sdata; | 1348 | } sdata; |
| 1326 | 1349 | ||
| 1327 | #define SDATA_NBYTES(S) (S)->n.nbytes | 1350 | #define SDATA_NBYTES(S) (S)->n.nbytes |
| 1328 | #define SDATA_DATA(S) (S)->u.data | 1351 | #define SDATA_DATA(S) ((struct sdata *) (S))->data |
| 1329 | #define SDATA_SELECTOR(member) u.member | ||
| 1330 | 1352 | ||
| 1331 | #endif /* not GC_CHECK_STRING_BYTES */ | 1353 | #endif /* not GC_CHECK_STRING_BYTES */ |
| 1332 | 1354 | ||
| 1333 | #define SDATA_DATA_OFFSET offsetof (sdata, SDATA_SELECTOR (data)) | 1355 | enum { SDATA_DATA_OFFSET = offsetof (struct sdata, data) }; |
| 1334 | |||
| 1335 | 1356 | ||
| 1336 | /* Structure describing a block of memory which is sub-allocated to | 1357 | /* Structure describing a block of memory which is sub-allocated to |
| 1337 | obtain string data memory for strings. Blocks for small strings | 1358 | obtain string data memory for strings. Blocks for small strings |
| @@ -1347,8 +1368,8 @@ struct sblock | |||
| 1347 | of the sblock if there isn't any space left in this block. */ | 1368 | of the sblock if there isn't any space left in this block. */ |
| 1348 | sdata *next_free; | 1369 | sdata *next_free; |
| 1349 | 1370 | ||
| 1350 | /* Start of data. */ | 1371 | /* String data. */ |
| 1351 | sdata first_data; | 1372 | sdata data[FLEXIBLE_ARRAY_MEMBER]; |
| 1352 | }; | 1373 | }; |
| 1353 | 1374 | ||
| 1354 | /* Number of Lisp strings in a string_block structure. The 1020 is | 1375 | /* Number of Lisp strings in a string_block structure. The 1020 is |
| @@ -1464,7 +1485,7 @@ static ptrdiff_t const STRING_BYTES_MAX = | |||
| 1464 | min (STRING_BYTES_BOUND, | 1485 | min (STRING_BYTES_BOUND, |
| 1465 | ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD | 1486 | ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD |
| 1466 | - GC_STRING_EXTRA | 1487 | - GC_STRING_EXTRA |
| 1467 | - offsetof (struct sblock, first_data) | 1488 | - offsetof (struct sblock, data) |
| 1468 | - SDATA_DATA_OFFSET) | 1489 | - SDATA_DATA_OFFSET) |
| 1469 | & ~(sizeof (EMACS_INT) - 1))); | 1490 | & ~(sizeof (EMACS_INT) - 1))); |
| 1470 | 1491 | ||
| @@ -1507,7 +1528,7 @@ check_sblock (struct sblock *b) | |||
| 1507 | 1528 | ||
| 1508 | end = b->next_free; | 1529 | end = b->next_free; |
| 1509 | 1530 | ||
| 1510 | for (from = &b->first_data; from < end; from = from_end) | 1531 | for (from = b->data; from < end; from = from_end) |
| 1511 | { | 1532 | { |
| 1512 | /* Compute the next FROM here because copying below may | 1533 | /* Compute the next FROM here because copying below may |
| 1513 | overwrite data we need to compute it. */ | 1534 | overwrite data we need to compute it. */ |
| @@ -1535,7 +1556,7 @@ check_string_bytes (bool all_p) | |||
| 1535 | 1556 | ||
| 1536 | for (b = large_sblocks; b; b = b->next) | 1557 | for (b = large_sblocks; b; b = b->next) |
| 1537 | { | 1558 | { |
| 1538 | struct Lisp_String *s = b->first_data.string; | 1559 | struct Lisp_String *s = b->data[0].string; |
| 1539 | if (s) | 1560 | if (s) |
| 1540 | string_bytes (s); | 1561 | string_bytes (s); |
| 1541 | } | 1562 | } |
| @@ -1669,7 +1690,7 @@ allocate_string_data (struct Lisp_String *s, | |||
| 1669 | 1690 | ||
| 1670 | if (nbytes > LARGE_STRING_BYTES) | 1691 | if (nbytes > LARGE_STRING_BYTES) |
| 1671 | { | 1692 | { |
| 1672 | size_t size = offsetof (struct sblock, first_data) + needed; | 1693 | size_t size = offsetof (struct sblock, data) + needed; |
| 1673 | 1694 | ||
| 1674 | #ifdef DOUG_LEA_MALLOC | 1695 | #ifdef DOUG_LEA_MALLOC |
| 1675 | /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed | 1696 | /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed |
| @@ -1691,8 +1712,8 @@ allocate_string_data (struct Lisp_String *s, | |||
| 1691 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); | 1712 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); |
| 1692 | #endif | 1713 | #endif |
| 1693 | 1714 | ||
| 1694 | b->next_free = &b->first_data; | 1715 | b->next_free = b->data; |
| 1695 | b->first_data.string = NULL; | 1716 | b->data[0].string = NULL; |
| 1696 | b->next = large_sblocks; | 1717 | b->next = large_sblocks; |
| 1697 | large_sblocks = b; | 1718 | large_sblocks = b; |
| 1698 | } | 1719 | } |
| @@ -1703,8 +1724,8 @@ allocate_string_data (struct Lisp_String *s, | |||
| 1703 | { | 1724 | { |
| 1704 | /* Not enough room in the current sblock. */ | 1725 | /* Not enough room in the current sblock. */ |
| 1705 | b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); | 1726 | b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); |
| 1706 | b->next_free = &b->first_data; | 1727 | b->next_free = b->data; |
| 1707 | b->first_data.string = NULL; | 1728 | b->data[0].string = NULL; |
| 1708 | b->next = NULL; | 1729 | b->next = NULL; |
| 1709 | 1730 | ||
| 1710 | if (current_sblock) | 1731 | if (current_sblock) |
| @@ -1858,7 +1879,7 @@ free_large_strings (void) | |||
| 1858 | { | 1879 | { |
| 1859 | next = b->next; | 1880 | next = b->next; |
| 1860 | 1881 | ||
| 1861 | if (b->first_data.string == NULL) | 1882 | if (b->data[0].string == NULL) |
| 1862 | lisp_free (b); | 1883 | lisp_free (b); |
| 1863 | else | 1884 | else |
| 1864 | { | 1885 | { |
| @@ -1885,7 +1906,7 @@ compact_small_strings (void) | |||
| 1885 | to, and TB_END is the end of TB. */ | 1906 | to, and TB_END is the end of TB. */ |
| 1886 | tb = oldest_sblock; | 1907 | tb = oldest_sblock; |
| 1887 | tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); | 1908 | tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); |
| 1888 | to = &tb->first_data; | 1909 | to = tb->data; |
| 1889 | 1910 | ||
| 1890 | /* Step through the blocks from the oldest to the youngest. We | 1911 | /* Step through the blocks from the oldest to the youngest. We |
| 1891 | expect that old blocks will stabilize over time, so that less | 1912 | expect that old blocks will stabilize over time, so that less |
| @@ -1895,7 +1916,7 @@ compact_small_strings (void) | |||
| 1895 | end = b->next_free; | 1916 | end = b->next_free; |
| 1896 | eassert ((char *) end <= (char *) b + SBLOCK_SIZE); | 1917 | eassert ((char *) end <= (char *) b + SBLOCK_SIZE); |
| 1897 | 1918 | ||
| 1898 | for (from = &b->first_data; from < end; from = from_end) | 1919 | for (from = b->data; from < end; from = from_end) |
| 1899 | { | 1920 | { |
| 1900 | /* Compute the next FROM here because copying below may | 1921 | /* Compute the next FROM here because copying below may |
| 1901 | overwrite data we need to compute it. */ | 1922 | overwrite data we need to compute it. */ |
| @@ -1932,7 +1953,7 @@ compact_small_strings (void) | |||
| 1932 | tb->next_free = to; | 1953 | tb->next_free = to; |
| 1933 | tb = tb->next; | 1954 | tb = tb->next; |
| 1934 | tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); | 1955 | tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); |
| 1935 | to = &tb->first_data; | 1956 | to = tb->data; |
| 1936 | to_end = (sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); | 1957 | to_end = (sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); |
| 1937 | } | 1958 | } |
| 1938 | 1959 | ||
| @@ -2020,82 +2041,61 @@ INIT must be an integer that represents a character. */) | |||
| 2020 | return val; | 2041 | return val; |
| 2021 | } | 2042 | } |
| 2022 | 2043 | ||
| 2023 | verify (sizeof (size_t) * CHAR_BIT == BITS_PER_BITS_WORD); | 2044 | /* Fill A with 1 bits if INIT is non-nil, and with 0 bits otherwise. |
| 2024 | verify ((BITS_PER_BITS_WORD & (BITS_PER_BITS_WORD - 1)) == 0); | 2045 | Return A. */ |
| 2025 | 2046 | ||
| 2026 | static ptrdiff_t | 2047 | Lisp_Object |
| 2027 | bool_vector_payload_bytes (ptrdiff_t nr_bits, | 2048 | bool_vector_fill (Lisp_Object a, Lisp_Object init) |
| 2028 | ptrdiff_t *exact_needed_bytes_out) | ||
| 2029 | { | 2049 | { |
| 2030 | ptrdiff_t exact_needed_bytes; | 2050 | EMACS_INT nbits = bool_vector_size (a); |
| 2031 | ptrdiff_t needed_bytes; | 2051 | if (0 < nbits) |
| 2032 | |||
| 2033 | eassume (nr_bits >= 0); | ||
| 2034 | |||
| 2035 | exact_needed_bytes = ROUNDUP ((size_t) nr_bits, CHAR_BIT) / CHAR_BIT; | ||
| 2036 | needed_bytes = ROUNDUP ((size_t) nr_bits, BITS_PER_BITS_WORD) / CHAR_BIT; | ||
| 2037 | |||
| 2038 | if (needed_bytes == 0) | ||
| 2039 | { | 2052 | { |
| 2040 | /* Always allocate at least one machine word of payload so that | 2053 | unsigned char *data = bool_vector_uchar_data (a); |
| 2041 | bool-vector operations in data.c don't need a special case | 2054 | int pattern = NILP (init) ? 0 : (1 << BOOL_VECTOR_BITS_PER_CHAR) - 1; |
| 2042 | for empty vectors. */ | 2055 | ptrdiff_t nbytes = bool_vector_bytes (nbits); |
| 2043 | needed_bytes = sizeof (bits_word); | 2056 | int last_mask = ~ (~0 << ((nbits - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)); |
| 2057 | memset (data, pattern, nbytes - 1); | ||
| 2058 | data[nbytes - 1] = pattern & last_mask; | ||
| 2044 | } | 2059 | } |
| 2045 | 2060 | return a; | |
| 2046 | if (exact_needed_bytes_out != NULL) | ||
| 2047 | *exact_needed_bytes_out = exact_needed_bytes; | ||
| 2048 | |||
| 2049 | return needed_bytes; | ||
| 2050 | } | 2061 | } |
| 2051 | 2062 | ||
| 2052 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, | 2063 | /* Return a newly allocated, uninitialized bool vector of size NBITS. */ |
| 2053 | doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. | 2064 | |
| 2054 | LENGTH must be a number. INIT matters only in whether it is t or nil. */) | 2065 | Lisp_Object |
| 2055 | (Lisp_Object length, Lisp_Object init) | 2066 | make_uninit_bool_vector (EMACS_INT nbits) |
| 2056 | { | 2067 | { |
| 2057 | register Lisp_Object val; | 2068 | Lisp_Object val; |
| 2058 | struct Lisp_Bool_Vector *p; | 2069 | struct Lisp_Bool_Vector *p; |
| 2059 | ptrdiff_t exact_payload_bytes; | 2070 | EMACS_INT word_bytes, needed_elements; |
| 2060 | ptrdiff_t total_payload_bytes; | 2071 | word_bytes = bool_vector_words (nbits) * sizeof (bits_word); |
| 2061 | ptrdiff_t needed_elements; | 2072 | needed_elements = ((bool_header_size - header_size + word_bytes |
| 2062 | 2073 | + word_size - 1) | |
| 2063 | CHECK_NATNUM (length); | 2074 | / word_size); |
| 2064 | if (PTRDIFF_MAX < XFASTINT (length)) | ||
| 2065 | memory_full (SIZE_MAX); | ||
| 2066 | |||
| 2067 | total_payload_bytes = bool_vector_payload_bytes | ||
| 2068 | (XFASTINT (length), &exact_payload_bytes); | ||
| 2069 | |||
| 2070 | eassume (exact_payload_bytes <= total_payload_bytes); | ||
| 2071 | eassume (0 <= exact_payload_bytes); | ||
| 2072 | |||
| 2073 | needed_elements = ROUNDUP ((size_t) ((bool_header_size - header_size) | ||
| 2074 | + total_payload_bytes), | ||
| 2075 | word_size) / word_size; | ||
| 2076 | |||
| 2077 | p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements); | 2075 | p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements); |
| 2078 | XSETVECTOR (val, p); | 2076 | XSETVECTOR (val, p); |
| 2079 | XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0); | 2077 | XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0); |
| 2080 | 2078 | p->size = nbits; | |
| 2081 | p->size = XFASTINT (length); | ||
| 2082 | if (exact_payload_bytes) | ||
| 2083 | { | ||
| 2084 | memset (p->data, ! NILP (init) ? -1 : 0, exact_payload_bytes); | ||
| 2085 | |||
| 2086 | /* Clear any extraneous bits in the last byte. */ | ||
| 2087 | p->data[exact_payload_bytes - 1] | ||
| 2088 | &= (1 << ((XFASTINT (length) - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)) - 1; | ||
| 2089 | } | ||
| 2090 | 2079 | ||
| 2091 | /* Clear padding at the end. */ | 2080 | /* Clear padding at the end. */ |
| 2092 | memset (p->data + exact_payload_bytes, | 2081 | if (nbits) |
| 2093 | 0, | 2082 | p->data[bool_vector_words (nbits) - 1] = 0; |
| 2094 | total_payload_bytes - exact_payload_bytes); | ||
| 2095 | 2083 | ||
| 2096 | return val; | 2084 | return val; |
| 2097 | } | 2085 | } |
| 2098 | 2086 | ||
| 2087 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, | ||
| 2088 | doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. | ||
| 2089 | LENGTH must be a number. INIT matters only in whether it is t or nil. */) | ||
| 2090 | (Lisp_Object length, Lisp_Object init) | ||
| 2091 | { | ||
| 2092 | Lisp_Object val; | ||
| 2093 | |||
| 2094 | CHECK_NATNUM (length); | ||
| 2095 | val = make_uninit_bool_vector (XFASTINT (length)); | ||
| 2096 | return bool_vector_fill (val, init); | ||
| 2097 | } | ||
| 2098 | |||
| 2099 | 2099 | ||
| 2100 | /* Make a string from NBYTES bytes at CONTENTS, and compute the number | 2100 | /* Make a string from NBYTES bytes at CONTENTS, and compute the number |
| 2101 | of characters from the contents. This string may be unibyte or | 2101 | of characters from the contents. This string may be unibyte or |
| @@ -2606,16 +2606,35 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, | |||
| 2606 | Vector Allocation | 2606 | Vector Allocation |
| 2607 | ***********************************************************************/ | 2607 | ***********************************************************************/ |
| 2608 | 2608 | ||
| 2609 | /* Sometimes a vector's contents are merely a pointer internally used | ||
| 2610 | in vector allocation code. Usually you don't want to touch this. */ | ||
| 2611 | |||
| 2612 | static struct Lisp_Vector * | ||
| 2613 | next_vector (struct Lisp_Vector *v) | ||
| 2614 | { | ||
| 2615 | return XUNTAG (v->contents[0], 0); | ||
| 2616 | } | ||
| 2617 | |||
| 2618 | static void | ||
| 2619 | set_next_vector (struct Lisp_Vector *v, struct Lisp_Vector *p) | ||
| 2620 | { | ||
| 2621 | v->contents[0] = make_lisp_ptr (p, 0); | ||
| 2622 | } | ||
| 2623 | |||
| 2609 | /* This value is balanced well enough to avoid too much internal overhead | 2624 | /* This value is balanced well enough to avoid too much internal overhead |
| 2610 | for the most common cases; it's not required to be a power of two, but | 2625 | for the most common cases; it's not required to be a power of two, but |
| 2611 | it's expected to be a mult-of-ROUNDUP_SIZE (see below). */ | 2626 | it's expected to be a mult-of-ROUNDUP_SIZE (see below). */ |
| 2612 | 2627 | ||
| 2613 | #define VECTOR_BLOCK_SIZE 4096 | 2628 | #define VECTOR_BLOCK_SIZE 4096 |
| 2614 | 2629 | ||
| 2615 | /* Align allocation request sizes to be a multiple of ROUNDUP_SIZE. */ | ||
| 2616 | enum | 2630 | enum |
| 2617 | { | 2631 | { |
| 2618 | roundup_size = COMMON_MULTIPLE (word_size, USE_LSB_TAG ? GCALIGNMENT : 1) | 2632 | /* Alignment of struct Lisp_Vector objects. */ |
| 2633 | vector_alignment = COMMON_MULTIPLE (ALIGNOF_STRUCT_LISP_VECTOR, | ||
| 2634 | USE_LSB_TAG ? GCALIGNMENT : 1), | ||
| 2635 | |||
| 2636 | /* Vector size requests are a multiple of this. */ | ||
| 2637 | roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) | ||
| 2619 | }; | 2638 | }; |
| 2620 | 2639 | ||
| 2621 | /* Verify assumptions described above. */ | 2640 | /* Verify assumptions described above. */ |
| @@ -2623,7 +2642,7 @@ verify ((VECTOR_BLOCK_SIZE % roundup_size) == 0); | |||
| 2623 | verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS)); | 2642 | verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS)); |
| 2624 | 2643 | ||
| 2625 | /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */ | 2644 | /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */ |
| 2626 | #define vroundup_ct(x) ROUNDUP ((size_t) (x), roundup_size) | 2645 | #define vroundup_ct(x) ROUNDUP (x, roundup_size) |
| 2627 | /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */ | 2646 | /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */ |
| 2628 | #define vroundup(x) (eassume ((x) >= 0), vroundup_ct (x)) | 2647 | #define vroundup(x) (eassume ((x) >= 0), vroundup_ct (x)) |
| 2629 | 2648 | ||
| @@ -2663,26 +2682,37 @@ verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS)); | |||
| 2663 | eassert ((nbytes) % roundup_size == 0); \ | 2682 | eassert ((nbytes) % roundup_size == 0); \ |
| 2664 | (tmp) = VINDEX (nbytes); \ | 2683 | (tmp) = VINDEX (nbytes); \ |
| 2665 | eassert ((tmp) < VECTOR_MAX_FREE_LIST_INDEX); \ | 2684 | eassert ((tmp) < VECTOR_MAX_FREE_LIST_INDEX); \ |
| 2666 | v->u.next = vector_free_lists[tmp]; \ | 2685 | set_next_vector (v, vector_free_lists[tmp]); \ |
| 2667 | vector_free_lists[tmp] = (v); \ | 2686 | vector_free_lists[tmp] = (v); \ |
| 2668 | total_free_vector_slots += (nbytes) / word_size; \ | 2687 | total_free_vector_slots += (nbytes) / word_size; \ |
| 2669 | } while (0) | 2688 | } while (0) |
| 2670 | 2689 | ||
| 2671 | /* This internal type is used to maintain the list of large vectors | 2690 | /* This internal type is used to maintain the list of large vectors |
| 2672 | which are allocated at their own, e.g. outside of vector blocks. */ | 2691 | which are allocated at their own, e.g. outside of vector blocks. |
| 2692 | |||
| 2693 | struct large_vector itself cannot contain a struct Lisp_Vector, as | ||
| 2694 | the latter contains a flexible array member and C99 does not allow | ||
| 2695 | such structs to be nested. Instead, each struct large_vector | ||
| 2696 | object LV is followed by a struct Lisp_Vector, which is at offset | ||
| 2697 | large_vector_offset from LV, and whose address is therefore | ||
| 2698 | large_vector_vec (&LV). */ | ||
| 2673 | 2699 | ||
| 2674 | struct large_vector | 2700 | struct large_vector |
| 2675 | { | 2701 | { |
| 2676 | union { | 2702 | struct large_vector *next; |
| 2677 | struct large_vector *vector; | ||
| 2678 | #if USE_LSB_TAG | ||
| 2679 | /* We need to maintain ROUNDUP_SIZE alignment for the vector member. */ | ||
| 2680 | unsigned char c[vroundup_ct (sizeof (struct large_vector *))]; | ||
| 2681 | #endif | ||
| 2682 | } next; | ||
| 2683 | struct Lisp_Vector v; | ||
| 2684 | }; | 2703 | }; |
| 2685 | 2704 | ||
| 2705 | enum | ||
| 2706 | { | ||
| 2707 | large_vector_offset = ROUNDUP (sizeof (struct large_vector), vector_alignment) | ||
| 2708 | }; | ||
| 2709 | |||
| 2710 | static struct Lisp_Vector * | ||
| 2711 | large_vector_vec (struct large_vector *p) | ||
| 2712 | { | ||
| 2713 | return (struct Lisp_Vector *) ((char *) p + large_vector_offset); | ||
| 2714 | } | ||
| 2715 | |||
| 2686 | /* This internal type is used to maintain an underlying storage | 2716 | /* This internal type is used to maintain an underlying storage |
| 2687 | for small vectors. */ | 2717 | for small vectors. */ |
| 2688 | 2718 | ||
| @@ -2760,7 +2790,7 @@ allocate_vector_from_block (size_t nbytes) | |||
| 2760 | if (vector_free_lists[index]) | 2790 | if (vector_free_lists[index]) |
| 2761 | { | 2791 | { |
| 2762 | vector = vector_free_lists[index]; | 2792 | vector = vector_free_lists[index]; |
| 2763 | vector_free_lists[index] = vector->u.next; | 2793 | vector_free_lists[index] = next_vector (vector); |
| 2764 | total_free_vector_slots -= nbytes / word_size; | 2794 | total_free_vector_slots -= nbytes / word_size; |
| 2765 | return vector; | 2795 | return vector; |
| 2766 | } | 2796 | } |
| @@ -2774,7 +2804,7 @@ allocate_vector_from_block (size_t nbytes) | |||
| 2774 | { | 2804 | { |
| 2775 | /* This vector is larger than requested. */ | 2805 | /* This vector is larger than requested. */ |
| 2776 | vector = vector_free_lists[index]; | 2806 | vector = vector_free_lists[index]; |
| 2777 | vector_free_lists[index] = vector->u.next; | 2807 | vector_free_lists[index] = next_vector (vector); |
| 2778 | total_free_vector_slots -= nbytes / word_size; | 2808 | total_free_vector_slots -= nbytes / word_size; |
| 2779 | 2809 | ||
| 2780 | /* Excess bytes are used for the smaller vector, | 2810 | /* Excess bytes are used for the smaller vector, |
| @@ -2814,27 +2844,40 @@ static ptrdiff_t | |||
| 2814 | vector_nbytes (struct Lisp_Vector *v) | 2844 | vector_nbytes (struct Lisp_Vector *v) |
| 2815 | { | 2845 | { |
| 2816 | ptrdiff_t size = v->header.size & ~ARRAY_MARK_FLAG; | 2846 | ptrdiff_t size = v->header.size & ~ARRAY_MARK_FLAG; |
| 2847 | ptrdiff_t nwords; | ||
| 2817 | 2848 | ||
| 2818 | if (size & PSEUDOVECTOR_FLAG) | 2849 | if (size & PSEUDOVECTOR_FLAG) |
| 2819 | { | 2850 | { |
| 2820 | if (PSEUDOVECTOR_TYPEP (&v->header, PVEC_BOOL_VECTOR)) | 2851 | if (PSEUDOVECTOR_TYPEP (&v->header, PVEC_BOOL_VECTOR)) |
| 2821 | { | 2852 | { |
| 2822 | struct Lisp_Bool_Vector *bv = (struct Lisp_Bool_Vector *) v; | 2853 | struct Lisp_Bool_Vector *bv = (struct Lisp_Bool_Vector *) v; |
| 2823 | ptrdiff_t payload_bytes = | 2854 | ptrdiff_t word_bytes = (bool_vector_words (bv->size) |
| 2824 | bool_vector_payload_bytes (bv->size, NULL); | 2855 | * sizeof (bits_word)); |
| 2825 | 2856 | ptrdiff_t boolvec_bytes = bool_header_size + word_bytes; | |
| 2826 | eassume (payload_bytes >= 0); | 2857 | verify (header_size <= bool_header_size); |
| 2827 | size = bool_header_size + ROUNDUP (payload_bytes, word_size); | 2858 | nwords = (boolvec_bytes - header_size + word_size - 1) / word_size; |
| 2828 | } | 2859 | } |
| 2829 | else | 2860 | else |
| 2830 | size = (header_size | 2861 | nwords = ((size & PSEUDOVECTOR_SIZE_MASK) |
| 2831 | + ((size & PSEUDOVECTOR_SIZE_MASK) | 2862 | + ((size & PSEUDOVECTOR_REST_MASK) |
| 2832 | + ((size & PSEUDOVECTOR_REST_MASK) | 2863 | >> PSEUDOVECTOR_SIZE_BITS)); |
| 2833 | >> PSEUDOVECTOR_SIZE_BITS)) * word_size); | ||
| 2834 | } | 2864 | } |
| 2835 | else | 2865 | else |
| 2836 | size = header_size + size * word_size; | 2866 | nwords = size; |
| 2837 | return vroundup (size); | 2867 | return vroundup (header_size + word_size * nwords); |
| 2868 | } | ||
| 2869 | |||
| 2870 | /* Release extra resources still in use by VECTOR, which may be any | ||
| 2871 | vector-like object. For now, this is used just to free data in | ||
| 2872 | font objects. */ | ||
| 2873 | |||
| 2874 | static void | ||
| 2875 | cleanup_vector (struct Lisp_Vector *vector) | ||
| 2876 | { | ||
| 2877 | if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT) | ||
| 2878 | && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) | ||
| 2879 | == FONT_OBJECT_MAX)) | ||
| 2880 | ((struct font *) vector)->driver->close ((struct font *) vector); | ||
| 2838 | } | 2881 | } |
| 2839 | 2882 | ||
| 2840 | /* Reclaim space used by unmarked vectors. */ | 2883 | /* Reclaim space used by unmarked vectors. */ |
| @@ -2871,6 +2914,7 @@ sweep_vectors (void) | |||
| 2871 | { | 2914 | { |
| 2872 | ptrdiff_t total_bytes; | 2915 | ptrdiff_t total_bytes; |
| 2873 | 2916 | ||
| 2917 | cleanup_vector (vector); | ||
| 2874 | nbytes = vector_nbytes (vector); | 2918 | nbytes = vector_nbytes (vector); |
| 2875 | total_bytes = nbytes; | 2919 | total_bytes = nbytes; |
| 2876 | next = ADVANCE (vector, nbytes); | 2920 | next = ADVANCE (vector, nbytes); |
| @@ -2882,6 +2926,7 @@ sweep_vectors (void) | |||
| 2882 | { | 2926 | { |
| 2883 | if (VECTOR_MARKED_P (next)) | 2927 | if (VECTOR_MARKED_P (next)) |
| 2884 | break; | 2928 | break; |
| 2929 | cleanup_vector (next); | ||
| 2885 | nbytes = vector_nbytes (next); | 2930 | nbytes = vector_nbytes (next); |
| 2886 | total_bytes += nbytes; | 2931 | total_bytes += nbytes; |
| 2887 | next = ADVANCE (next, nbytes); | 2932 | next = ADVANCE (next, nbytes); |
| @@ -2918,7 +2963,7 @@ sweep_vectors (void) | |||
| 2918 | 2963 | ||
| 2919 | for (lv = large_vectors; lv; lv = *lvprev) | 2964 | for (lv = large_vectors; lv; lv = *lvprev) |
| 2920 | { | 2965 | { |
| 2921 | vector = &lv->v; | 2966 | vector = large_vector_vec (lv); |
| 2922 | if (VECTOR_MARKED_P (vector)) | 2967 | if (VECTOR_MARKED_P (vector)) |
| 2923 | { | 2968 | { |
| 2924 | VECTOR_UNMARK (vector); | 2969 | VECTOR_UNMARK (vector); |
| @@ -2934,11 +2979,11 @@ sweep_vectors (void) | |||
| 2934 | else | 2979 | else |
| 2935 | total_vector_slots | 2980 | total_vector_slots |
| 2936 | += header_size / word_size + vector->header.size; | 2981 | += header_size / word_size + vector->header.size; |
| 2937 | lvprev = &lv->next.vector; | 2982 | lvprev = &lv->next; |
| 2938 | } | 2983 | } |
| 2939 | else | 2984 | else |
| 2940 | { | 2985 | { |
| 2941 | *lvprev = lv->next.vector; | 2986 | *lvprev = lv->next; |
| 2942 | lisp_free (lv); | 2987 | lisp_free (lv); |
| 2943 | } | 2988 | } |
| 2944 | } | 2989 | } |
| @@ -2972,12 +3017,12 @@ allocate_vectorlike (ptrdiff_t len) | |||
| 2972 | else | 3017 | else |
| 2973 | { | 3018 | { |
| 2974 | struct large_vector *lv | 3019 | struct large_vector *lv |
| 2975 | = lisp_malloc ((offsetof (struct large_vector, v.u.contents) | 3020 | = lisp_malloc ((large_vector_offset + header_size |
| 2976 | + len * word_size), | 3021 | + len * word_size), |
| 2977 | MEM_TYPE_VECTORLIKE); | 3022 | MEM_TYPE_VECTORLIKE); |
| 2978 | lv->next.vector = large_vectors; | 3023 | lv->next = large_vectors; |
| 2979 | large_vectors = lv; | 3024 | large_vectors = lv; |
| 2980 | p = &lv->v; | 3025 | p = large_vector_vec (lv); |
| 2981 | } | 3026 | } |
| 2982 | 3027 | ||
| 2983 | #ifdef DOUG_LEA_MALLOC | 3028 | #ifdef DOUG_LEA_MALLOC |
| @@ -3026,7 +3071,7 @@ allocate_pseudovector (int memlen, int lisplen, enum pvec_type tag) | |||
| 3026 | 3071 | ||
| 3027 | /* Only the first lisplen slots will be traced normally by the GC. */ | 3072 | /* Only the first lisplen slots will be traced normally by the GC. */ |
| 3028 | for (i = 0; i < lisplen; ++i) | 3073 | for (i = 0; i < lisplen; ++i) |
| 3029 | v->u.contents[i] = Qnil; | 3074 | v->contents[i] = Qnil; |
| 3030 | 3075 | ||
| 3031 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); | 3076 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); |
| 3032 | return v; | 3077 | return v; |
| @@ -3114,7 +3159,7 @@ See also the function `vector'. */) | |||
| 3114 | p = allocate_vector (XFASTINT (length)); | 3159 | p = allocate_vector (XFASTINT (length)); |
| 3115 | sizei = XFASTINT (length); | 3160 | sizei = XFASTINT (length); |
| 3116 | for (i = 0; i < sizei; i++) | 3161 | for (i = 0; i < sizei; i++) |
| 3117 | p->u.contents[i] = init; | 3162 | p->contents[i] = init; |
| 3118 | 3163 | ||
| 3119 | XSETVECTOR (vector, p); | 3164 | XSETVECTOR (vector, p); |
| 3120 | return vector; | 3165 | return vector; |
| @@ -3132,7 +3177,7 @@ usage: (vector &rest OBJECTS) */) | |||
| 3132 | register struct Lisp_Vector *p = XVECTOR (val); | 3177 | register struct Lisp_Vector *p = XVECTOR (val); |
| 3133 | 3178 | ||
| 3134 | for (i = 0; i < nargs; i++) | 3179 | for (i = 0; i < nargs; i++) |
| 3135 | p->u.contents[i] = args[i]; | 3180 | p->contents[i] = args[i]; |
| 3136 | return val; | 3181 | return val; |
| 3137 | } | 3182 | } |
| 3138 | 3183 | ||
| @@ -3141,14 +3186,14 @@ make_byte_code (struct Lisp_Vector *v) | |||
| 3141 | { | 3186 | { |
| 3142 | /* Don't allow the global zero_vector to become a byte code object. */ | 3187 | /* Don't allow the global zero_vector to become a byte code object. */ |
| 3143 | eassert(0 < v->header.size); | 3188 | eassert(0 < v->header.size); |
| 3144 | if (v->header.size > 1 && STRINGP (v->u.contents[1]) | 3189 | if (v->header.size > 1 && STRINGP (v->contents[1]) |
| 3145 | && STRING_MULTIBYTE (v->u.contents[1])) | 3190 | && STRING_MULTIBYTE (v->contents[1])) |
| 3146 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the | 3191 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the |
| 3147 | earlier because they produced a raw 8-bit string for byte-code | 3192 | earlier because they produced a raw 8-bit string for byte-code |
| 3148 | and now such a byte-code string is loaded as multibyte while | 3193 | and now such a byte-code string is loaded as multibyte while |
| 3149 | raw 8-bit characters converted to multibyte form. Thus, now we | 3194 | raw 8-bit characters converted to multibyte form. Thus, now we |
| 3150 | must convert them back to the original unibyte form. */ | 3195 | must convert them back to the original unibyte form. */ |
| 3151 | v->u.contents[1] = Fstring_as_unibyte (v->u.contents[1]); | 3196 | v->contents[1] = Fstring_as_unibyte (v->contents[1]); |
| 3152 | XSETPVECTYPE (v, PVEC_COMPILED); | 3197 | XSETPVECTYPE (v, PVEC_COMPILED); |
| 3153 | } | 3198 | } |
| 3154 | 3199 | ||
| @@ -3183,7 +3228,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT | |||
| 3183 | to be setcar'd). */ | 3228 | to be setcar'd). */ |
| 3184 | 3229 | ||
| 3185 | for (i = 0; i < nargs; i++) | 3230 | for (i = 0; i < nargs; i++) |
| 3186 | p->u.contents[i] = args[i]; | 3231 | p->contents[i] = args[i]; |
| 3187 | make_byte_code (p); | 3232 | make_byte_code (p); |
| 3188 | XSETCOMPILED (val, p); | 3233 | XSETCOMPILED (val, p); |
| 3189 | return val; | 3234 | return val; |
| @@ -4241,9 +4286,7 @@ live_vector_p (struct mem_node *m, void *p) | |||
| 4241 | vector = ADVANCE (vector, vector_nbytes (vector)); | 4286 | vector = ADVANCE (vector, vector_nbytes (vector)); |
| 4242 | } | 4287 | } |
| 4243 | } | 4288 | } |
| 4244 | else if (m->type == MEM_TYPE_VECTORLIKE | 4289 | else if (m->type == MEM_TYPE_VECTORLIKE && p == large_vector_vec (m->start)) |
| 4245 | && (char *) p == ((char *) m->start | ||
| 4246 | + offsetof (struct large_vector, v))) | ||
| 4247 | /* This memory node corresponds to a large vector. */ | 4290 | /* This memory node corresponds to a large vector. */ |
| 4248 | return 1; | 4291 | return 1; |
| 4249 | return 0; | 4292 | return 0; |
| @@ -5174,7 +5217,7 @@ Does not copy symbols. Copies strings without text properties. */) | |||
| 5174 | size &= PSEUDOVECTOR_SIZE_MASK; | 5217 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 5175 | vec = XVECTOR (make_pure_vector (size)); | 5218 | vec = XVECTOR (make_pure_vector (size)); |
| 5176 | for (i = 0; i < size; i++) | 5219 | for (i = 0; i < size; i++) |
| 5177 | vec->u.contents[i] = Fpurecopy (AREF (obj, i)); | 5220 | vec->contents[i] = Fpurecopy (AREF (obj, i)); |
| 5178 | if (COMPILEDP (obj)) | 5221 | if (COMPILEDP (obj)) |
| 5179 | { | 5222 | { |
| 5180 | XSETPVECTYPE (vec, PVEC_COMPILED); | 5223 | XSETPVECTYPE (vec, PVEC_COMPILED); |
| @@ -5254,6 +5297,95 @@ total_bytes_of_live_objects (void) | |||
| 5254 | return tot; | 5297 | return tot; |
| 5255 | } | 5298 | } |
| 5256 | 5299 | ||
| 5300 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 5301 | |||
| 5302 | /* Remove unmarked font-spec and font-entity objects from ENTRY, which is | ||
| 5303 | (DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...), and return changed entry. */ | ||
| 5304 | |||
| 5305 | static Lisp_Object | ||
| 5306 | compact_font_cache_entry (Lisp_Object entry) | ||
| 5307 | { | ||
| 5308 | Lisp_Object tail, *prev = &entry; | ||
| 5309 | |||
| 5310 | for (tail = entry; CONSP (tail); tail = XCDR (tail)) | ||
| 5311 | { | ||
| 5312 | bool drop = 0; | ||
| 5313 | Lisp_Object obj = XCAR (tail); | ||
| 5314 | |||
| 5315 | /* Consider OBJ if it is (font-spec . [font-entity font-entity ...]). */ | ||
| 5316 | if (CONSP (obj) && FONT_SPEC_P (XCAR (obj)) | ||
| 5317 | && !VECTOR_MARKED_P (XFONT_SPEC (XCAR (obj))) | ||
| 5318 | && VECTORP (XCDR (obj))) | ||
| 5319 | { | ||
| 5320 | ptrdiff_t i, size = ASIZE (XCDR (obj)) & ~ARRAY_MARK_FLAG; | ||
| 5321 | |||
| 5322 | /* If font-spec is not marked, most likely all font-entities | ||
| 5323 | are not marked too. But we must be sure that nothing is | ||
| 5324 | marked within OBJ before we really drop it. */ | ||
| 5325 | for (i = 0; i < size; i++) | ||
| 5326 | if (VECTOR_MARKED_P (XFONT_ENTITY (AREF (XCDR (obj), i)))) | ||
| 5327 | break; | ||
| 5328 | |||
| 5329 | if (i == size) | ||
| 5330 | drop = 1; | ||
| 5331 | } | ||
| 5332 | if (drop) | ||
| 5333 | *prev = XCDR (tail); | ||
| 5334 | else | ||
| 5335 | prev = xcdr_addr (tail); | ||
| 5336 | } | ||
| 5337 | return entry; | ||
| 5338 | } | ||
| 5339 | |||
| 5340 | /* Compact font caches on all terminals and mark | ||
| 5341 | everything which is still here after compaction. */ | ||
| 5342 | |||
| 5343 | static void | ||
| 5344 | compact_font_caches (void) | ||
| 5345 | { | ||
| 5346 | struct terminal *t; | ||
| 5347 | |||
| 5348 | for (t = terminal_list; t; t = t->next_terminal) | ||
| 5349 | { | ||
| 5350 | Lisp_Object cache = TERMINAL_FONT_CACHE (t); | ||
| 5351 | |||
| 5352 | if (CONSP (cache)) | ||
| 5353 | { | ||
| 5354 | Lisp_Object entry; | ||
| 5355 | |||
| 5356 | for (entry = XCDR (cache); CONSP (entry); entry = XCDR (entry)) | ||
| 5357 | XSETCAR (entry, compact_font_cache_entry (XCAR (entry))); | ||
| 5358 | } | ||
| 5359 | mark_object (cache); | ||
| 5360 | } | ||
| 5361 | } | ||
| 5362 | |||
| 5363 | #else /* not HAVE_WINDOW_SYSTEM */ | ||
| 5364 | |||
| 5365 | #define compact_font_caches() (void)(0) | ||
| 5366 | |||
| 5367 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 5368 | |||
| 5369 | /* Remove (MARKER . DATA) entries with unmarked MARKER | ||
| 5370 | from buffer undo LIST and return changed list. */ | ||
| 5371 | |||
| 5372 | static Lisp_Object | ||
| 5373 | compact_undo_list (Lisp_Object list) | ||
| 5374 | { | ||
| 5375 | Lisp_Object tail, *prev = &list; | ||
| 5376 | |||
| 5377 | for (tail = list; CONSP (tail); tail = XCDR (tail)) | ||
| 5378 | { | ||
| 5379 | if (CONSP (XCAR (tail)) | ||
| 5380 | && MARKERP (XCAR (XCAR (tail))) | ||
| 5381 | && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) | ||
| 5382 | *prev = XCDR (tail); | ||
| 5383 | else | ||
| 5384 | prev = xcdr_addr (tail); | ||
| 5385 | } | ||
| 5386 | return list; | ||
| 5387 | } | ||
| 5388 | |||
| 5257 | DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", | 5389 | DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", |
| 5258 | doc: /* Reclaim storage for Lisp objects no longer needed. | 5390 | doc: /* Reclaim storage for Lisp objects no longer needed. |
| 5259 | Garbage collection happens automatically if you cons more than | 5391 | Garbage collection happens automatically if you cons more than |
| @@ -5392,46 +5524,19 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5392 | mark_stack (); | 5524 | mark_stack (); |
| 5393 | #endif | 5525 | #endif |
| 5394 | 5526 | ||
| 5395 | /* Everything is now marked, except for the things that require special | 5527 | /* Everything is now marked, except for the data in font caches |
| 5396 | finalization, i.e. the undo_list. | 5528 | and undo lists. They're compacted by removing an items which |
| 5397 | Look thru every buffer's undo list | 5529 | aren't reachable otherwise. */ |
| 5398 | for elements that update markers that were not marked, | 5530 | |
| 5399 | and delete them. */ | 5531 | compact_font_caches (); |
| 5532 | |||
| 5400 | FOR_EACH_BUFFER (nextb) | 5533 | FOR_EACH_BUFFER (nextb) |
| 5401 | { | 5534 | { |
| 5402 | /* If a buffer's undo list is Qt, that means that undo is | 5535 | if (!EQ (BVAR (nextb, undo_list), Qt)) |
| 5403 | turned off in that buffer. Calling truncate_undo_list on | 5536 | bset_undo_list (nextb, compact_undo_list (BVAR (nextb, undo_list))); |
| 5404 | Qt tends to return NULL, which effectively turns undo back on. | 5537 | /* Now that we have stripped the elements that need not be |
| 5405 | So don't call truncate_undo_list if undo_list is Qt. */ | 5538 | in the undo_list any more, we can finally mark the list. */ |
| 5406 | if (! EQ (nextb->INTERNAL_FIELD (undo_list), Qt)) | 5539 | mark_object (BVAR (nextb, undo_list)); |
| 5407 | { | ||
| 5408 | Lisp_Object tail, prev; | ||
| 5409 | tail = nextb->INTERNAL_FIELD (undo_list); | ||
| 5410 | prev = Qnil; | ||
| 5411 | while (CONSP (tail)) | ||
| 5412 | { | ||
| 5413 | if (CONSP (XCAR (tail)) | ||
| 5414 | && MARKERP (XCAR (XCAR (tail))) | ||
| 5415 | && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) | ||
| 5416 | { | ||
| 5417 | if (NILP (prev)) | ||
| 5418 | nextb->INTERNAL_FIELD (undo_list) = tail = XCDR (tail); | ||
| 5419 | else | ||
| 5420 | { | ||
| 5421 | tail = XCDR (tail); | ||
| 5422 | XSETCDR (prev, tail); | ||
| 5423 | } | ||
| 5424 | } | ||
| 5425 | else | ||
| 5426 | { | ||
| 5427 | prev = tail; | ||
| 5428 | tail = XCDR (tail); | ||
| 5429 | } | ||
| 5430 | } | ||
| 5431 | } | ||
| 5432 | /* Now that we have stripped the elements that need not be in the | ||
| 5433 | undo_list any more, we can finally mark the list. */ | ||
| 5434 | mark_object (nextb->INTERNAL_FIELD (undo_list)); | ||
| 5435 | } | 5540 | } |
| 5436 | 5541 | ||
| 5437 | gc_sweep (); | 5542 | gc_sweep (); |
| @@ -5603,30 +5708,6 @@ mark_glyph_matrix (struct glyph_matrix *matrix) | |||
| 5603 | } | 5708 | } |
| 5604 | } | 5709 | } |
| 5605 | 5710 | ||
| 5606 | |||
| 5607 | /* Mark Lisp faces in the face cache C. */ | ||
| 5608 | |||
| 5609 | static void | ||
| 5610 | mark_face_cache (struct face_cache *c) | ||
| 5611 | { | ||
| 5612 | if (c) | ||
| 5613 | { | ||
| 5614 | int i, j; | ||
| 5615 | for (i = 0; i < c->used; ++i) | ||
| 5616 | { | ||
| 5617 | struct face *face = FACE_FROM_ID (c->f, i); | ||
| 5618 | |||
| 5619 | if (face) | ||
| 5620 | { | ||
| 5621 | for (j = 0; j < LFACE_VECTOR_SIZE; ++j) | ||
| 5622 | mark_object (face->lface[j]); | ||
| 5623 | } | ||
| 5624 | } | ||
| 5625 | } | ||
| 5626 | } | ||
| 5627 | |||
| 5628 | |||
| 5629 | |||
| 5630 | /* Mark reference to a Lisp_Object. | 5711 | /* Mark reference to a Lisp_Object. |
| 5631 | If the object referred to has not been seen yet, recursively mark | 5712 | If the object referred to has not been seen yet, recursively mark |
| 5632 | all the references contained in it. */ | 5713 | all the references contained in it. */ |
| @@ -5657,7 +5738,7 @@ mark_vectorlike (struct Lisp_Vector *ptr) | |||
| 5657 | The distinction is used e.g. by Lisp_Process which places extra | 5738 | The distinction is used e.g. by Lisp_Process which places extra |
| 5658 | non-Lisp_Object fields at the end of the structure... */ | 5739 | non-Lisp_Object fields at the end of the structure... */ |
| 5659 | for (i = 0; i < size; i++) /* ...and then mark its elements. */ | 5740 | for (i = 0; i < size; i++) /* ...and then mark its elements. */ |
| 5660 | mark_object (ptr->u.contents[i]); | 5741 | mark_object (ptr->contents[i]); |
| 5661 | } | 5742 | } |
| 5662 | 5743 | ||
| 5663 | /* Like mark_vectorlike but optimized for char-tables (and | 5744 | /* Like mark_vectorlike but optimized for char-tables (and |
| @@ -5674,7 +5755,7 @@ mark_char_table (struct Lisp_Vector *ptr) | |||
| 5674 | VECTOR_MARK (ptr); | 5755 | VECTOR_MARK (ptr); |
| 5675 | for (i = 0; i < size; i++) | 5756 | for (i = 0; i < size; i++) |
| 5676 | { | 5757 | { |
| 5677 | Lisp_Object val = ptr->u.contents[i]; | 5758 | Lisp_Object val = ptr->contents[i]; |
| 5678 | 5759 | ||
| 5679 | if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)) | 5760 | if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)) |
| 5680 | continue; | 5761 | continue; |
| @@ -5726,6 +5807,30 @@ mark_buffer (struct buffer *buffer) | |||
| 5726 | mark_buffer (buffer->base_buffer); | 5807 | mark_buffer (buffer->base_buffer); |
| 5727 | } | 5808 | } |
| 5728 | 5809 | ||
| 5810 | /* Mark Lisp faces in the face cache C. */ | ||
| 5811 | |||
| 5812 | static void | ||
| 5813 | mark_face_cache (struct face_cache *c) | ||
| 5814 | { | ||
| 5815 | if (c) | ||
| 5816 | { | ||
| 5817 | int i, j; | ||
| 5818 | for (i = 0; i < c->used; ++i) | ||
| 5819 | { | ||
| 5820 | struct face *face = FACE_FROM_ID (c->f, i); | ||
| 5821 | |||
| 5822 | if (face) | ||
| 5823 | { | ||
| 5824 | if (face->font && !VECTOR_MARKED_P (face->font)) | ||
| 5825 | mark_vectorlike ((struct Lisp_Vector *) face->font); | ||
| 5826 | |||
| 5827 | for (j = 0; j < LFACE_VECTOR_SIZE; ++j) | ||
| 5828 | mark_object (face->lface[j]); | ||
| 5829 | } | ||
| 5830 | } | ||
| 5831 | } | ||
| 5832 | } | ||
| 5833 | |||
| 5729 | /* Remove killed buffers or items whose car is a killed buffer from | 5834 | /* Remove killed buffers or items whose car is a killed buffer from |
| 5730 | LIST, and mark other items. Return changed LIST, which is marked. */ | 5835 | LIST, and mark other items. Return changed LIST, which is marked. */ |
| 5731 | 5836 | ||
| @@ -5879,18 +5984,31 @@ mark_object (Lisp_Object arg) | |||
| 5879 | VECTOR_MARK (ptr); | 5984 | VECTOR_MARK (ptr); |
| 5880 | for (i = 0; i < size; i++) | 5985 | for (i = 0; i < size; i++) |
| 5881 | if (i != COMPILED_CONSTANTS) | 5986 | if (i != COMPILED_CONSTANTS) |
| 5882 | mark_object (ptr->u.contents[i]); | 5987 | mark_object (ptr->contents[i]); |
| 5883 | if (size > COMPILED_CONSTANTS) | 5988 | if (size > COMPILED_CONSTANTS) |
| 5884 | { | 5989 | { |
| 5885 | obj = ptr->u.contents[COMPILED_CONSTANTS]; | 5990 | obj = ptr->contents[COMPILED_CONSTANTS]; |
| 5886 | goto loop; | 5991 | goto loop; |
| 5887 | } | 5992 | } |
| 5888 | } | 5993 | } |
| 5889 | break; | 5994 | break; |
| 5890 | 5995 | ||
| 5891 | case PVEC_FRAME: | 5996 | case PVEC_FRAME: |
| 5892 | mark_vectorlike (ptr); | 5997 | { |
| 5893 | mark_face_cache (((struct frame *) ptr)->face_cache); | 5998 | struct frame *f = (struct frame *) ptr; |
| 5999 | |||
| 6000 | mark_vectorlike (ptr); | ||
| 6001 | mark_face_cache (f->face_cache); | ||
| 6002 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 6003 | if (FRAME_WINDOW_P (f) && FRAME_X_OUTPUT (f)) | ||
| 6004 | { | ||
| 6005 | struct font *font = FRAME_FONT (f); | ||
| 6006 | |||
| 6007 | if (font && !VECTOR_MARKED_P (font)) | ||
| 6008 | mark_vectorlike ((struct Lisp_Vector *) font); | ||
| 6009 | } | ||
| 6010 | #endif | ||
| 6011 | } | ||
| 5894 | break; | 6012 | break; |
| 5895 | 6013 | ||
| 5896 | case PVEC_WINDOW: | 6014 | case PVEC_WINDOW: |
| @@ -6118,9 +6236,6 @@ mark_terminals (void) | |||
| 6118 | it might have been marked already. Make sure the image cache | 6236 | it might have been marked already. Make sure the image cache |
| 6119 | gets marked. */ | 6237 | gets marked. */ |
| 6120 | mark_image_cache (t->image_cache); | 6238 | mark_image_cache (t->image_cache); |
| 6121 | /* FIXME: currently font cache may grow too large | ||
| 6122 | and probably needs special finalization. */ | ||
| 6123 | mark_object (TERMINAL_FONT_CACHE (t)); | ||
| 6124 | #endif /* HAVE_WINDOW_SYSTEM */ | 6239 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 6125 | if (!VECTOR_MARKED_P (t)) | 6240 | if (!VECTOR_MARKED_P (t)) |
| 6126 | mark_vectorlike ((struct Lisp_Vector *)t); | 6241 | mark_vectorlike ((struct Lisp_Vector *)t); |
diff --git a/src/buffer.c b/src/buffer.c index ef04ca7018d..61b685ea5c5 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -154,7 +154,8 @@ CHECK_OVERLAY (Lisp_Object x) | |||
| 154 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); | 154 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | /* These setters are used only in this file, so they can be private. */ | 157 | /* These setters are used only in this file, so they can be private. |
| 158 | The public setters are inline functions defined in buffer.h. */ | ||
| 158 | static void | 159 | static void |
| 159 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) | 160 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) |
| 160 | { | 161 | { |
| @@ -201,11 +202,6 @@ bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) | |||
| 201 | b->INTERNAL_FIELD (buffer_file_coding_system) = val; | 202 | b->INTERNAL_FIELD (buffer_file_coding_system) = val; |
| 202 | } | 203 | } |
| 203 | static void | 204 | static void |
| 204 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 205 | { | ||
| 206 | b->INTERNAL_FIELD (cache_long_scans) = val; | ||
| 207 | } | ||
| 208 | static void | ||
| 209 | bset_case_fold_search (struct buffer *b, Lisp_Object val) | 205 | bset_case_fold_search (struct buffer *b, Lisp_Object val) |
| 210 | { | 206 | { |
| 211 | b->INTERNAL_FIELD (case_fold_search) = val; | 207 | b->INTERNAL_FIELD (case_fold_search) = val; |
| @@ -1332,15 +1328,54 @@ No argument or nil as argument means use current buffer as BUFFER. */) | |||
| 1332 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; | 1328 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; |
| 1333 | } | 1329 | } |
| 1334 | 1330 | ||
| 1331 | DEFUN ("force-mode-line-update", Fforce_mode_line_update, | ||
| 1332 | Sforce_mode_line_update, 0, 1, 0, | ||
| 1333 | doc: /* Force redisplay of the current buffer's mode line and header line. | ||
| 1334 | With optional non-nil ALL, force redisplay of all mode lines and | ||
| 1335 | header lines. This function also forces recomputation of the | ||
| 1336 | menu bar menus and the frame title. */) | ||
| 1337 | (Lisp_Object all) | ||
| 1338 | { | ||
| 1339 | if (!NILP (all) || buffer_window_count (current_buffer)) | ||
| 1340 | { | ||
| 1341 | update_mode_lines = 10; | ||
| 1342 | current_buffer->prevent_redisplay_optimizations_p = 1; | ||
| 1343 | } | ||
| 1344 | return all; | ||
| 1345 | } | ||
| 1346 | |||
| 1335 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, | 1347 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, |
| 1336 | 1, 1, 0, | 1348 | 1, 1, 0, |
| 1337 | doc: /* Mark current buffer as modified or unmodified according to FLAG. | 1349 | doc: /* Mark current buffer as modified or unmodified according to FLAG. |
| 1338 | A non-nil FLAG means mark the buffer modified. */) | 1350 | A non-nil FLAG means mark the buffer modified. */) |
| 1339 | (Lisp_Object flag) | 1351 | (Lisp_Object flag) |
| 1340 | { | 1352 | { |
| 1341 | Lisp_Object fn; | 1353 | Frestore_buffer_modified_p (flag); |
| 1354 | |||
| 1355 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1356 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1357 | state by recording/restoring the state around blocks of code. | ||
| 1358 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1359 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1360 | would incur additional redisplay costs if we'd set | ||
| 1361 | update_modes_lines unconditionally. | ||
| 1362 | |||
| 1363 | Ideally, I think there should be another mechanism for fontifying | ||
| 1364 | buffers without "modifying" buffers, or redisplay should be | ||
| 1365 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1366 | return Fforce_mode_line_update (Qnil); | ||
| 1367 | } | ||
| 1342 | 1368 | ||
| 1369 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1370 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1371 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1372 | It is not ensured that mode lines will be updated to show the modified | ||
| 1373 | state of the current buffer. Use with care. */) | ||
| 1374 | (Lisp_Object flag) | ||
| 1375 | { | ||
| 1343 | #ifdef CLASH_DETECTION | 1376 | #ifdef CLASH_DETECTION |
| 1377 | Lisp_Object fn; | ||
| 1378 | |||
| 1344 | /* If buffer becoming modified, lock the file. | 1379 | /* If buffer becoming modified, lock the file. |
| 1345 | If buffer becoming unmodified, unlock the file. */ | 1380 | If buffer becoming unmodified, unlock the file. */ |
| 1346 | 1381 | ||
| @@ -1380,52 +1415,6 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1380 | or increase MODIFF. */ | 1415 | or increase MODIFF. */ |
| 1381 | : MODIFF++); | 1416 | : MODIFF++); |
| 1382 | 1417 | ||
| 1383 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1384 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1385 | state by recording/restoring the state around blocks of code. | ||
| 1386 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1387 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1388 | would incur additional redisplay costs if we'd set | ||
| 1389 | update_modes_lines unconditionally. | ||
| 1390 | |||
| 1391 | Ideally, I think there should be another mechanism for fontifying | ||
| 1392 | buffers without "modifying" buffers, or redisplay should be | ||
| 1393 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1394 | if (buffer_window_count (current_buffer)) | ||
| 1395 | { | ||
| 1396 | ++update_mode_lines; | ||
| 1397 | current_buffer->prevent_redisplay_optimizations_p = 1; | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | return flag; | ||
| 1401 | } | ||
| 1402 | |||
| 1403 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1404 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1405 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1406 | It is not ensured that mode lines will be updated to show the modified | ||
| 1407 | state of the current buffer. Use with care. */) | ||
| 1408 | (Lisp_Object flag) | ||
| 1409 | { | ||
| 1410 | #ifdef CLASH_DETECTION | ||
| 1411 | Lisp_Object fn; | ||
| 1412 | |||
| 1413 | /* If buffer becoming modified, lock the file. | ||
| 1414 | If buffer becoming unmodified, unlock the file. */ | ||
| 1415 | |||
| 1416 | fn = BVAR (current_buffer, file_truename); | ||
| 1417 | /* Test buffer-file-name so that binding it to nil is effective. */ | ||
| 1418 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | ||
| 1419 | { | ||
| 1420 | bool already = SAVE_MODIFF < MODIFF; | ||
| 1421 | if (!already && !NILP (flag)) | ||
| 1422 | lock_file (fn); | ||
| 1423 | else if (already && NILP (flag)) | ||
| 1424 | unlock_file (fn); | ||
| 1425 | } | ||
| 1426 | #endif /* CLASH_DETECTION */ | ||
| 1427 | |||
| 1428 | SAVE_MODIFF = NILP (flag) ? MODIFF : 0; | ||
| 1429 | return flag; | 1418 | return flag; |
| 1430 | } | 1419 | } |
| 1431 | 1420 | ||
| @@ -1513,7 +1502,7 @@ This does not change the name of the visited file (if any). */) | |||
| 1513 | 1502 | ||
| 1514 | /* Catch redisplay's attention. Unless we do this, the mode lines for | 1503 | /* Catch redisplay's attention. Unless we do this, the mode lines for |
| 1515 | any windows displaying current_buffer will stay unchanged. */ | 1504 | any windows displaying current_buffer will stay unchanged. */ |
| 1516 | update_mode_lines++; | 1505 | update_mode_lines = 11; |
| 1517 | 1506 | ||
| 1518 | XSETBUFFER (buf, current_buffer); | 1507 | XSETBUFFER (buf, current_buffer); |
| 1519 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); | 1508 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); |
| @@ -1798,7 +1787,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1798 | /* Run replace_buffer_in_windows before making another buffer current | 1787 | /* Run replace_buffer_in_windows before making another buffer current |
| 1799 | since set-window-buffer-start-and-point will refuse to make another | 1788 | since set-window-buffer-start-and-point will refuse to make another |
| 1800 | buffer current if the selected window does not show the current | 1789 | buffer current if the selected window does not show the current |
| 1801 | buffer. (Bug#10114) */ | 1790 | buffer (bug#10114). */ |
| 1802 | replace_buffer_in_windows (buffer); | 1791 | replace_buffer_in_windows (buffer); |
| 1803 | 1792 | ||
| 1804 | /* Exit if replacing the buffer in windows has killed our buffer. */ | 1793 | /* Exit if replacing the buffer in windows has killed our buffer. */ |
| @@ -2074,7 +2063,7 @@ the current buffer's major mode. */) | |||
| 2074 | count = SPECPDL_INDEX (); | 2063 | count = SPECPDL_INDEX (); |
| 2075 | 2064 | ||
| 2076 | /* To select a nonfundamental mode, | 2065 | /* To select a nonfundamental mode, |
| 2077 | select the buffer temporarily and then call the mode function. */ | 2066 | select the buffer temporarily and then call the mode function. */ |
| 2078 | 2067 | ||
| 2079 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 2068 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 2080 | 2069 | ||
| @@ -2114,7 +2103,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2114 | 2103 | ||
| 2115 | old_buf = current_buffer; | 2104 | old_buf = current_buffer; |
| 2116 | current_buffer = b; | 2105 | current_buffer = b; |
| 2117 | last_known_column_point = -1; /* invalidate indentation cache */ | 2106 | last_known_column_point = -1; /* Invalidate indentation cache. */ |
| 2118 | 2107 | ||
| 2119 | if (old_buf) | 2108 | if (old_buf) |
| 2120 | { | 2109 | { |
| @@ -2138,7 +2127,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2138 | fetch_buffer_markers (b); | 2127 | fetch_buffer_markers (b); |
| 2139 | 2128 | ||
| 2140 | /* Look down buffer's list of local Lisp variables | 2129 | /* Look down buffer's list of local Lisp variables |
| 2141 | to find and update any that forward into C variables. */ | 2130 | to find and update any that forward into C variables. */ |
| 2142 | 2131 | ||
| 2143 | do | 2132 | do |
| 2144 | { | 2133 | { |
| @@ -2705,7 +2694,7 @@ current buffer is cleared. */) | |||
| 2705 | 2694 | ||
| 2706 | /* If buffer is shown in a window, let redisplay consider other windows. */ | 2695 | /* If buffer is shown in a window, let redisplay consider other windows. */ |
| 2707 | if (buffer_window_count (current_buffer)) | 2696 | if (buffer_window_count (current_buffer)) |
| 2708 | ++windows_or_buffers_changed; | 2697 | windows_or_buffers_changed = 10; |
| 2709 | 2698 | ||
| 2710 | /* Copy this buffer's new multibyte status | 2699 | /* Copy this buffer's new multibyte status |
| 2711 | into all of its indirect buffers. */ | 2700 | into all of its indirect buffers. */ |
| @@ -2765,7 +2754,7 @@ the normal hook `change-major-mode-hook'. */) | |||
| 2765 | 2754 | ||
| 2766 | /* Force mode-line redisplay. Useful here because all major mode | 2755 | /* Force mode-line redisplay. Useful here because all major mode |
| 2767 | commands call this function. */ | 2756 | commands call this function. */ |
| 2768 | update_mode_lines++; | 2757 | update_mode_lines = 12; |
| 2769 | 2758 | ||
| 2770 | return Qnil; | 2759 | return Qnil; |
| 2771 | } | 2760 | } |
| @@ -3911,11 +3900,11 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 3911 | { | 3900 | { |
| 3912 | /* ... it's visible in other window than selected, */ | 3901 | /* ... it's visible in other window than selected, */ |
| 3913 | if (buf != XBUFFER (XWINDOW (selected_window)->contents)) | 3902 | if (buf != XBUFFER (XWINDOW (selected_window)->contents)) |
| 3914 | windows_or_buffers_changed = 1; | 3903 | windows_or_buffers_changed = 11; |
| 3915 | /* ... or if we modify an overlay at the end of the buffer | 3904 | /* ... or if we modify an overlay at the end of the buffer |
| 3916 | and so we cannot be sure that window end is still valid. */ | 3905 | and so we cannot be sure that window end is still valid. */ |
| 3917 | else if (end >= ZV && start <= ZV) | 3906 | else if (end >= ZV && start <= ZV) |
| 3918 | windows_or_buffers_changed = 1; | 3907 | windows_or_buffers_changed = 12; |
| 3919 | } | 3908 | } |
| 3920 | 3909 | ||
| 3921 | ++BUF_OVERLAY_MODIFF (buf); | 3910 | ++BUF_OVERLAY_MODIFF (buf); |
| @@ -4534,7 +4523,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4534 | Lisp_Object *copy = alloca (size * sizeof *copy); | 4523 | Lisp_Object *copy = alloca (size * sizeof *copy); |
| 4535 | ptrdiff_t i; | 4524 | ptrdiff_t i; |
| 4536 | 4525 | ||
| 4537 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->u.contents, | 4526 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| 4538 | size * word_size); | 4527 | size * word_size); |
| 4539 | gcpro1.var = copy; | 4528 | gcpro1.var = copy; |
| 4540 | gcpro1.nvars = size; | 4529 | gcpro1.nvars = size; |
| @@ -5185,7 +5174,7 @@ init_buffer_once (void) | |||
| 5185 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); | 5174 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); |
| 5186 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); | 5175 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); |
| 5187 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); | 5176 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); |
| 5188 | bset_cache_long_scans (&buffer_defaults, Qnil); | 5177 | bset_cache_long_scans (&buffer_defaults, Qt); |
| 5189 | bset_file_truename (&buffer_defaults, Qnil); | 5178 | bset_file_truename (&buffer_defaults, Qnil); |
| 5190 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); | 5179 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); |
| 5191 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); | 5180 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); |
| @@ -5349,13 +5338,10 @@ init_buffer (void) | |||
| 5349 | len++; | 5338 | len++; |
| 5350 | } | 5339 | } |
| 5351 | 5340 | ||
| 5341 | /* At this moment, we still don't know how to decode the directory | ||
| 5342 | name. So, we keep the bytes in unibyte form so that file I/O | ||
| 5343 | routines correctly get the original bytes. */ | ||
| 5352 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); | 5344 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); |
| 5353 | if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) | ||
| 5354 | /* At this moment, we still don't know how to decode the | ||
| 5355 | directory name. So, we keep the bytes in multibyte form so | ||
| 5356 | that ENCODE_FILE correctly gets the original bytes. */ | ||
| 5357 | bset_directory | ||
| 5358 | (current_buffer, string_to_multibyte (BVAR (current_buffer, directory))); | ||
| 5359 | 5345 | ||
| 5360 | /* Add /: to the front of the name | 5346 | /* Add /: to the front of the name |
| 5361 | if it would otherwise be treated as magic. */ | 5347 | if it would otherwise be treated as magic. */ |
| @@ -5410,12 +5396,12 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5410 | 5396 | ||
| 5411 | if (PER_BUFFER_IDX (offset) == 0) | 5397 | if (PER_BUFFER_IDX (offset) == 0) |
| 5412 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding | 5398 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding |
| 5413 | slot of buffer_local_flags */ | 5399 | slot of buffer_local_flags. */ |
| 5414 | emacs_abort (); | 5400 | emacs_abort (); |
| 5415 | } | 5401 | } |
| 5416 | 5402 | ||
| 5417 | 5403 | ||
| 5418 | /* initialize the buffer routines */ | 5404 | /* Initialize the buffer routines. */ |
| 5419 | void | 5405 | void |
| 5420 | syms_of_buffer (void) | 5406 | syms_of_buffer (void) |
| 5421 | { | 5407 | { |
| @@ -5805,7 +5791,8 @@ its value may not be a list of functions. */); | |||
| 5805 | 5791 | ||
| 5806 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), | 5792 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), |
| 5807 | Qstringp, | 5793 | Qstringp, |
| 5808 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); | 5794 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. |
| 5795 | This should be an absolute file name. */); | ||
| 5809 | 5796 | ||
| 5810 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), | 5797 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), |
| 5811 | Qstringp, | 5798 | Qstringp, |
| @@ -6305,6 +6292,7 @@ and `bury-buffer-internal'. */); | |||
| 6305 | defsubr (&Sbuffer_local_value); | 6292 | defsubr (&Sbuffer_local_value); |
| 6306 | defsubr (&Sbuffer_local_variables); | 6293 | defsubr (&Sbuffer_local_variables); |
| 6307 | defsubr (&Sbuffer_modified_p); | 6294 | defsubr (&Sbuffer_modified_p); |
| 6295 | defsubr (&Sforce_mode_line_update); | ||
| 6308 | defsubr (&Sset_buffer_modified_p); | 6296 | defsubr (&Sset_buffer_modified_p); |
| 6309 | defsubr (&Sbuffer_modified_tick); | 6297 | defsubr (&Sbuffer_modified_tick); |
| 6310 | defsubr (&Sbuffer_chars_modified_tick); | 6298 | defsubr (&Sbuffer_chars_modified_tick); |
diff --git a/src/buffer.h b/src/buffer.h index a36c0d13c9e..d1a3e50d7cf 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -871,13 +871,19 @@ struct buffer | |||
| 871 | }; | 871 | }; |
| 872 | 872 | ||
| 873 | /* Most code should use these functions to set Lisp fields in struct | 873 | /* Most code should use these functions to set Lisp fields in struct |
| 874 | buffer. */ | 874 | buffer. (Some setters that are private to a single .c file are |
| 875 | defined as static in those files.) */ | ||
| 875 | INLINE void | 876 | INLINE void |
| 876 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) | 877 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) |
| 877 | { | 878 | { |
| 878 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; | 879 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; |
| 879 | } | 880 | } |
| 880 | INLINE void | 881 | INLINE void |
| 882 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 883 | { | ||
| 884 | b->INTERNAL_FIELD (cache_long_scans) = val; | ||
| 885 | } | ||
| 886 | INLINE void | ||
| 881 | bset_case_canon_table (struct buffer *b, Lisp_Object val) | 887 | bset_case_canon_table (struct buffer *b, Lisp_Object val) |
| 882 | { | 888 | { |
| 883 | b->INTERNAL_FIELD (case_canon_table) = val; | 889 | b->INTERNAL_FIELD (case_canon_table) = val; |
diff --git a/src/bytecode.c b/src/bytecode.c index b9cb36c871f..f34e702c71d 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -550,7 +550,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 550 | #ifdef BYTE_CODE_SAFE | 550 | #ifdef BYTE_CODE_SAFE |
| 551 | bytestr_length = SBYTES (bytestr); | 551 | bytestr_length = SBYTES (bytestr); |
| 552 | #endif | 552 | #endif |
| 553 | vectorp = XVECTOR (vector)->u.contents; | 553 | vectorp = XVECTOR (vector)->contents; |
| 554 | 554 | ||
| 555 | stack.byte_string = bytestr; | 555 | stack.byte_string = bytestr; |
| 556 | stack.pc = stack.byte_string_start = SDATA (bytestr); | 556 | stack.pc = stack.byte_string_start = SDATA (bytestr); |
diff --git a/src/callproc.c b/src/callproc.c index d4b4a26ec3a..3317c1203bc 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -777,7 +777,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 777 | char buf[CALLPROC_BUFFER_SIZE_MAX]; | 777 | char buf[CALLPROC_BUFFER_SIZE_MAX]; |
| 778 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; | 778 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
| 779 | int nread; | 779 | int nread; |
| 780 | bool first = 1; | ||
| 781 | EMACS_INT total_read = 0; | 780 | EMACS_INT total_read = 0; |
| 782 | int carryover = 0; | 781 | int carryover = 0; |
| 783 | bool display_on_the_fly = display_p; | 782 | bool display_on_the_fly = display_p; |
| @@ -822,6 +821,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 822 | ptrdiff_t count1 = SPECPDL_INDEX (); | 821 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 823 | 822 | ||
| 824 | XSETBUFFER (curbuf, current_buffer); | 823 | XSETBUFFER (curbuf, current_buffer); |
| 824 | prepare_to_modify_buffer (PT, PT, NULL); | ||
| 825 | /* We cannot allow after-change-functions be run | 825 | /* We cannot allow after-change-functions be run |
| 826 | during decoding, because that might modify the | 826 | during decoding, because that might modify the |
| 827 | buffer, while we rely on process_coding.produced to | 827 | buffer, while we rely on process_coding.produced to |
| @@ -874,9 +874,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 874 | 874 | ||
| 875 | if (display_p) | 875 | if (display_p) |
| 876 | { | 876 | { |
| 877 | if (first) | ||
| 878 | prepare_menu_bars (); | ||
| 879 | first = 0; | ||
| 880 | redisplay_preserve_echo_area (1); | 877 | redisplay_preserve_echo_area (1); |
| 881 | /* This variable might have been set to 0 for code | 878 | /* This variable might have been set to 0 for code |
| 882 | detection. In that case, set it back to 1 because | 879 | detection. In that case, set it back to 1 because |
| @@ -1612,14 +1609,14 @@ init_callproc (void) | |||
| 1612 | Lisp_Object tem, tem1, srcdir; | 1609 | Lisp_Object tem, tem1, srcdir; |
| 1613 | 1610 | ||
| 1614 | srcdir = Fexpand_file_name (build_string ("../src/"), | 1611 | srcdir = Fexpand_file_name (build_string ("../src/"), |
| 1615 | build_string (PATH_DUMPLOADSEARCH)); | 1612 | build_unibyte_string (PATH_DUMPLOADSEARCH)); |
| 1616 | tem = Fexpand_file_name (build_string ("GNU"), Vdata_directory); | 1613 | tem = Fexpand_file_name (build_string ("GNU"), Vdata_directory); |
| 1617 | tem1 = Ffile_exists_p (tem); | 1614 | tem1 = Ffile_exists_p (tem); |
| 1618 | if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1)) | 1615 | if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1)) |
| 1619 | { | 1616 | { |
| 1620 | Lisp_Object newdir; | 1617 | Lisp_Object newdir; |
| 1621 | newdir = Fexpand_file_name (build_string ("../etc/"), | 1618 | newdir = Fexpand_file_name (build_string ("../etc/"), |
| 1622 | build_string (PATH_DUMPLOADSEARCH)); | 1619 | build_unibyte_string (PATH_DUMPLOADSEARCH)); |
| 1623 | tem = Fexpand_file_name (build_string ("GNU"), newdir); | 1620 | tem = Fexpand_file_name (build_string ("GNU"), newdir); |
| 1624 | tem1 = Ffile_exists_p (tem); | 1621 | tem1 = Ffile_exists_p (tem); |
| 1625 | if (!NILP (tem1)) | 1622 | if (!NILP (tem1)) |
| @@ -1646,7 +1643,7 @@ init_callproc (void) | |||
| 1646 | #ifdef DOS_NT | 1643 | #ifdef DOS_NT |
| 1647 | Vshared_game_score_directory = Qnil; | 1644 | Vshared_game_score_directory = Qnil; |
| 1648 | #else | 1645 | #else |
| 1649 | Vshared_game_score_directory = build_string (PATH_GAME); | 1646 | Vshared_game_score_directory = build_unibyte_string (PATH_GAME); |
| 1650 | if (NILP (Ffile_accessible_directory_p (Vshared_game_score_directory))) | 1647 | if (NILP (Ffile_accessible_directory_p (Vshared_game_score_directory))) |
| 1651 | Vshared_game_score_directory = Qnil; | 1648 | Vshared_game_score_directory = Qnil; |
| 1652 | #endif | 1649 | #endif |
diff --git a/src/casefiddle.c b/src/casefiddle.c index 5a40790f87f..9b213bb3cf2 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -102,7 +102,7 @@ casify_object (enum case_action flag, Lisp_Object obj) | |||
| 102 | inword = (SYNTAX (c) == Sword); | 102 | inword = (SYNTAX (c) == Sword); |
| 103 | if (c != c1) | 103 | if (c != c1) |
| 104 | { | 104 | { |
| 105 | MAKE_CHAR_UNIBYTE (c); | 105 | MAKE_CHAR_UNIBYTE (c); |
| 106 | /* If the char can't be converted to a valid byte, just don't | 106 | /* If the char can't be converted to a valid byte, just don't |
| 107 | change it. */ | 107 | change it. */ |
| 108 | if (c >= 0 && c < 256) | 108 | if (c >= 0 && c < 256) |
diff --git a/src/category.c b/src/category.c index da5e81e4709..80d8b1ca1a2 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -55,17 +55,9 @@ bset_category_table (struct buffer *b, Lisp_Object val) | |||
| 55 | static int category_table_version; | 55 | static int category_table_version; |
| 56 | 56 | ||
| 57 | static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; | 57 | static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; |
| 58 | |||
| 59 | /* Make CATEGORY_SET includes (if VAL is t) or excludes (if VAL is | ||
| 60 | nil) CATEGORY. */ | ||
| 61 | #define SET_CATEGORY_SET(category_set, category, val) \ | ||
| 62 | set_category_set (category_set, category, val) | ||
| 63 | static void set_category_set (Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 64 | 58 | ||
| 65 | /* Category set staff. */ | 59 | /* Category set staff. */ |
| 66 | 60 | ||
| 67 | static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); | ||
| 68 | |||
| 69 | static Lisp_Object | 61 | static Lisp_Object |
| 70 | hash_get_category_set (Lisp_Object table, Lisp_Object category_set) | 62 | hash_get_category_set (Lisp_Object table, Lisp_Object category_set) |
| 71 | { | 63 | { |
| @@ -88,6 +80,13 @@ hash_get_category_set (Lisp_Object table, Lisp_Object category_set) | |||
| 88 | return category_set; | 80 | return category_set; |
| 89 | } | 81 | } |
| 90 | 82 | ||
| 83 | /* Make CATEGORY_SET include (if VAL) or exclude (if !VAL) CATEGORY. */ | ||
| 84 | |||
| 85 | static void | ||
| 86 | set_category_set (Lisp_Object category_set, EMACS_INT category, bool val) | ||
| 87 | { | ||
| 88 | bool_vector_set (category_set, category, val); | ||
| 89 | } | ||
| 91 | 90 | ||
| 92 | DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0, | 91 | DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0, |
| 93 | doc: /* Return a newly created category-set which contains CATEGORIES. | 92 | doc: /* Return a newly created category-set which contains CATEGORIES. |
| @@ -108,11 +107,11 @@ those categories. */) | |||
| 108 | len = SCHARS (categories); | 107 | len = SCHARS (categories); |
| 109 | while (--len >= 0) | 108 | while (--len >= 0) |
| 110 | { | 109 | { |
| 111 | Lisp_Object category; | 110 | unsigned char cat = SREF (categories, len); |
| 111 | Lisp_Object category = make_number (cat); | ||
| 112 | 112 | ||
| 113 | XSETFASTINT (category, SREF (categories, len)); | ||
| 114 | CHECK_CATEGORY (category); | 113 | CHECK_CATEGORY (category); |
| 115 | SET_CATEGORY_SET (val, category, Qt); | 114 | set_category_set (val, cat, 1); |
| 116 | } | 115 | } |
| 117 | return val; | 116 | return val; |
| 118 | } | 117 | } |
| @@ -334,20 +333,6 @@ The return value is a string containing those same categories. */) | |||
| 334 | return build_string (str); | 333 | return build_string (str); |
| 335 | } | 334 | } |
| 336 | 335 | ||
| 337 | static void | ||
| 338 | set_category_set (Lisp_Object category_set, Lisp_Object category, Lisp_Object val) | ||
| 339 | { | ||
| 340 | do { | ||
| 341 | int idx = XINT (category) / 8; | ||
| 342 | unsigned char bits = 1 << (XINT (category) % 8); | ||
| 343 | |||
| 344 | if (NILP (val)) | ||
| 345 | XCATEGORY_SET (category_set)->data[idx] &= ~bits; | ||
| 346 | else | ||
| 347 | XCATEGORY_SET (category_set)->data[idx] |= bits; | ||
| 348 | } while (0); | ||
| 349 | } | ||
| 350 | |||
| 351 | DEFUN ("modify-category-entry", Fmodify_category_entry, | 336 | DEFUN ("modify-category-entry", Fmodify_category_entry, |
| 352 | Smodify_category_entry, 2, 4, 0, | 337 | Smodify_category_entry, 2, 4, 0, |
| 353 | doc: /* Modify the category set of CHARACTER by adding CATEGORY to it. | 338 | doc: /* Modify the category set of CHARACTER by adding CATEGORY to it. |
| @@ -359,7 +344,7 @@ If optional fourth argument RESET is non-nil, | |||
| 359 | then delete CATEGORY from the category set instead of adding it. */) | 344 | then delete CATEGORY from the category set instead of adding it. */) |
| 360 | (Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset) | 345 | (Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset) |
| 361 | { | 346 | { |
| 362 | Lisp_Object set_value; /* Actual value to be set in category sets. */ | 347 | bool set_value; /* Actual value to be set in category sets. */ |
| 363 | Lisp_Object category_set; | 348 | Lisp_Object category_set; |
| 364 | int start, end; | 349 | int start, end; |
| 365 | int from, to; | 350 | int from, to; |
| @@ -384,7 +369,7 @@ then delete CATEGORY from the category set instead of adding it. */) | |||
| 384 | if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) | 369 | if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) |
| 385 | error ("Undefined category: %c", (int) XFASTINT (category)); | 370 | error ("Undefined category: %c", (int) XFASTINT (category)); |
| 386 | 371 | ||
| 387 | set_value = NILP (reset) ? Qt : Qnil; | 372 | set_value = NILP (reset); |
| 388 | 373 | ||
| 389 | while (start <= end) | 374 | while (start <= end) |
| 390 | { | 375 | { |
| @@ -393,7 +378,7 @@ then delete CATEGORY from the category set instead of adding it. */) | |||
| 393 | if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset)) | 378 | if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset)) |
| 394 | { | 379 | { |
| 395 | category_set = Fcopy_sequence (category_set); | 380 | category_set = Fcopy_sequence (category_set); |
| 396 | SET_CATEGORY_SET (category_set, category, set_value); | 381 | set_category_set (category_set, XFASTINT (category), set_value); |
| 397 | category_set = hash_get_category_set (table, category_set); | 382 | category_set = hash_get_category_set (table, category_set); |
| 398 | char_table_set_range (table, start, to, category_set); | 383 | char_table_set_range (table, start, to, category_set); |
| 399 | } | 384 | } |
diff --git a/src/category.h b/src/category.h index a2eaf010132..ef784c8cbf5 100644 --- a/src/category.h +++ b/src/category.h | |||
| @@ -60,8 +60,6 @@ INLINE_HEADER_BEGIN | |||
| 60 | #define CHECK_CATEGORY(x) \ | 60 | #define CHECK_CATEGORY(x) \ |
| 61 | CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) | 61 | CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) |
| 62 | 62 | ||
| 63 | #define XCATEGORY_SET XBOOL_VECTOR | ||
| 64 | |||
| 65 | #define CATEGORY_SET_P(x) \ | 63 | #define CATEGORY_SET_P(x) \ |
| 66 | (BOOL_VECTOR_P (x) && bool_vector_size (x) == 128) | 64 | (BOOL_VECTOR_P (x) && bool_vector_size (x) == 128) |
| 67 | 65 | ||
| @@ -75,10 +73,12 @@ INLINE_HEADER_BEGIN | |||
| 75 | #define CATEGORY_SET(c) char_category_set (c) | 73 | #define CATEGORY_SET(c) char_category_set (c) |
| 76 | 74 | ||
| 77 | /* Return true if CATEGORY_SET contains CATEGORY. | 75 | /* Return true if CATEGORY_SET contains CATEGORY. |
| 78 | The faster version of `!NILP (Faref (category_set, category))'. */ | 76 | Faster than '!NILP (Faref (category_set, make_number (category)))'. */ |
| 79 | #define CATEGORY_MEMBER(category, category_set) \ | 77 | INLINE bool |
| 80 | ((XCATEGORY_SET (category_set)->data[(category) / 8] \ | 78 | CATEGORY_MEMBER (EMACS_INT category, Lisp_Object category_set) |
| 81 | >> ((category) % 8)) & 1) | 79 | { |
| 80 | return bool_vector_bitref (category_set, category); | ||
| 81 | } | ||
| 82 | 82 | ||
| 83 | /* Return true if category set of CH contains CATEGORY. */ | 83 | /* Return true if category set of CH contains CATEGORY. */ |
| 84 | INLINE bool | 84 | INLINE bool |
| @@ -1094,7 +1094,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1094 | ccl_prog_stack_struct[stack_idx].ic = ic; | 1094 | ccl_prog_stack_struct[stack_idx].ic = ic; |
| 1095 | ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; | 1095 | ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; |
| 1096 | stack_idx++; | 1096 | stack_idx++; |
| 1097 | ccl_prog = XVECTOR (AREF (slot, 1))->u.contents; | 1097 | ccl_prog = XVECTOR (AREF (slot, 1))->contents; |
| 1098 | ic = CCL_HEADER_MAIN; | 1098 | ic = CCL_HEADER_MAIN; |
| 1099 | eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); | 1099 | eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); |
| 1100 | } | 1100 | } |
| @@ -1936,9 +1936,9 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog) | |||
| 1936 | return -1; | 1936 | return -1; |
| 1937 | vp = XVECTOR (ccl_prog); | 1937 | vp = XVECTOR (ccl_prog); |
| 1938 | ccl->size = vp->header.size; | 1938 | ccl->size = vp->header.size; |
| 1939 | ccl->prog = vp->u.contents; | 1939 | ccl->prog = vp->contents; |
| 1940 | ccl->eof_ic = XINT (vp->u.contents[CCL_HEADER_EOF]); | 1940 | ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); |
| 1941 | ccl->buf_magnification = XINT (vp->u.contents[CCL_HEADER_BUF_MAG]); | 1941 | ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); |
| 1942 | if (ccl->idx >= 0) | 1942 | if (ccl->idx >= 0) |
| 1943 | { | 1943 | { |
| 1944 | Lisp_Object slot; | 1944 | Lisp_Object slot; |
diff --git a/src/character.h b/src/character.h index d1b781caa53..e944b5775ed 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -677,7 +677,7 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object); | |||
| 677 | 677 | ||
| 678 | /* Return a translation table of id number ID. */ | 678 | /* Return a translation table of id number ID. */ |
| 679 | #define GET_TRANSLATION_TABLE(id) \ | 679 | #define GET_TRANSLATION_TABLE(id) \ |
| 680 | (XCDR (XVECTOR (Vtranslation_table_vector)->u.contents[(id)])) | 680 | (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) |
| 681 | 681 | ||
| 682 | INLINE_HEADER_END | 682 | INLINE_HEADER_END |
| 683 | 683 | ||
diff --git a/src/chartab.c b/src/chartab.c index 089c4254da6..16dd85c12c0 100644 --- a/src/chartab.c +++ b/src/chartab.c | |||
| @@ -141,7 +141,8 @@ static Lisp_Object | |||
| 141 | make_sub_char_table (int depth, int min_char, Lisp_Object defalt) | 141 | make_sub_char_table (int depth, int min_char, Lisp_Object defalt) |
| 142 | { | 142 | { |
| 143 | Lisp_Object table; | 143 | Lisp_Object table; |
| 144 | int size = CHAR_TABLE_STANDARD_SLOTS + chartab_size[depth]; | 144 | int size = (PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) |
| 145 | + chartab_size[depth]); | ||
| 145 | 146 | ||
| 146 | table = Fmake_vector (make_number (size), defalt); | 147 | table = Fmake_vector (make_number (size), defalt); |
| 147 | XSETPVECTYPE (XVECTOR (table), PVEC_SUB_CHAR_TABLE); | 148 | XSETPVECTYPE (XVECTOR (table), PVEC_SUB_CHAR_TABLE); |
| @@ -1258,7 +1259,7 @@ uniprop_encode_value_character (Lisp_Object table, Lisp_Object value) | |||
| 1258 | static Lisp_Object | 1259 | static Lisp_Object |
| 1259 | uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value) | 1260 | uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value) |
| 1260 | { | 1261 | { |
| 1261 | Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; | 1262 | Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents; |
| 1262 | int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); | 1263 | int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); |
| 1263 | 1264 | ||
| 1264 | for (i = 0; i < size; i++) | 1265 | for (i = 0; i < size; i++) |
| @@ -1276,7 +1277,7 @@ uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value) | |||
| 1276 | static Lisp_Object | 1277 | static Lisp_Object |
| 1277 | uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value) | 1278 | uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value) |
| 1278 | { | 1279 | { |
| 1279 | Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; | 1280 | Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents; |
| 1280 | int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); | 1281 | int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); |
| 1281 | 1282 | ||
| 1282 | CHECK_NUMBER (value); | 1283 | CHECK_NUMBER (value); |
diff --git a/src/coding.c b/src/coding.c index 69b01553e7f..4ee55f7c8e6 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -9358,6 +9358,14 @@ code_convert_region (Lisp_Object start, Lisp_Object end, | |||
| 9358 | setup_coding_system (coding_system, &coding); | 9358 | setup_coding_system (coding_system, &coding); |
| 9359 | coding.mode |= CODING_MODE_LAST_BLOCK; | 9359 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 9360 | 9360 | ||
| 9361 | if (BUFFERP (dst_object) && !EQ (dst_object, src_object)) | ||
| 9362 | { | ||
| 9363 | struct buffer *buf = XBUFFER (dst_object); | ||
| 9364 | ptrdiff_t buf_pt = BUF_PT (buf); | ||
| 9365 | |||
| 9366 | invalidate_buffer_caches (buf, buf_pt, buf_pt); | ||
| 9367 | } | ||
| 9368 | |||
| 9361 | if (encodep) | 9369 | if (encodep) |
| 9362 | encode_coding_object (&coding, src_object, from, from_byte, to, to_byte, | 9370 | encode_coding_object (&coding, src_object, from, from_byte, to, to_byte, |
| 9363 | dst_object); | 9371 | dst_object); |
| @@ -9447,6 +9455,15 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system, | |||
| 9447 | coding.mode |= CODING_MODE_LAST_BLOCK; | 9455 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 9448 | chars = SCHARS (string); | 9456 | chars = SCHARS (string); |
| 9449 | bytes = SBYTES (string); | 9457 | bytes = SBYTES (string); |
| 9458 | |||
| 9459 | if (BUFFERP (dst_object)) | ||
| 9460 | { | ||
| 9461 | struct buffer *buf = XBUFFER (dst_object); | ||
| 9462 | ptrdiff_t buf_pt = BUF_PT (buf); | ||
| 9463 | |||
| 9464 | invalidate_buffer_caches (buf, buf_pt, buf_pt); | ||
| 9465 | } | ||
| 9466 | |||
| 9450 | if (encodep) | 9467 | if (encodep) |
| 9451 | encode_coding_object (&coding, string, 0, 0, chars, bytes, dst_object); | 9468 | encode_coding_object (&coding, string, 0, 0, chars, bytes, dst_object); |
| 9452 | else | 9469 | else |
| @@ -9499,6 +9516,12 @@ decode_file_name (Lisp_Object fname) | |||
| 9499 | Lisp_Object | 9516 | Lisp_Object |
| 9500 | encode_file_name (Lisp_Object fname) | 9517 | encode_file_name (Lisp_Object fname) |
| 9501 | { | 9518 | { |
| 9519 | /* This is especially important during bootstrap and dumping, when | ||
| 9520 | file-name encoding is not yet known, and therefore any non-ASCII | ||
| 9521 | file names are unibyte strings, and could only be thrashed if we | ||
| 9522 | try to encode them. */ | ||
| 9523 | if (!STRING_MULTIBYTE (fname)) | ||
| 9524 | return fname; | ||
| 9502 | #ifdef WINDOWSNT | 9525 | #ifdef WINDOWSNT |
| 9503 | /* The w32 build pretends to use UTF-8 for file-name encoding, and | 9526 | /* The w32 build pretends to use UTF-8 for file-name encoding, and |
| 9504 | converts the file names either to UTF-16LE or to the system ANSI | 9527 | converts the file names either to UTF-16LE or to the system ANSI |
diff --git a/src/commands.h b/src/commands.h index 35c2c05fe72..b7f0049515d 100644 --- a/src/commands.h +++ b/src/commands.h | |||
| @@ -36,10 +36,10 @@ extern Lisp_Object control_x_map; | |||
| 36 | events until a non-ASCII event is acceptable as input. */ | 36 | events until a non-ASCII event is acceptable as input. */ |
| 37 | extern Lisp_Object unread_switch_frame; | 37 | extern Lisp_Object unread_switch_frame; |
| 38 | 38 | ||
| 39 | /* Nonzero if input is coming from the keyboard */ | 39 | /* Nonzero if input is coming from the keyboard. */ |
| 40 | 40 | ||
| 41 | #define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) | 41 | #define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) |
| 42 | 42 | ||
| 43 | /* Set this nonzero to force reconsideration of mode line. */ | 43 | /* Set this nonzero to force reconsideration of mode line. */ |
| 44 | 44 | ||
| 45 | extern int update_mode_lines; | 45 | extern int update_mode_lines; |
diff --git a/src/composite.c b/src/composite.c index 689ae95fa17..2ab5dbc9133 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -266,7 +266,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars, | |||
| 266 | composition_table = xpalloc (composition_table, &composition_table_size, | 266 | composition_table = xpalloc (composition_table, &composition_table_size, |
| 267 | 1, -1, sizeof *composition_table); | 267 | 1, -1, sizeof *composition_table); |
| 268 | 268 | ||
| 269 | key_contents = XVECTOR (key)->u.contents; | 269 | key_contents = XVECTOR (key)->contents; |
| 270 | 270 | ||
| 271 | /* Check if the contents of COMPONENTS are valid if COMPONENTS is a | 271 | /* Check if the contents of COMPONENTS are valid if COMPONENTS is a |
| 272 | vector or a list. It should be a sequence of: | 272 | vector or a list. It should be a sequence of: |
diff --git a/src/composite.h b/src/composite.h index b3ea5cd1ed8..9026d03f7b6 100644 --- a/src/composite.h +++ b/src/composite.h | |||
| @@ -88,8 +88,8 @@ composition_registered_p (Lisp_Object prop) | |||
| 88 | #define COMPOSITION_GLYPH(cmp, n) \ | 88 | #define COMPOSITION_GLYPH(cmp, n) \ |
| 89 | XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ | 89 | XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ |
| 90 | ->key_and_value) \ | 90 | ->key_and_value) \ |
| 91 | ->u.contents[cmp->hash_index * 2]) \ | 91 | ->contents[cmp->hash_index * 2]) \ |
| 92 | ->u.contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ | 92 | ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ |
| 93 | ? (n) * 2 : (n)]) | 93 | ? (n) * 2 : (n)]) |
| 94 | 94 | ||
| 95 | /* Return the encoded composition rule to compose the Nth glyph of | 95 | /* Return the encoded composition rule to compose the Nth glyph of |
| @@ -98,8 +98,8 @@ composition_registered_p (Lisp_Object prop) | |||
| 98 | #define COMPOSITION_RULE(cmp, n) \ | 98 | #define COMPOSITION_RULE(cmp, n) \ |
| 99 | XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ | 99 | XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ |
| 100 | ->key_and_value) \ | 100 | ->key_and_value) \ |
| 101 | ->u.contents[cmp->hash_index * 2]) \ | 101 | ->contents[cmp->hash_index * 2]) \ |
| 102 | ->u.contents[(n) * 2 - 1]) | 102 | ->contents[(n) * 2 - 1]) |
| 103 | 103 | ||
| 104 | /* Decode encoded composition rule RULE_CODE into GREF (global | 104 | /* Decode encoded composition rule RULE_CODE into GREF (global |
| 105 | reference point code), NREF (new ref. point code). Don't check RULE_CODE; | 105 | reference point code), NREF (new ref. point code). Don't check RULE_CODE; |
diff --git a/src/conf_post.h b/src/conf_post.h index 786105864f2..2d967c0fefc 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -49,8 +49,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 49 | #define malloc unexec_malloc | 49 | #define malloc unexec_malloc |
| 50 | #define realloc unexec_realloc | 50 | #define realloc unexec_realloc |
| 51 | #define free unexec_free | 51 | #define free unexec_free |
| 52 | /* Don't use posix_memalign because it is not compatible with unexmacosx.c. */ | ||
| 53 | #undef HAVE_POSIX_MEMALIGN | ||
| 54 | #endif | 52 | #endif |
| 55 | /* The following solves the problem that Emacs hangs when evaluating | 53 | /* The following solves the problem that Emacs hangs when evaluating |
| 56 | (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile | 54 | (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile |
diff --git a/src/data.c b/src/data.c index 22d051ef932..d0171b5d758 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2141,13 +2141,9 @@ or a byte-code object. IDX starts at 0. */) | |||
| 2141 | } | 2141 | } |
| 2142 | else if (BOOL_VECTOR_P (array)) | 2142 | else if (BOOL_VECTOR_P (array)) |
| 2143 | { | 2143 | { |
| 2144 | int val; | ||
| 2145 | |||
| 2146 | if (idxval < 0 || idxval >= bool_vector_size (array)) | 2144 | if (idxval < 0 || idxval >= bool_vector_size (array)) |
| 2147 | args_out_of_range (array, idx); | 2145 | args_out_of_range (array, idx); |
| 2148 | 2146 | return bool_vector_ref (array, idxval); | |
| 2149 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; | ||
| 2150 | return (val & (1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR)) ? Qt : Qnil); | ||
| 2151 | } | 2147 | } |
| 2152 | else if (CHAR_TABLE_P (array)) | 2148 | else if (CHAR_TABLE_P (array)) |
| 2153 | { | 2149 | { |
| @@ -2191,18 +2187,9 @@ bool-vector. IDX starts at 0. */) | |||
| 2191 | } | 2187 | } |
| 2192 | else if (BOOL_VECTOR_P (array)) | 2188 | else if (BOOL_VECTOR_P (array)) |
| 2193 | { | 2189 | { |
| 2194 | int val; | ||
| 2195 | |||
| 2196 | if (idxval < 0 || idxval >= bool_vector_size (array)) | 2190 | if (idxval < 0 || idxval >= bool_vector_size (array)) |
| 2197 | args_out_of_range (array, idx); | 2191 | args_out_of_range (array, idx); |
| 2198 | 2192 | bool_vector_set (array, idxval, !NILP (newelt)); | |
| 2199 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; | ||
| 2200 | |||
| 2201 | if (! NILP (newelt)) | ||
| 2202 | val |= 1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2203 | else | ||
| 2204 | val &= ~(1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR)); | ||
| 2205 | XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR] = val; | ||
| 2206 | } | 2193 | } |
| 2207 | else if (CHAR_TABLE_P (array)) | 2194 | else if (CHAR_TABLE_P (array)) |
| 2208 | { | 2195 | { |
| @@ -2975,9 +2962,7 @@ lowercase l) for small endian machines. */) | |||
| 2975 | 2962 | ||
| 2976 | /* Because we round up the bool vector allocate size to word_size | 2963 | /* Because we round up the bool vector allocate size to word_size |
| 2977 | units, we can safely read past the "end" of the vector in the | 2964 | units, we can safely read past the "end" of the vector in the |
| 2978 | operations below. These extra bits are always zero. Also, we | 2965 | operations below. These extra bits are always zero. */ |
| 2979 | always allocate bool vectors with at least one bits_word of storage so | ||
| 2980 | that we don't have to special-case empty bit vectors. */ | ||
| 2981 | 2966 | ||
| 2982 | static bits_word | 2967 | static bits_word |
| 2983 | bool_vector_spare_mask (EMACS_INT nr_bits) | 2968 | bool_vector_spare_mask (EMACS_INT nr_bits) |
| @@ -2985,16 +2970,47 @@ bool_vector_spare_mask (EMACS_INT nr_bits) | |||
| 2985 | return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; | 2970 | return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; |
| 2986 | } | 2971 | } |
| 2987 | 2972 | ||
| 2988 | #if BITS_WORD_MAX <= UINT_MAX | 2973 | /* Info about unsigned long long, falling back on unsigned long |
| 2989 | # define popcount_bits_word count_one_bits | 2974 | if unsigned long long is not available. */ |
| 2990 | #elif BITS_WORD_MAX <= ULONG_MAX | 2975 | |
| 2991 | # define popcount_bits_word count_one_bits_l | 2976 | #if HAVE_UNSIGNED_LONG_LONG_INT |
| 2992 | #elif BITS_WORD_MAX <= ULLONG_MAX | 2977 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) }; |
| 2993 | # define popcount_bits_word count_one_bits_ll | ||
| 2994 | #else | 2978 | #else |
| 2995 | # error "bits_word wider than long long? Please file a bug report." | 2979 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) }; |
| 2980 | # define ULLONG_MAX ULONG_MAX | ||
| 2981 | # define count_one_bits_ll count_one_bits_l | ||
| 2996 | #endif | 2982 | #endif |
| 2997 | 2983 | ||
| 2984 | /* Shift VAL right by the width of an unsigned long long. | ||
| 2985 | BITS_PER_ULL must be less than BITS_PER_BITS_WORD. */ | ||
| 2986 | |||
| 2987 | static bits_word | ||
| 2988 | shift_right_ull (bits_word w) | ||
| 2989 | { | ||
| 2990 | /* Pacify bogus GCC warning about shift count exceeding type width. */ | ||
| 2991 | int shift = BITS_PER_ULL - BITS_PER_BITS_WORD < 0 ? BITS_PER_ULL : 0; | ||
| 2992 | return w >> shift; | ||
| 2993 | } | ||
| 2994 | |||
| 2995 | /* Return the number of 1 bits in W. */ | ||
| 2996 | |||
| 2997 | static int | ||
| 2998 | count_one_bits_word (bits_word w) | ||
| 2999 | { | ||
| 3000 | if (BITS_WORD_MAX <= UINT_MAX) | ||
| 3001 | return count_one_bits (w); | ||
| 3002 | else if (BITS_WORD_MAX <= ULONG_MAX) | ||
| 3003 | return count_one_bits_l (w); | ||
| 3004 | else | ||
| 3005 | { | ||
| 3006 | int i = 0, count = 0; | ||
| 3007 | while (count += count_one_bits_ll (w), | ||
| 3008 | BITS_PER_BITS_WORD <= (i += BITS_PER_ULL)) | ||
| 3009 | w = shift_right_ull (w); | ||
| 3010 | return count; | ||
| 3011 | } | ||
| 3012 | } | ||
| 3013 | |||
| 2998 | enum bool_vector_op { bool_vector_exclusive_or, | 3014 | enum bool_vector_op { bool_vector_exclusive_or, |
| 2999 | bool_vector_union, | 3015 | bool_vector_union, |
| 3000 | bool_vector_intersection, | 3016 | bool_vector_intersection, |
| @@ -3010,7 +3026,7 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3010 | EMACS_INT nr_bits; | 3026 | EMACS_INT nr_bits; |
| 3011 | bits_word *adata, *bdata, *cdata; | 3027 | bits_word *adata, *bdata, *cdata; |
| 3012 | ptrdiff_t i; | 3028 | ptrdiff_t i; |
| 3013 | bits_word changed = 0; | 3029 | bool changed = 0; |
| 3014 | bits_word mword; | 3030 | bits_word mword; |
| 3015 | ptrdiff_t nr_words; | 3031 | ptrdiff_t nr_words; |
| 3016 | 3032 | ||
| @@ -3023,7 +3039,7 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3023 | 3039 | ||
| 3024 | if (NILP (dest)) | 3040 | if (NILP (dest)) |
| 3025 | { | 3041 | { |
| 3026 | dest = Fmake_bool_vector (make_number (nr_bits), Qnil); | 3042 | dest = make_uninit_bool_vector (nr_bits); |
| 3027 | changed = 1; | 3043 | changed = 1; |
| 3028 | } | 3044 | } |
| 3029 | else | 3045 | else |
| @@ -3033,13 +3049,13 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3033 | wrong_length_argument (op1, op2, dest); | 3049 | wrong_length_argument (op1, op2, dest); |
| 3034 | } | 3050 | } |
| 3035 | 3051 | ||
| 3036 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; | 3052 | nr_words = bool_vector_words (nr_bits); |
| 3053 | |||
| 3054 | adata = bool_vector_data (dest); | ||
| 3055 | bdata = bool_vector_data (op1); | ||
| 3056 | cdata = bool_vector_data (op2); | ||
| 3037 | 3057 | ||
| 3038 | adata = (bits_word *) XBOOL_VECTOR (dest)->data; | 3058 | for (i = 0; i < nr_words; i++) |
| 3039 | bdata = (bits_word *) XBOOL_VECTOR (op1)->data; | ||
| 3040 | cdata = (bits_word *) XBOOL_VECTOR (op2)->data; | ||
| 3041 | i = 0; | ||
| 3042 | do | ||
| 3043 | { | 3059 | { |
| 3044 | if (op == bool_vector_exclusive_or) | 3060 | if (op == bool_vector_exclusive_or) |
| 3045 | mword = bdata[i] ^ cdata[i]; | 3061 | mword = bdata[i] ^ cdata[i]; |
| @@ -3052,18 +3068,26 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3052 | else | 3068 | else |
| 3053 | abort (); | 3069 | abort (); |
| 3054 | 3070 | ||
| 3055 | changed |= adata[i] ^ mword; | 3071 | if (! changed) |
| 3072 | changed = adata[i] != mword; | ||
| 3056 | 3073 | ||
| 3057 | if (op != bool_vector_subsetp) | 3074 | if (op != bool_vector_subsetp) |
| 3058 | adata[i] = mword; | 3075 | adata[i] = mword; |
| 3059 | |||
| 3060 | i++; | ||
| 3061 | } | 3076 | } |
| 3062 | while (i < nr_words); | ||
| 3063 | 3077 | ||
| 3064 | return changed ? dest : Qnil; | 3078 | return changed ? dest : Qnil; |
| 3065 | } | 3079 | } |
| 3066 | 3080 | ||
| 3081 | /* PRECONDITION must be true. Return VALUE. This odd construction | ||
| 3082 | works around a bogus GCC diagnostic "shift count >= width of type". */ | ||
| 3083 | |||
| 3084 | static int | ||
| 3085 | pre_value (bool precondition, int value) | ||
| 3086 | { | ||
| 3087 | eassume (precondition); | ||
| 3088 | return precondition ? value : 0; | ||
| 3089 | } | ||
| 3090 | |||
| 3067 | /* Compute the number of trailing zero bits in val. If val is zero, | 3091 | /* Compute the number of trailing zero bits in val. If val is zero, |
| 3068 | return the number of bits in val. */ | 3092 | return the number of bits in val. */ |
| 3069 | static int | 3093 | static int |
| @@ -3073,27 +3097,34 @@ count_trailing_zero_bits (bits_word val) | |||
| 3073 | return count_trailing_zeros (val); | 3097 | return count_trailing_zeros (val); |
| 3074 | if (BITS_WORD_MAX == ULONG_MAX) | 3098 | if (BITS_WORD_MAX == ULONG_MAX) |
| 3075 | return count_trailing_zeros_l (val); | 3099 | return count_trailing_zeros_l (val); |
| 3076 | # if HAVE_UNSIGNED_LONG_LONG_INT | ||
| 3077 | if (BITS_WORD_MAX == ULLONG_MAX) | 3100 | if (BITS_WORD_MAX == ULLONG_MAX) |
| 3078 | return count_trailing_zeros_ll (val); | 3101 | return count_trailing_zeros_ll (val); |
| 3079 | # endif | ||
| 3080 | 3102 | ||
| 3081 | /* The rest of this code is for the unlikely platform where bits_word differs | 3103 | /* The rest of this code is for the unlikely platform where bits_word differs |
| 3082 | in width from unsigned int, unsigned long, and unsigned long long. */ | 3104 | in width from unsigned int, unsigned long, and unsigned long long. */ |
| 3083 | if (val == 0) | 3105 | val |= ~ BITS_WORD_MAX; |
| 3084 | return CHAR_BIT * sizeof (val); | ||
| 3085 | if (BITS_WORD_MAX <= UINT_MAX) | 3106 | if (BITS_WORD_MAX <= UINT_MAX) |
| 3086 | return count_trailing_zeros (val); | 3107 | return count_trailing_zeros (val); |
| 3087 | if (BITS_WORD_MAX <= ULONG_MAX) | 3108 | if (BITS_WORD_MAX <= ULONG_MAX) |
| 3088 | return count_trailing_zeros_l (val); | 3109 | return count_trailing_zeros_l (val); |
| 3089 | { | 3110 | else |
| 3090 | # if HAVE_UNSIGNED_LONG_LONG_INT | 3111 | { |
| 3091 | verify (BITS_WORD_MAX <= ULLONG_MAX); | 3112 | int count; |
| 3092 | return count_trailing_zeros_ll (val); | 3113 | for (count = 0; |
| 3093 | # else | 3114 | count < BITS_PER_BITS_WORD - BITS_PER_ULL; |
| 3094 | verify (BITS_WORD_MAX <= ULONG_MAX); | 3115 | count += BITS_PER_ULL) |
| 3095 | # endif | 3116 | { |
| 3096 | } | 3117 | if (val & ULLONG_MAX) |
| 3118 | return count + count_trailing_zeros_ll (val); | ||
| 3119 | val = shift_right_ull (val); | ||
| 3120 | } | ||
| 3121 | |||
| 3122 | if (BITS_PER_BITS_WORD % BITS_PER_ULL != 0 | ||
| 3123 | && BITS_WORD_MAX == (bits_word) -1) | ||
| 3124 | val |= (bits_word) 1 << pre_value (ULONG_MAX < BITS_WORD_MAX, | ||
| 3125 | BITS_PER_BITS_WORD % BITS_PER_ULL); | ||
| 3126 | return count + count_trailing_zeros_ll (val); | ||
| 3127 | } | ||
| 3097 | } | 3128 | } |
| 3098 | 3129 | ||
| 3099 | static bits_word | 3130 | static bits_word |
| @@ -3101,19 +3132,24 @@ bits_word_to_host_endian (bits_word val) | |||
| 3101 | { | 3132 | { |
| 3102 | #ifndef WORDS_BIGENDIAN | 3133 | #ifndef WORDS_BIGENDIAN |
| 3103 | return val; | 3134 | return val; |
| 3104 | #elif BITS_WORD_MAX >> 31 == 1 | ||
| 3105 | return bswap_32 (val); | ||
| 3106 | #elif BITS_WORD_MAX >> 31 >> 31 >> 1 == 1 | ||
| 3107 | return bswap_64 (val); | ||
| 3108 | #else | 3135 | #else |
| 3109 | int i; | 3136 | if (BITS_WORD_MAX >> 31 == 1) |
| 3110 | bits_word r = 0; | 3137 | return bswap_32 (val); |
| 3111 | for (i = 0; i < sizeof val; i++) | 3138 | # if HAVE_UNSIGNED_LONG_LONG |
| 3112 | { | 3139 | if (BITS_WORD_MAX >> 31 >> 31 >> 1 == 1) |
| 3113 | r = (r << CHAR_BIT) | (val & ((1u << CHAR_BIT) - 1)); | 3140 | return bswap_64 (val); |
| 3114 | val >>= CHAR_BIT; | 3141 | # endif |
| 3115 | } | 3142 | { |
| 3116 | return r; | 3143 | int i; |
| 3144 | bits_word r = 0; | ||
| 3145 | for (i = 0; i < sizeof val; i++) | ||
| 3146 | { | ||
| 3147 | r = ((r << 1 << (CHAR_BIT - 1)) | ||
| 3148 | | (val & ((1u << 1 << (CHAR_BIT - 1)) - 1))); | ||
| 3149 | val = val >> 1 >> (CHAR_BIT - 1); | ||
| 3150 | } | ||
| 3151 | return r; | ||
| 3152 | } | ||
| 3117 | #endif | 3153 | #endif |
| 3118 | } | 3154 | } |
| 3119 | 3155 | ||
| @@ -3181,13 +3217,12 @@ Return the destination vector. */) | |||
| 3181 | EMACS_INT nr_bits; | 3217 | EMACS_INT nr_bits; |
| 3182 | bits_word *bdata, *adata; | 3218 | bits_word *bdata, *adata; |
| 3183 | ptrdiff_t i; | 3219 | ptrdiff_t i; |
| 3184 | bits_word mword; | ||
| 3185 | 3220 | ||
| 3186 | CHECK_BOOL_VECTOR (a); | 3221 | CHECK_BOOL_VECTOR (a); |
| 3187 | nr_bits = bool_vector_size (a); | 3222 | nr_bits = bool_vector_size (a); |
| 3188 | 3223 | ||
| 3189 | if (NILP (b)) | 3224 | if (NILP (b)) |
| 3190 | b = Fmake_bool_vector (make_number (nr_bits), Qnil); | 3225 | b = make_uninit_bool_vector (nr_bits); |
| 3191 | else | 3226 | else |
| 3192 | { | 3227 | { |
| 3193 | CHECK_BOOL_VECTOR (b); | 3228 | CHECK_BOOL_VECTOR (b); |
| @@ -3195,15 +3230,15 @@ Return the destination vector. */) | |||
| 3195 | wrong_length_argument (a, b, Qnil); | 3230 | wrong_length_argument (a, b, Qnil); |
| 3196 | } | 3231 | } |
| 3197 | 3232 | ||
| 3198 | bdata = (bits_word *) XBOOL_VECTOR (b)->data; | 3233 | bdata = bool_vector_data (b); |
| 3199 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | 3234 | adata = bool_vector_data (a); |
| 3200 | 3235 | ||
| 3201 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++) | 3236 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++) |
| 3202 | bdata[i] = ~adata[i]; | 3237 | bdata[i] = BITS_WORD_MAX & ~adata[i]; |
| 3203 | 3238 | ||
| 3204 | if (nr_bits % BITS_PER_BITS_WORD) | 3239 | if (nr_bits % BITS_PER_BITS_WORD) |
| 3205 | { | 3240 | { |
| 3206 | mword = bits_word_to_host_endian (adata[i]); | 3241 | bits_word mword = bits_word_to_host_endian (adata[i]); |
| 3207 | mword = ~mword; | 3242 | mword = ~mword; |
| 3208 | mword &= bool_vector_spare_mask (nr_bits); | 3243 | mword &= bool_vector_spare_mask (nr_bits); |
| 3209 | bdata[i] = bits_word_to_host_endian (mword); | 3244 | bdata[i] = bits_word_to_host_endian (mword); |
| @@ -3221,27 +3256,20 @@ A must be a bool vector. B is a generalized bool. */) | |||
| 3221 | EMACS_INT count; | 3256 | EMACS_INT count; |
| 3222 | EMACS_INT nr_bits; | 3257 | EMACS_INT nr_bits; |
| 3223 | bits_word *adata; | 3258 | bits_word *adata; |
| 3224 | bits_word match; | 3259 | ptrdiff_t i, nwords; |
| 3225 | ptrdiff_t i; | ||
| 3226 | 3260 | ||
| 3227 | CHECK_BOOL_VECTOR (a); | 3261 | CHECK_BOOL_VECTOR (a); |
| 3228 | 3262 | ||
| 3229 | nr_bits = bool_vector_size (a); | 3263 | nr_bits = bool_vector_size (a); |
| 3264 | nwords = bool_vector_words (nr_bits); | ||
| 3230 | count = 0; | 3265 | count = 0; |
| 3231 | match = NILP (b) ? -1 : 0; | 3266 | adata = bool_vector_data (a); |
| 3232 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | ||
| 3233 | |||
| 3234 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i) | ||
| 3235 | count += popcount_bits_word (adata[i] ^ match); | ||
| 3236 | 3267 | ||
| 3237 | /* Mask out trailing parts of final mword. */ | 3268 | for (i = 0; i < nwords; i++) |
| 3238 | if (nr_bits % BITS_PER_BITS_WORD) | 3269 | count += count_one_bits_word (adata[i]); |
| 3239 | { | ||
| 3240 | bits_word mword = adata[i] ^ match; | ||
| 3241 | mword = bits_word_to_host_endian (mword); | ||
| 3242 | count += popcount_bits_word (mword & bool_vector_spare_mask (nr_bits)); | ||
| 3243 | } | ||
| 3244 | 3270 | ||
| 3271 | if (NILP (b)) | ||
| 3272 | count = nr_bits - count; | ||
| 3245 | return make_number (count); | 3273 | return make_number (count); |
| 3246 | } | 3274 | } |
| 3247 | 3275 | ||
| @@ -3259,7 +3287,7 @@ index into the vector. */) | |||
| 3259 | bits_word *adata; | 3287 | bits_word *adata; |
| 3260 | bits_word twiddle; | 3288 | bits_word twiddle; |
| 3261 | bits_word mword; /* Machine word. */ | 3289 | bits_word mword; /* Machine word. */ |
| 3262 | ptrdiff_t pos; | 3290 | ptrdiff_t pos, pos0; |
| 3263 | ptrdiff_t nr_words; | 3291 | ptrdiff_t nr_words; |
| 3264 | 3292 | ||
| 3265 | CHECK_BOOL_VECTOR (a); | 3293 | CHECK_BOOL_VECTOR (a); |
| @@ -3269,10 +3297,8 @@ index into the vector. */) | |||
| 3269 | if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */ | 3297 | if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */ |
| 3270 | args_out_of_range (a, i); | 3298 | args_out_of_range (a, i); |
| 3271 | 3299 | ||
| 3272 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | 3300 | adata = bool_vector_data (a); |
| 3273 | 3301 | nr_words = bool_vector_words (nr_bits); | |
| 3274 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; | ||
| 3275 | |||
| 3276 | pos = XFASTINT (i) / BITS_PER_BITS_WORD; | 3302 | pos = XFASTINT (i) / BITS_PER_BITS_WORD; |
| 3277 | offset = XFASTINT (i) % BITS_PER_BITS_WORD; | 3303 | offset = XFASTINT (i) % BITS_PER_BITS_WORD; |
| 3278 | count = 0; | 3304 | count = 0; |
| @@ -3280,7 +3306,7 @@ index into the vector. */) | |||
| 3280 | /* By XORing with twiddle, we transform the problem of "count | 3306 | /* By XORing with twiddle, we transform the problem of "count |
| 3281 | consecutive equal values" into "count the zero bits". The latter | 3307 | consecutive equal values" into "count the zero bits". The latter |
| 3282 | operation usually has hardware support. */ | 3308 | operation usually has hardware support. */ |
| 3283 | twiddle = NILP (b) ? 0 : -1; | 3309 | twiddle = NILP (b) ? 0 : BITS_WORD_MAX; |
| 3284 | 3310 | ||
| 3285 | /* Scan the remainder of the mword at the current offset. */ | 3311 | /* Scan the remainder of the mword at the current offset. */ |
| 3286 | if (pos < nr_words && offset != 0) | 3312 | if (pos < nr_words && offset != 0) |
| @@ -3288,8 +3314,8 @@ index into the vector. */) | |||
| 3288 | mword = bits_word_to_host_endian (adata[pos]); | 3314 | mword = bits_word_to_host_endian (adata[pos]); |
| 3289 | mword ^= twiddle; | 3315 | mword ^= twiddle; |
| 3290 | mword >>= offset; | 3316 | mword >>= offset; |
| 3317 | mword |= (bits_word) 1 << (BITS_PER_BITS_WORD - offset); | ||
| 3291 | count = count_trailing_zero_bits (mword); | 3318 | count = count_trailing_zero_bits (mword); |
| 3292 | count = min (count, BITS_PER_BITS_WORD - offset); | ||
| 3293 | pos++; | 3319 | pos++; |
| 3294 | if (count + offset < BITS_PER_BITS_WORD) | 3320 | if (count + offset < BITS_PER_BITS_WORD) |
| 3295 | return make_number (count); | 3321 | return make_number (count); |
| @@ -3298,11 +3324,10 @@ index into the vector. */) | |||
| 3298 | /* Scan whole words until we either reach the end of the vector or | 3324 | /* Scan whole words until we either reach the end of the vector or |
| 3299 | find an mword that doesn't completely match. twiddle is | 3325 | find an mword that doesn't completely match. twiddle is |
| 3300 | endian-independent. */ | 3326 | endian-independent. */ |
| 3327 | pos0 = pos; | ||
| 3301 | while (pos < nr_words && adata[pos] == twiddle) | 3328 | while (pos < nr_words && adata[pos] == twiddle) |
| 3302 | { | 3329 | pos++; |
| 3303 | count += BITS_PER_BITS_WORD; | 3330 | count += (pos - pos0) * BITS_PER_BITS_WORD; |
| 3304 | ++pos; | ||
| 3305 | } | ||
| 3306 | 3331 | ||
| 3307 | if (pos < nr_words) | 3332 | if (pos < nr_words) |
| 3308 | { | 3333 | { |
diff --git a/src/dispextern.h b/src/dispextern.h index 681eba25cb3..d40febd207a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -33,7 +33,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 33 | 33 | ||
| 34 | #else /* !HAVE_X_WINDOWS */ | 34 | #else /* !HAVE_X_WINDOWS */ |
| 35 | 35 | ||
| 36 | /* X-related stuff used by non-X gui code. */ | 36 | /* X-related stuff used by non-X gui code. */ |
| 37 | 37 | ||
| 38 | typedef struct { | 38 | typedef struct { |
| 39 | unsigned long pixel; | 39 | unsigned long pixel; |
| @@ -1543,6 +1543,7 @@ enum lface_attribute_index | |||
| 1543 | LFACE_FONT_INDEX, | 1543 | LFACE_FONT_INDEX, |
| 1544 | LFACE_INHERIT_INDEX, | 1544 | LFACE_INHERIT_INDEX, |
| 1545 | LFACE_FONTSET_INDEX, | 1545 | LFACE_FONTSET_INDEX, |
| 1546 | LFACE_DISTANT_FOREGROUND_INDEX, | ||
| 1546 | LFACE_VECTOR_SIZE | 1547 | LFACE_VECTOR_SIZE |
| 1547 | }; | 1548 | }; |
| 1548 | 1549 | ||
| @@ -1581,6 +1582,10 @@ enum face_underline_type | |||
| 1581 | 1582 | ||
| 1582 | struct face | 1583 | struct face |
| 1583 | { | 1584 | { |
| 1585 | /* The Lisp face attributes this face realizes. All attributes | ||
| 1586 | in this vector are non-nil. */ | ||
| 1587 | Lisp_Object lface[LFACE_VECTOR_SIZE]; | ||
| 1588 | |||
| 1584 | /* The id of this face. The id equals the index of this face in the | 1589 | /* The id of this face. The id equals the index of this face in the |
| 1585 | vector faces_by_id of its face cache. */ | 1590 | vector faces_by_id of its face cache. */ |
| 1586 | int id; | 1591 | int id; |
| @@ -1595,11 +1600,6 @@ struct face | |||
| 1595 | an id as returned from load_pixmap. */ | 1600 | an id as returned from load_pixmap. */ |
| 1596 | ptrdiff_t stipple; | 1601 | ptrdiff_t stipple; |
| 1597 | 1602 | ||
| 1598 | #else /* not HAVE_WINDOW_SYSTEM */ | ||
| 1599 | |||
| 1600 | /* Dummy. */ | ||
| 1601 | ptrdiff_t stipple; | ||
| 1602 | |||
| 1603 | #endif /* not HAVE_WINDOW_SYSTEM */ | 1603 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 1604 | 1604 | ||
| 1605 | /* Pixel value of foreground color for X frames. Color index | 1605 | /* Pixel value of foreground color for X frames. Color index |
| @@ -1624,9 +1624,6 @@ struct face | |||
| 1624 | from the same ASCII face have the same fontset. */ | 1624 | from the same ASCII face have the same fontset. */ |
| 1625 | int fontset; | 1625 | int fontset; |
| 1626 | 1626 | ||
| 1627 | /* Pixmap width and height. */ | ||
| 1628 | unsigned int pixmap_w, pixmap_h; | ||
| 1629 | |||
| 1630 | /* Non-zero means characters in this face have a box of that | 1627 | /* Non-zero means characters in this face have a box of that |
| 1631 | thickness around them. If this value is negative, its absolute | 1628 | thickness around them. If this value is negative, its absolute |
| 1632 | value indicates the thickness, and the horizontal (top and | 1629 | value indicates the thickness, and the horizontal (top and |
| @@ -1640,10 +1637,10 @@ struct face | |||
| 1640 | of width box_line_width is drawn in color box_color. A value of | 1637 | of width box_line_width is drawn in color box_color. A value of |
| 1641 | FACE_RAISED_BOX or FACE_SUNKEN_BOX means a 3D box is drawn with | 1638 | FACE_RAISED_BOX or FACE_SUNKEN_BOX means a 3D box is drawn with |
| 1642 | shadow colors derived from the background color of the face. */ | 1639 | shadow colors derived from the background color of the face. */ |
| 1643 | enum face_box_type box; | 1640 | ENUM_BF (face_box_type) box : 2; |
| 1644 | 1641 | ||
| 1645 | /* Style of underlining. */ | 1642 | /* Style of underlining. */ |
| 1646 | enum face_underline_type underline_type; | 1643 | ENUM_BF (face_underline_type) underline_type : 1; |
| 1647 | 1644 | ||
| 1648 | /* If `box' above specifies a 3D type, 1 means use box_color for | 1645 | /* If `box' above specifies a 3D type, 1 means use box_color for |
| 1649 | drawing shadows. */ | 1646 | drawing shadows. */ |
| @@ -1695,10 +1692,6 @@ struct face | |||
| 1695 | unsigned synth_ital : 1; | 1692 | unsigned synth_ital : 1; |
| 1696 | #endif | 1693 | #endif |
| 1697 | 1694 | ||
| 1698 | /* The Lisp face attributes this face realizes. All attributes | ||
| 1699 | in this vector are non-nil. */ | ||
| 1700 | Lisp_Object lface[LFACE_VECTOR_SIZE]; | ||
| 1701 | |||
| 1702 | /* The hash value of this face. */ | 1695 | /* The hash value of this face. */ |
| 1703 | unsigned hash; | 1696 | unsigned hash; |
| 1704 | 1697 | ||
| @@ -1727,6 +1720,15 @@ struct face | |||
| 1727 | 1720 | ||
| 1728 | #define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3) | 1721 | #define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3) |
| 1729 | 1722 | ||
| 1723 | /* True if COLOR is a specified (i.e., nondefault) foreground or | ||
| 1724 | background color for a tty face. */ | ||
| 1725 | |||
| 1726 | INLINE bool | ||
| 1727 | face_tty_specified_color (unsigned long color) | ||
| 1728 | { | ||
| 1729 | return color < FACE_TTY_DEFAULT_BG_COLOR; | ||
| 1730 | } | ||
| 1731 | |||
| 1730 | /* Non-zero if FACE was realized for unibyte use. */ | 1732 | /* Non-zero if FACE was realized for unibyte use. */ |
| 1731 | 1733 | ||
| 1732 | #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0) | 1734 | #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0) |
| @@ -2222,10 +2224,6 @@ struct it | |||
| 2222 | used for overlay strings and strings from display properties. */ | 2224 | used for overlay strings and strings from display properties. */ |
| 2223 | ptrdiff_t string_nchars; | 2225 | ptrdiff_t string_nchars; |
| 2224 | 2226 | ||
| 2225 | /* Start and end of a visible region; -1 if the region is not | ||
| 2226 | visible in the window. */ | ||
| 2227 | ptrdiff_t region_beg_charpos, region_end_charpos; | ||
| 2228 | |||
| 2229 | /* Position at which redisplay end trigger functions should be run. */ | 2227 | /* Position at which redisplay end trigger functions should be run. */ |
| 2230 | ptrdiff_t redisplay_end_trigger_charpos; | 2228 | ptrdiff_t redisplay_end_trigger_charpos; |
| 2231 | 2229 | ||
| @@ -2359,7 +2357,7 @@ struct it | |||
| 2359 | } stretch; | 2357 | } stretch; |
| 2360 | } u; | 2358 | } u; |
| 2361 | 2359 | ||
| 2362 | /* current text and display positions. */ | 2360 | /* Current text and display positions. */ |
| 2363 | struct text_pos position; | 2361 | struct text_pos position; |
| 2364 | struct display_pos current; | 2362 | struct display_pos current; |
| 2365 | Lisp_Object from_overlay; | 2363 | Lisp_Object from_overlay; |
| @@ -2371,11 +2369,12 @@ struct it | |||
| 2371 | unsigned string_from_prefix_prop_p : 1; | 2369 | unsigned string_from_prefix_prop_p : 1; |
| 2372 | unsigned display_ellipsis_p : 1; | 2370 | unsigned display_ellipsis_p : 1; |
| 2373 | unsigned avoid_cursor_p : 1; | 2371 | unsigned avoid_cursor_p : 1; |
| 2374 | unsigned bidi_p:1; | 2372 | unsigned bidi_p : 1; |
| 2375 | unsigned from_disp_prop_p : 1; | 2373 | unsigned from_disp_prop_p : 1; |
| 2376 | enum line_wrap_method line_wrap; | 2374 | enum line_wrap_method line_wrap; |
| 2377 | 2375 | ||
| 2378 | /* properties from display property that are reset by another display property. */ | 2376 | /* Properties from display property that are reset by another display |
| 2377 | property. */ | ||
| 2379 | short voffset; | 2378 | short voffset; |
| 2380 | Lisp_Object space_width; | 2379 | Lisp_Object space_width; |
| 2381 | Lisp_Object font_height; | 2380 | Lisp_Object font_height; |
| @@ -3282,8 +3281,6 @@ extern unsigned row_hash (struct glyph_row *); | |||
| 3282 | 3281 | ||
| 3283 | #ifdef HAVE_WINDOW_SYSTEM | 3282 | #ifdef HAVE_WINDOW_SYSTEM |
| 3284 | 3283 | ||
| 3285 | extern int x_bitmap_height (struct frame *, ptrdiff_t); | ||
| 3286 | extern int x_bitmap_width (struct frame *, ptrdiff_t); | ||
| 3287 | extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t); | 3284 | extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t); |
| 3288 | extern void x_reference_bitmap (struct frame *, ptrdiff_t); | 3285 | extern void x_reference_bitmap (struct frame *, ptrdiff_t); |
| 3289 | extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, | 3286 | extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, |
| @@ -3335,9 +3332,10 @@ void init_baud_rate (int); | |||
| 3335 | void init_sigio (int); | 3332 | void init_sigio (int); |
| 3336 | void ignore_sigio (void); | 3333 | void ignore_sigio (void); |
| 3337 | 3334 | ||
| 3338 | /* Defined in xfaces.c */ | 3335 | /* Defined in xfaces.c. */ |
| 3339 | 3336 | ||
| 3340 | #ifdef HAVE_X_WINDOWS | 3337 | #ifdef HAVE_X_WINDOWS |
| 3338 | void unload_color (struct frame *, unsigned long); | ||
| 3341 | void x_free_colors (struct frame *, unsigned long *, int); | 3339 | void x_free_colors (struct frame *, unsigned long *, int); |
| 3342 | #endif | 3340 | #endif |
| 3343 | 3341 | ||
| @@ -3349,7 +3347,6 @@ void clear_face_cache (int); | |||
| 3349 | unsigned long load_color (struct frame *, struct face *, Lisp_Object, | 3347 | unsigned long load_color (struct frame *, struct face *, Lisp_Object, |
| 3350 | enum lface_attribute_index); | 3348 | enum lface_attribute_index); |
| 3351 | #endif | 3349 | #endif |
| 3352 | void unload_color (struct frame *, unsigned long); | ||
| 3353 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, | 3350 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, |
| 3354 | int *); | 3351 | int *); |
| 3355 | void prepare_face_for_display (struct frame *, struct face *); | 3352 | void prepare_face_for_display (struct frame *, struct face *); |
| @@ -3362,16 +3359,13 @@ void init_frame_faces (struct frame *); | |||
| 3362 | void free_frame_faces (struct frame *); | 3359 | void free_frame_faces (struct frame *); |
| 3363 | void recompute_basic_faces (struct frame *); | 3360 | void recompute_basic_faces (struct frame *); |
| 3364 | int face_at_buffer_position (struct window *w, ptrdiff_t pos, | 3361 | int face_at_buffer_position (struct window *w, ptrdiff_t pos, |
| 3365 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 3366 | ptrdiff_t *endptr, ptrdiff_t limit, | 3362 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 3367 | int mouse, int base_face_id); | 3363 | int mouse, int base_face_id); |
| 3368 | int face_for_overlay_string (struct window *w, ptrdiff_t pos, | 3364 | int face_for_overlay_string (struct window *w, ptrdiff_t pos, |
| 3369 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 3370 | ptrdiff_t *endptr, ptrdiff_t limit, | 3365 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 3371 | int mouse, Lisp_Object overlay); | 3366 | int mouse, Lisp_Object overlay); |
| 3372 | int face_at_string_position (struct window *w, Lisp_Object string, | 3367 | int face_at_string_position (struct window *w, Lisp_Object string, |
| 3373 | ptrdiff_t pos, ptrdiff_t bufpos, | 3368 | ptrdiff_t pos, ptrdiff_t bufpos, |
| 3374 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 3375 | ptrdiff_t *endptr, enum face_id, int mouse); | 3369 | ptrdiff_t *endptr, enum face_id, int mouse); |
| 3376 | int merge_faces (struct frame *, Lisp_Object, int, int); | 3370 | int merge_faces (struct frame *, Lisp_Object, int, int); |
| 3377 | int compute_char_face (struct frame *, int, Lisp_Object); | 3371 | int compute_char_face (struct frame *, int, Lisp_Object); |
| @@ -3379,7 +3373,7 @@ void free_all_realized_faces (Lisp_Object); | |||
| 3379 | extern Lisp_Object Qforeground_color, Qbackground_color; | 3373 | extern Lisp_Object Qforeground_color, Qbackground_color; |
| 3380 | extern char unspecified_fg[], unspecified_bg[]; | 3374 | extern char unspecified_fg[], unspecified_bg[]; |
| 3381 | 3375 | ||
| 3382 | /* Defined in xfns.c */ | 3376 | /* Defined in xfns.c. */ |
| 3383 | 3377 | ||
| 3384 | #ifdef HAVE_X_WINDOWS | 3378 | #ifdef HAVE_X_WINDOWS |
| 3385 | void gamma_correct (struct frame *, XColor *); | 3379 | void gamma_correct (struct frame *, XColor *); |
| @@ -3504,8 +3498,7 @@ extern int string_cost (const char *); | |||
| 3504 | extern int per_line_cost (const char *); | 3498 | extern int per_line_cost (const char *); |
| 3505 | extern void calculate_costs (struct frame *); | 3499 | extern void calculate_costs (struct frame *); |
| 3506 | extern void produce_glyphs (struct it *); | 3500 | extern void produce_glyphs (struct it *); |
| 3507 | extern bool tty_capable_p (struct tty_display_info *, unsigned, | 3501 | extern bool tty_capable_p (struct tty_display_info *, unsigned); |
| 3508 | unsigned long, unsigned long); | ||
| 3509 | extern void set_tty_color_mode (struct tty_display_info *, struct frame *); | 3502 | extern void set_tty_color_mode (struct tty_display_info *, struct frame *); |
| 3510 | extern struct terminal *get_named_tty (const char *); | 3503 | extern struct terminal *get_named_tty (const char *); |
| 3511 | extern void create_tty_output (struct frame *); | 3504 | extern void create_tty_output (struct frame *); |
diff --git a/src/dispnew.c b/src/dispnew.c index 25acdd725dd..3207f4a0018 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -42,6 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | #include "process.h" | 42 | #include "process.h" |
| 43 | 43 | ||
| 44 | #include "syssignal.h" | 44 | #include "syssignal.h" |
| 45 | #include "tparam.h" | ||
| 45 | 46 | ||
| 46 | #ifdef HAVE_WINDOW_SYSTEM | 47 | #ifdef HAVE_WINDOW_SYSTEM |
| 47 | #include TERM_HEADER | 48 | #include TERM_HEADER |
| @@ -52,10 +53,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 52 | #include <fpending.h> | 53 | #include <fpending.h> |
| 53 | #include <timespec.h> | 54 | #include <timespec.h> |
| 54 | 55 | ||
| 55 | #if defined (HAVE_TERM_H) && defined (GNU_LINUX) | ||
| 56 | #include <term.h> /* for tgetent */ | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #ifdef WINDOWSNT | 56 | #ifdef WINDOWSNT |
| 60 | #include "w32.h" | 57 | #include "w32.h" |
| 61 | #endif | 58 | #endif |
| @@ -2943,7 +2940,7 @@ redraw_frame (struct frame *f) | |||
| 2943 | clear_frame (f); | 2940 | clear_frame (f); |
| 2944 | clear_current_matrices (f); | 2941 | clear_current_matrices (f); |
| 2945 | update_end (f); | 2942 | update_end (f); |
| 2946 | windows_or_buffers_changed++; | 2943 | windows_or_buffers_changed = 13; |
| 2947 | /* Mark all windows as inaccurate, so that every window will have | 2944 | /* Mark all windows as inaccurate, so that every window will have |
| 2948 | its redisplay done. */ | 2945 | its redisplay done. */ |
| 2949 | mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); | 2946 | mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); |
diff --git a/src/disptab.h b/src/disptab.h index 87dc5a22a68..e02bab04bbc 100644 --- a/src/disptab.h +++ b/src/disptab.h | |||
| @@ -59,7 +59,7 @@ extern Lisp_Object Qdisplay_table; | |||
| 59 | /* Return the current base (for indexing) of the GLYPH table, | 59 | /* Return the current base (for indexing) of the GLYPH table, |
| 60 | or 0 if the table isn't currently valid. */ | 60 | or 0 if the table isn't currently valid. */ |
| 61 | #define GLYPH_TABLE_BASE \ | 61 | #define GLYPH_TABLE_BASE \ |
| 62 | ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->u.contents : 0) | 62 | ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->contents : 0) |
| 63 | 63 | ||
| 64 | /* Given BASE and LEN returned by the two previous macros, | 64 | /* Given BASE and LEN returned by the two previous macros, |
| 65 | return nonzero if the GLYPH code G should be output as a single | 65 | return nonzero if the GLYPH code G should be output as a single |
| @@ -850,6 +850,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 850 | /* This is for computing the SHADOWS arg for describe_map_tree. */ | 850 | /* This is for computing the SHADOWS arg for describe_map_tree. */ |
| 851 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); | 851 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); |
| 852 | Lisp_Object earlier_maps; | 852 | Lisp_Object earlier_maps; |
| 853 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 853 | 854 | ||
| 854 | changed = 1; | 855 | changed = 1; |
| 855 | strp += 2; /* skip \{ or \< */ | 856 | strp += 2; /* skip \{ or \< */ |
| @@ -886,6 +887,10 @@ Otherwise, return a new string, without any text properties. */) | |||
| 886 | /* Now switch to a temp buffer. */ | 887 | /* Now switch to a temp buffer. */ |
| 887 | oldbuf = current_buffer; | 888 | oldbuf = current_buffer; |
| 888 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); | 889 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); |
| 890 | /* This is for an unusual case where some after-change | ||
| 891 | function uses 'format' or 'prin1' or something else that | ||
| 892 | will thrash Vprin1_to_string_buffer we are using. */ | ||
| 893 | specbind (Qinhibit_modification_hooks, Qt); | ||
| 889 | 894 | ||
| 890 | if (NILP (tem)) | 895 | if (NILP (tem)) |
| 891 | { | 896 | { |
| @@ -910,6 +915,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 910 | tem = Fbuffer_string (); | 915 | tem = Fbuffer_string (); |
| 911 | Ferase_buffer (); | 916 | Ferase_buffer (); |
| 912 | set_buffer_internal (oldbuf); | 917 | set_buffer_internal (oldbuf); |
| 918 | unbind_to (count, Qnil); | ||
| 913 | 919 | ||
| 914 | subst_string: | 920 | subst_string: |
| 915 | start = SDATA (tem); | 921 | start = SDATA (tem); |
diff --git a/src/dosfns.c b/src/dosfns.c index 37d3998b5ee..426da1fb41a 100644 --- a/src/dosfns.c +++ b/src/dosfns.c | |||
| @@ -472,7 +472,7 @@ x_set_title (struct frame *f, Lisp_Object name) | |||
| 472 | if (EQ (name, f->title)) | 472 | if (EQ (name, f->title)) |
| 473 | return; | 473 | return; |
| 474 | 474 | ||
| 475 | update_mode_lines = 1; | 475 | update_mode_lines = 13; |
| 476 | 476 | ||
| 477 | fset_title (f, name); | 477 | fset_title (f, name); |
| 478 | 478 | ||
diff --git a/src/editfns.c b/src/editfns.c index d4c1f995d61..277e5b60704 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1702,6 +1702,7 @@ by text that describes the specified date and time in TIME: | |||
| 1702 | %G is the year corresponding to the ISO week, %g within the century. | 1702 | %G is the year corresponding to the ISO week, %g within the century. |
| 1703 | %m is the numeric month. | 1703 | %m is the numeric month. |
| 1704 | %b and %h are the locale's abbreviated month name, %B the full name. | 1704 | %b and %h are the locale's abbreviated month name, %B the full name. |
| 1705 | (%h is not supported on MS-Windows.) | ||
| 1705 | %d is the day of the month, zero-padded, %e is blank-padded. | 1706 | %d is the day of the month, zero-padded, %e is blank-padded. |
| 1706 | %u is the numeric day of week from 1 (Monday) to 7, %w from 0 (Sunday) to 6. | 1707 | %u is the numeric day of week from 1 (Monday) to 7, %w from 0 (Sunday) to 6. |
| 1707 | %a is the locale's abbreviated name of the day of week, %A the full name. | 1708 | %a is the locale's abbreviated name of the day of week, %A the full name. |
diff --git a/src/emacs.c b/src/emacs.c index a58829e8918..3e9635fd229 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -254,7 +254,7 @@ Action options:\n\ | |||
| 254 | FILE visit FILE using find-file\n\ | 254 | FILE visit FILE using find-file\n\ |
| 255 | +LINE go to line LINE in next FILE\n\ | 255 | +LINE go to line LINE in next FILE\n\ |
| 256 | +LINE:COLUMN go to line LINE, column COLUMN, in next FILE\n\ | 256 | +LINE:COLUMN go to line LINE, column COLUMN, in next FILE\n\ |
| 257 | --directory, -L DIR add DIR to variable load-path\n\ | 257 | --directory, -L DIR prepend DIR to load-path (with :DIR, append DIR)\n\ |
| 258 | --eval EXPR evaluate Emacs Lisp expression EXPR\n\ | 258 | --eval EXPR evaluate Emacs Lisp expression EXPR\n\ |
| 259 | --execute EXPR evaluate Emacs Lisp expression EXPR\n\ | 259 | --execute EXPR evaluate Emacs Lisp expression EXPR\n\ |
| 260 | ", | 260 | ", |
| @@ -383,7 +383,7 @@ terminate_due_to_signal (int sig, int backtrace_limit) | |||
| 383 | /* Code for dealing with Lisp access to the Unix command line. */ | 383 | /* Code for dealing with Lisp access to the Unix command line. */ |
| 384 | 384 | ||
| 385 | static void | 385 | static void |
| 386 | init_cmdargs (int argc, char **argv, int skip_args) | 386 | init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) |
| 387 | { | 387 | { |
| 388 | register int i; | 388 | register int i; |
| 389 | Lisp_Object name, dir, handler; | 389 | Lisp_Object name, dir, handler; |
| @@ -393,7 +393,7 @@ init_cmdargs (int argc, char **argv, int skip_args) | |||
| 393 | initial_argv = argv; | 393 | initial_argv = argv; |
| 394 | initial_argc = argc; | 394 | initial_argc = argc; |
| 395 | 395 | ||
| 396 | raw_name = build_string (argv[0]); | 396 | raw_name = build_unibyte_string (argv[0]); |
| 397 | 397 | ||
| 398 | /* Add /: to the front of the name | 398 | /* Add /: to the front of the name |
| 399 | if it would otherwise be treated as magic. */ | 399 | if it would otherwise be treated as magic. */ |
| @@ -426,7 +426,12 @@ init_cmdargs (int argc, char **argv, int skip_args) | |||
| 426 | && NILP (Ffile_name_absolute_p (Vinvocation_directory))) | 426 | && NILP (Ffile_name_absolute_p (Vinvocation_directory))) |
| 427 | /* Emacs was started with relative path, like ./emacs. | 427 | /* Emacs was started with relative path, like ./emacs. |
| 428 | Make it absolute. */ | 428 | Make it absolute. */ |
| 429 | Vinvocation_directory = Fexpand_file_name (Vinvocation_directory, Qnil); | 429 | { |
| 430 | Lisp_Object odir = | ||
| 431 | original_pwd ? build_unibyte_string (original_pwd) : Qnil; | ||
| 432 | |||
| 433 | Vinvocation_directory = Fexpand_file_name (Vinvocation_directory, odir); | ||
| 434 | } | ||
| 430 | 435 | ||
| 431 | Vinstallation_directory = Qnil; | 436 | Vinstallation_directory = Qnil; |
| 432 | 437 | ||
| @@ -699,6 +704,9 @@ main (int argc, char **argv) | |||
| 699 | #endif | 704 | #endif |
| 700 | char *ch_to_dir; | 705 | char *ch_to_dir; |
| 701 | 706 | ||
| 707 | /* If we use --chdir, this records the original directory. */ | ||
| 708 | char *original_pwd = 0; | ||
| 709 | |||
| 702 | #if GC_MARK_STACK | 710 | #if GC_MARK_STACK |
| 703 | stack_base = &dummy; | 711 | stack_base = &dummy; |
| 704 | #endif | 712 | #endif |
| @@ -786,12 +794,15 @@ main (int argc, char **argv) | |||
| 786 | } | 794 | } |
| 787 | 795 | ||
| 788 | if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args)) | 796 | if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args)) |
| 789 | if (chdir (ch_to_dir) == -1) | 797 | { |
| 790 | { | 798 | original_pwd = get_current_dir_name (); |
| 791 | fprintf (stderr, "%s: Can't chdir to %s: %s\n", | 799 | if (chdir (ch_to_dir) != 0) |
| 792 | argv[0], ch_to_dir, strerror (errno)); | 800 | { |
| 793 | exit (1); | 801 | fprintf (stderr, "%s: Can't chdir to %s: %s\n", |
| 794 | } | 802 | argv[0], ch_to_dir, strerror (errno)); |
| 803 | exit (1); | ||
| 804 | } | ||
| 805 | } | ||
| 795 | 806 | ||
| 796 | dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 | 807 | dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 |
| 797 | || strcmp (argv[argc - 1], "bootstrap") == 0); | 808 | || strcmp (argv[argc - 1], "bootstrap") == 0); |
| @@ -1187,10 +1198,13 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1187 | if (!noninteractive) | 1198 | if (!noninteractive) |
| 1188 | { | 1199 | { |
| 1189 | #ifdef NS_IMPL_COCOA | 1200 | #ifdef NS_IMPL_COCOA |
| 1201 | /* Started from GUI? */ | ||
| 1202 | /* FIXME: Do the right thing if getenv returns NULL, or if | ||
| 1203 | chdir fails. */ | ||
| 1204 | if (! inhibit_window_system && ! isatty (0)) | ||
| 1205 | chdir (getenv ("HOME")); | ||
| 1190 | if (skip_args < argc) | 1206 | if (skip_args < argc) |
| 1191 | { | 1207 | { |
| 1192 | /* FIXME: Do the right thing if getenv returns NULL, or if | ||
| 1193 | chdir fails. */ | ||
| 1194 | if (!strncmp (argv[skip_args], "-psn", 4)) | 1208 | if (!strncmp (argv[skip_args], "-psn", 4)) |
| 1195 | { | 1209 | { |
| 1196 | skip_args += 1; | 1210 | skip_args += 1; |
| @@ -1318,7 +1332,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1318 | init_buffer (); /* Init default directory of main buffer. */ | 1332 | init_buffer (); /* Init default directory of main buffer. */ |
| 1319 | 1333 | ||
| 1320 | init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */ | 1334 | init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */ |
| 1321 | init_cmdargs (argc, argv, skip_args); /* Must precede init_lread. */ | 1335 | |
| 1336 | /* Must precede init_lread. */ | ||
| 1337 | init_cmdargs (argc, argv, skip_args, original_pwd); | ||
| 1322 | 1338 | ||
| 1323 | if (initialized) | 1339 | if (initialized) |
| 1324 | { | 1340 | { |
| @@ -2041,11 +2057,15 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2041 | 2057 | ||
| 2042 | CHECK_STRING (filename); | 2058 | CHECK_STRING (filename); |
| 2043 | filename = Fexpand_file_name (filename, Qnil); | 2059 | filename = Fexpand_file_name (filename, Qnil); |
| 2060 | filename = ENCODE_FILE (filename); | ||
| 2044 | if (!NILP (symfile)) | 2061 | if (!NILP (symfile)) |
| 2045 | { | 2062 | { |
| 2046 | CHECK_STRING (symfile); | 2063 | CHECK_STRING (symfile); |
| 2047 | if (SCHARS (symfile)) | 2064 | if (SCHARS (symfile)) |
| 2048 | symfile = Fexpand_file_name (symfile, Qnil); | 2065 | { |
| 2066 | symfile = Fexpand_file_name (symfile, Qnil); | ||
| 2067 | symfile = ENCODE_FILE (symfile); | ||
| 2068 | } | ||
| 2049 | } | 2069 | } |
| 2050 | 2070 | ||
| 2051 | tem = Vpurify_flag; | 2071 | tem = Vpurify_flag; |
| @@ -2201,7 +2221,7 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2201 | p = strchr (path, SEPCHAR); | 2221 | p = strchr (path, SEPCHAR); |
| 2202 | if (!p) | 2222 | if (!p) |
| 2203 | p = path + strlen (path); | 2223 | p = path + strlen (path); |
| 2204 | element = (p - path ? make_string (path, p - path) | 2224 | element = (p - path ? make_unibyte_string (path, p - path) |
| 2205 | : build_string (".")); | 2225 | : build_string (".")); |
| 2206 | #ifdef WINDOWSNT | 2226 | #ifdef WINDOWSNT |
| 2207 | /* Relative file names in the default path are interpreted as | 2227 | /* Relative file names in the default path are interpreted as |
| @@ -2211,7 +2231,7 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2211 | element = Fexpand_file_name (Fsubstring (element, | 2231 | element = Fexpand_file_name (Fsubstring (element, |
| 2212 | make_number (emacs_dir_len), | 2232 | make_number (emacs_dir_len), |
| 2213 | Qnil), | 2233 | Qnil), |
| 2214 | build_string (emacs_dir)); | 2234 | build_unibyte_string (emacs_dir)); |
| 2215 | #endif | 2235 | #endif |
| 2216 | 2236 | ||
| 2217 | /* Add /: to the front of the name | 2237 | /* Add /: to the front of the name |
diff --git a/src/eval.c b/src/eval.c index 1e0a63a0ece..d3fcec5aef4 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -237,11 +237,22 @@ init_eval_once (void) | |||
| 237 | Vrun_hooks = Qnil; | 237 | Vrun_hooks = Qnil; |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | static struct handler handlerlist_sentinel; | ||
| 241 | |||
| 240 | void | 242 | void |
| 241 | init_eval (void) | 243 | init_eval (void) |
| 242 | { | 244 | { |
| 243 | specpdl_ptr = specpdl; | 245 | specpdl_ptr = specpdl; |
| 244 | handlerlist = NULL; | 246 | { /* Put a dummy catcher at top-level so that handlerlist is never NULL. |
| 247 | This is important since handlerlist->nextfree holds the freelist | ||
| 248 | which would otherwise leak every time we unwind back to top-level. */ | ||
| 249 | struct handler *c; | ||
| 250 | handlerlist = handlerlist_sentinel.nextfree = &handlerlist_sentinel; | ||
| 251 | PUSH_HANDLER (c, Qunbound, CATCHER); | ||
| 252 | eassert (c == &handlerlist_sentinel); | ||
| 253 | handlerlist_sentinel.nextfree = NULL; | ||
| 254 | handlerlist_sentinel.next = NULL; | ||
| 255 | } | ||
| 245 | Vquit_flag = Qnil; | 256 | Vquit_flag = Qnil; |
| 246 | debug_on_next_call = 0; | 257 | debug_on_next_call = 0; |
| 247 | lisp_eval_depth = 0; | 258 | lisp_eval_depth = 0; |
| @@ -1129,6 +1140,8 @@ unwind_to_catch (struct handler *catch, Lisp_Object value) | |||
| 1129 | { | 1140 | { |
| 1130 | bool last_time; | 1141 | bool last_time; |
| 1131 | 1142 | ||
| 1143 | eassert (catch->next); | ||
| 1144 | |||
| 1132 | /* Save the value in the tag. */ | 1145 | /* Save the value in the tag. */ |
| 1133 | catch->val = value; | 1146 | catch->val = value; |
| 1134 | 1147 | ||
| @@ -1542,7 +1555,10 @@ See also the function `condition-case'. */) | |||
| 1542 | } | 1555 | } |
| 1543 | else | 1556 | else |
| 1544 | { | 1557 | { |
| 1545 | if (handlerlist != 0) | 1558 | if (handlerlist != &handlerlist_sentinel) |
| 1559 | /* FIXME: This will come right back here if there's no `top-level' | ||
| 1560 | catcher. A better solution would be to abort here, and instead | ||
| 1561 | add a catch-all condition handler so we never come here. */ | ||
| 1546 | Fthrow (Qtop_level, Qt); | 1562 | Fthrow (Qtop_level, Qt); |
| 1547 | } | 1563 | } |
| 1548 | 1564 | ||
| @@ -2479,7 +2495,7 @@ run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, | |||
| 2479 | 2495 | ||
| 2480 | if (EQ (val, Qunbound) || NILP (val)) | 2496 | if (EQ (val, Qunbound) || NILP (val)) |
| 2481 | return ret; | 2497 | return ret; |
| 2482 | else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) | 2498 | else if (!CONSP (val) || FUNCTIONP (val)) |
| 2483 | { | 2499 | { |
| 2484 | args[0] = val; | 2500 | args[0] = val; |
| 2485 | return funcall (nargs, args); | 2501 | return funcall (nargs, args); |
diff --git a/src/fileio.c b/src/fileio.c index eeaa736290c..fbf896e91c3 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -49,6 +49,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 49 | #include "coding.h" | 49 | #include "coding.h" |
| 50 | #include "window.h" | 50 | #include "window.h" |
| 51 | #include "blockinput.h" | 51 | #include "blockinput.h" |
| 52 | #include "region-cache.h" | ||
| 52 | #include "frame.h" | 53 | #include "frame.h" |
| 53 | #include "dispextern.h" | 54 | #include "dispextern.h" |
| 54 | 55 | ||
| @@ -733,8 +734,8 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p; | |||
| 733 | Lisp_Object | 734 | Lisp_Object |
| 734 | make_temp_name (Lisp_Object prefix, bool base64_p) | 735 | make_temp_name (Lisp_Object prefix, bool base64_p) |
| 735 | { | 736 | { |
| 736 | Lisp_Object val; | 737 | Lisp_Object val, encoded_prefix; |
| 737 | int len, clen; | 738 | int len; |
| 738 | printmax_t pid; | 739 | printmax_t pid; |
| 739 | char *p, *data; | 740 | char *p, *data; |
| 740 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; | 741 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; |
| @@ -768,12 +769,11 @@ make_temp_name (Lisp_Object prefix, bool base64_p) | |||
| 768 | #endif | 769 | #endif |
| 769 | } | 770 | } |
| 770 | 771 | ||
| 771 | len = SBYTES (prefix); clen = SCHARS (prefix); | 772 | encoded_prefix = ENCODE_FILE (prefix); |
| 772 | val = make_uninit_multibyte_string (clen + 3 + pidlen, len + 3 + pidlen); | 773 | len = SBYTES (encoded_prefix); |
| 773 | if (!STRING_MULTIBYTE (prefix)) | 774 | val = make_uninit_string (len + 3 + pidlen); |
| 774 | STRING_SET_UNIBYTE (val); | ||
| 775 | data = SSDATA (val); | 775 | data = SSDATA (val); |
| 776 | memcpy (data, SSDATA (prefix), len); | 776 | memcpy (data, SSDATA (encoded_prefix), len); |
| 777 | p = data + len; | 777 | p = data + len; |
| 778 | 778 | ||
| 779 | memcpy (p, pidbuf, pidlen); | 779 | memcpy (p, pidbuf, pidlen); |
| @@ -811,7 +811,7 @@ make_temp_name (Lisp_Object prefix, bool base64_p) | |||
| 811 | { | 811 | { |
| 812 | /* We want to return only if errno is ENOENT. */ | 812 | /* We want to return only if errno is ENOENT. */ |
| 813 | if (errno == ENOENT) | 813 | if (errno == ENOENT) |
| 814 | return val; | 814 | return DECODE_FILE (val); |
| 815 | else | 815 | else |
| 816 | /* The error here is dubious, but there is little else we | 816 | /* The error here is dubious, but there is little else we |
| 817 | can do. The alternatives are to return nil, which is | 817 | can do. The alternatives are to return nil, which is |
| @@ -988,7 +988,26 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 988 | if (multibyte != STRING_MULTIBYTE (default_directory)) | 988 | if (multibyte != STRING_MULTIBYTE (default_directory)) |
| 989 | { | 989 | { |
| 990 | if (multibyte) | 990 | if (multibyte) |
| 991 | default_directory = string_to_multibyte (default_directory); | 991 | { |
| 992 | unsigned char *p = SDATA (name); | ||
| 993 | |||
| 994 | while (*p && ASCII_BYTE_P (*p)) | ||
| 995 | p++; | ||
| 996 | if (*p == '\0') | ||
| 997 | { | ||
| 998 | /* NAME is a pure ASCII string, and DEFAULT_DIRECTORY is | ||
| 999 | unibyte. Do not convert DEFAULT_DIRECTORY to | ||
| 1000 | multibyte; instead, convert NAME to a unibyte string, | ||
| 1001 | so that the result of this function is also a unibyte | ||
| 1002 | string. This is needed during bootstrapping and | ||
| 1003 | dumping, when Emacs cannot decode file names, because | ||
| 1004 | the locale environment is not set up. */ | ||
| 1005 | name = make_unibyte_string (SSDATA (name), SBYTES (name)); | ||
| 1006 | multibyte = 0; | ||
| 1007 | } | ||
| 1008 | else | ||
| 1009 | default_directory = string_to_multibyte (default_directory); | ||
| 1010 | } | ||
| 992 | else | 1011 | else |
| 993 | { | 1012 | { |
| 994 | name = string_to_multibyte (name); | 1013 | name = string_to_multibyte (name); |
| @@ -4467,6 +4486,14 @@ by calling `format-decode', which see. */) | |||
| 4467 | report_file_errno ("Opening input file", orig_filename, save_errno); | 4486 | report_file_errno ("Opening input file", orig_filename, save_errno); |
| 4468 | } | 4487 | } |
| 4469 | 4488 | ||
| 4489 | /* We made a lot of deletions and insertions above, so invalidate | ||
| 4490 | the newline cache for the entire region of the inserted | ||
| 4491 | characters. */ | ||
| 4492 | if (current_buffer->newline_cache) | ||
| 4493 | invalidate_region_cache (current_buffer, | ||
| 4494 | current_buffer->newline_cache, | ||
| 4495 | PT - BEG, Z - PT - inserted); | ||
| 4496 | |||
| 4470 | if (read_quit) | 4497 | if (read_quit) |
| 4471 | Fsignal (Qquit, Qnil); | 4498 | Fsignal (Qquit, Qnil); |
| 4472 | 4499 | ||
| @@ -4988,7 +5015,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, | |||
| 4988 | SAVE_MODIFF = MODIFF; | 5015 | SAVE_MODIFF = MODIFF; |
| 4989 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 5016 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 4990 | bset_filename (current_buffer, visit_file); | 5017 | bset_filename (current_buffer, visit_file); |
| 4991 | update_mode_lines++; | 5018 | update_mode_lines = 14; |
| 4992 | } | 5019 | } |
| 4993 | else if (quietly) | 5020 | else if (quietly) |
| 4994 | { | 5021 | { |
diff --git a/src/floatfns.c b/src/floatfns.c index f3d0936f888..9f0bab2a452 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -46,12 +46,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 46 | 46 | ||
| 47 | #include <math.h> | 47 | #include <math.h> |
| 48 | 48 | ||
| 49 | #ifndef isfinite | 49 | /* 'isfinite' and 'isnan' cause build failures on Solaris 10 with the |
| 50 | # define isfinite(x) ((x) - (x) == 0) | 50 | bundled GCC in c99 mode. Work around the bugs with simple |
| 51 | #endif | 51 | implementations that are good enough. */ |
| 52 | #ifndef isnan | 52 | #undef isfinite |
| 53 | # define isnan(x) ((x) != (x)) | 53 | #define isfinite(x) ((x) - (x) == 0) |
| 54 | #endif | 54 | #undef isnan |
| 55 | #define isnan(x) ((x) != (x)) | ||
| 55 | 56 | ||
| 56 | /* Check that X is a floating point number. */ | 57 | /* Check that X is a floating point number. */ |
| 57 | 58 | ||
| @@ -435,14 +435,10 @@ with the original. */) | |||
| 435 | 435 | ||
| 436 | if (BOOL_VECTOR_P (arg)) | 436 | if (BOOL_VECTOR_P (arg)) |
| 437 | { | 437 | { |
| 438 | Lisp_Object val; | 438 | EMACS_INT nbits = bool_vector_size (arg); |
| 439 | ptrdiff_t size_in_chars | 439 | ptrdiff_t nbytes = bool_vector_bytes (nbits); |
| 440 | = ((bool_vector_size (arg) + BOOL_VECTOR_BITS_PER_CHAR - 1) | 440 | Lisp_Object val = make_uninit_bool_vector (nbits); |
| 441 | / BOOL_VECTOR_BITS_PER_CHAR); | 441 | memcpy (bool_vector_data (val), bool_vector_data (arg), nbytes); |
| 442 | |||
| 443 | val = Fmake_bool_vector (Flength (arg), Qnil); | ||
| 444 | memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data, | ||
| 445 | size_in_chars); | ||
| 446 | return val; | 442 | return val; |
| 447 | } | 443 | } |
| 448 | 444 | ||
| @@ -674,12 +670,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 674 | } | 670 | } |
| 675 | else if (BOOL_VECTOR_P (this)) | 671 | else if (BOOL_VECTOR_P (this)) |
| 676 | { | 672 | { |
| 677 | int byte; | 673 | elt = bool_vector_ref (this, thisindex); |
| 678 | byte = XBOOL_VECTOR (this)->data[thisindex / BOOL_VECTOR_BITS_PER_CHAR]; | ||
| 679 | if (byte & (1 << (thisindex % BOOL_VECTOR_BITS_PER_CHAR))) | ||
| 680 | elt = Qt; | ||
| 681 | else | ||
| 682 | elt = Qnil; | ||
| 683 | thisindex++; | 674 | thisindex++; |
| 684 | } | 675 | } |
| 685 | else | 676 | else |
| @@ -1602,7 +1593,7 @@ changing the value of a sequence `foo'. */) | |||
| 1602 | 1593 | ||
| 1603 | for (i = n = 0; i < ASIZE (seq); ++i) | 1594 | for (i = n = 0; i < ASIZE (seq); ++i) |
| 1604 | if (NILP (Fequal (AREF (seq, i), elt))) | 1595 | if (NILP (Fequal (AREF (seq, i), elt))) |
| 1605 | p->u.contents[n++] = AREF (seq, i); | 1596 | p->contents[n++] = AREF (seq, i); |
| 1606 | 1597 | ||
| 1607 | XSETVECTOR (seq, p); | 1598 | XSETVECTOR (seq, p); |
| 1608 | } | 1599 | } |
| @@ -2071,9 +2062,8 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props) | |||
| 2071 | EMACS_INT size = bool_vector_size (o1); | 2062 | EMACS_INT size = bool_vector_size (o1); |
| 2072 | if (size != bool_vector_size (o2)) | 2063 | if (size != bool_vector_size (o2)) |
| 2073 | return 0; | 2064 | return 0; |
| 2074 | if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data, | 2065 | if (memcmp (bool_vector_data (o1), bool_vector_data (o2), |
| 2075 | ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) | 2066 | bool_vector_bytes (size))) |
| 2076 | / BOOL_VECTOR_BITS_PER_CHAR))) | ||
| 2077 | return 0; | 2067 | return 0; |
| 2078 | return 1; | 2068 | return 1; |
| 2079 | } | 2069 | } |
| @@ -2163,19 +2153,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */) | |||
| 2163 | p[idx] = charval; | 2153 | p[idx] = charval; |
| 2164 | } | 2154 | } |
| 2165 | else if (BOOL_VECTOR_P (array)) | 2155 | else if (BOOL_VECTOR_P (array)) |
| 2166 | { | 2156 | return bool_vector_fill (array, item); |
| 2167 | unsigned char *p = XBOOL_VECTOR (array)->data; | ||
| 2168 | size = ((bool_vector_size (array) + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 2169 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2170 | |||
| 2171 | if (size) | ||
| 2172 | { | ||
| 2173 | memset (p, ! NILP (item) ? -1 : 0, size); | ||
| 2174 | |||
| 2175 | /* Clear any extraneous bits in the last byte. */ | ||
| 2176 | p[size - 1] &= (1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | ||
| 2177 | } | ||
| 2178 | } | ||
| 2179 | else | 2157 | else |
| 2180 | wrong_type_argument (Qarrayp, array); | 2158 | wrong_type_argument (Qarrayp, array); |
| 2181 | return array; | 2159 | return array; |
| @@ -2287,10 +2265,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) | |||
| 2287 | { | 2265 | { |
| 2288 | for (i = 0; i < leni; i++) | 2266 | for (i = 0; i < leni; i++) |
| 2289 | { | 2267 | { |
| 2290 | unsigned char byte; | 2268 | dummy = call1 (fn, bool_vector_ref (seq, i)); |
| 2291 | byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR]; | ||
| 2292 | dummy = (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))) ? Qt : Qnil; | ||
| 2293 | dummy = call1 (fn, dummy); | ||
| 2294 | if (vals) | 2269 | if (vals) |
| 2295 | vals[i] = dummy; | 2270 | vals[i] = dummy; |
| 2296 | } | 2271 | } |
| @@ -3446,7 +3421,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3446 | { | 3421 | { |
| 3447 | struct Lisp_Vector *v; | 3422 | struct Lisp_Vector *v; |
| 3448 | ptrdiff_t i, incr, incr_max, old_size, new_size; | 3423 | ptrdiff_t i, incr, incr_max, old_size, new_size; |
| 3449 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->u.contents; | 3424 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; |
| 3450 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max | 3425 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max |
| 3451 | ? nitems_max : C_language_max); | 3426 | ? nitems_max : C_language_max); |
| 3452 | eassert (VECTORP (vec)); | 3427 | eassert (VECTORP (vec)); |
| @@ -3458,9 +3433,9 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3458 | memory_full (SIZE_MAX); | 3433 | memory_full (SIZE_MAX); |
| 3459 | new_size = old_size + incr; | 3434 | new_size = old_size + incr; |
| 3460 | v = allocate_vector (new_size); | 3435 | v = allocate_vector (new_size); |
| 3461 | memcpy (v->u.contents, XVECTOR (vec)->u.contents, old_size * sizeof *v->u.contents); | 3436 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); |
| 3462 | for (i = old_size; i < new_size; ++i) | 3437 | for (i = old_size; i < new_size; ++i) |
| 3463 | v->u.contents[i] = Qnil; | 3438 | v->contents[i] = Qnil; |
| 3464 | XSETVECTOR (vec, v); | 3439 | XSETVECTOR (vec, v); |
| 3465 | return vec; | 3440 | return vec; |
| 3466 | } | 3441 | } |
| @@ -4189,11 +4164,9 @@ sxhash_bool_vector (Lisp_Object vec) | |||
| 4189 | EMACS_UINT hash = size; | 4164 | EMACS_UINT hash = size; |
| 4190 | int i, n; | 4165 | int i, n; |
| 4191 | 4166 | ||
| 4192 | n = min (SXHASH_MAX_LEN, | 4167 | n = min (SXHASH_MAX_LEN, bool_vector_words (size)); |
| 4193 | ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 4194 | / BOOL_VECTOR_BITS_PER_CHAR)); | ||
| 4195 | for (i = 0; i < n; ++i) | 4168 | for (i = 0; i < n; ++i) |
| 4196 | hash = sxhash_combine (hash, XBOOL_VECTOR (vec)->data[i]); | 4169 | hash = sxhash_combine (hash, bool_vector_data (vec)[i]); |
| 4197 | 4170 | ||
| 4198 | return SXHASH_REDUCE (hash); | 4171 | return SXHASH_REDUCE (hash); |
| 4199 | } | 4172 | } |
diff --git a/src/font.c b/src/font.c index 68db9f2ef2d..1e1670b21af 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -2591,7 +2591,7 @@ font_clear_cache (struct frame *f, Lisp_Object cache, struct font_driver *driver | |||
| 2591 | if (! NILP (AREF (val, FONT_TYPE_INDEX))) | 2591 | if (! NILP (AREF (val, FONT_TYPE_INDEX))) |
| 2592 | { | 2592 | { |
| 2593 | eassert (font && driver == font->driver); | 2593 | eassert (font && driver == font->driver); |
| 2594 | driver->close (f, font); | 2594 | driver->close (font); |
| 2595 | } | 2595 | } |
| 2596 | } | 2596 | } |
| 2597 | if (driver->free_entity) | 2597 | if (driver->free_entity) |
| @@ -2892,7 +2892,7 @@ font_close_object (struct frame *f, Lisp_Object font_object) | |||
| 2892 | /* Already closed. */ | 2892 | /* Already closed. */ |
| 2893 | return; | 2893 | return; |
| 2894 | FONT_ADD_LOG ("close", font_object, Qnil); | 2894 | FONT_ADD_LOG ("close", font_object, Qnil); |
| 2895 | font->driver->close (f, font); | 2895 | font->driver->close (font); |
| 2896 | #ifdef HAVE_WINDOW_SYSTEM | 2896 | #ifdef HAVE_WINDOW_SYSTEM |
| 2897 | eassert (FRAME_DISPLAY_INFO (f)->n_fonts); | 2897 | eassert (FRAME_DISPLAY_INFO (f)->n_fonts); |
| 2898 | FRAME_DISPLAY_INFO (f)->n_fonts--; | 2898 | FRAME_DISPLAY_INFO (f)->n_fonts--; |
| @@ -3669,10 +3669,10 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, | |||
| 3669 | ptrdiff_t endptr; | 3669 | ptrdiff_t endptr; |
| 3670 | 3670 | ||
| 3671 | if (STRINGP (string)) | 3671 | if (STRINGP (string)) |
| 3672 | face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, | 3672 | face_id = face_at_string_position (w, string, pos, 0, &endptr, |
| 3673 | DEFAULT_FACE_ID, 0); | 3673 | DEFAULT_FACE_ID, 0); |
| 3674 | else | 3674 | else |
| 3675 | face_id = face_at_buffer_position (w, pos, -1, -1, &endptr, | 3675 | face_id = face_at_buffer_position (w, pos, &endptr, |
| 3676 | pos + 100, 0, -1); | 3676 | pos + 100, 0, -1); |
| 3677 | face = FACE_FROM_ID (f, face_id); | 3677 | face = FACE_FROM_ID (f, face_id); |
| 3678 | } | 3678 | } |
| @@ -3716,7 +3716,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, | |||
| 3716 | { | 3716 | { |
| 3717 | int face_id; | 3717 | int face_id; |
| 3718 | 3718 | ||
| 3719 | face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, | 3719 | face_id = face_at_buffer_position (w, pos, &ignore, |
| 3720 | *limit, 0, -1); | 3720 | *limit, 0, -1); |
| 3721 | face = FACE_FROM_ID (XFRAME (w->frame), face_id); | 3721 | face = FACE_FROM_ID (XFRAME (w->frame), face_id); |
| 3722 | } | 3722 | } |
diff --git a/src/font.h b/src/font.h index 0ec56590916..2db8d35af48 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -545,8 +545,8 @@ struct font_driver | |||
| 545 | Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity, | 545 | Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity, |
| 546 | int pixel_size); | 546 | int pixel_size); |
| 547 | 547 | ||
| 548 | /* Close FONT on frame F. */ | 548 | /* Close FONT. NOTE: this can be called by GC. */ |
| 549 | void (*close) (struct frame *f, struct font *font); | 549 | void (*close) (struct font *font); |
| 550 | 550 | ||
| 551 | /* Optional (if FACE->extra is not used). | 551 | /* Optional (if FACE->extra is not used). |
| 552 | Prepare FACE for displaying characters by FONT on frame F by | 552 | Prepare FACE for displaying characters by FONT on frame F by |
diff --git a/src/fontset.c b/src/fontset.c index 15fdf9f41a0..a3634f0b08d 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -453,7 +453,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) | |||
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | if (score_changed) | 455 | if (score_changed) |
| 456 | qsort (XVECTOR (vec)->u.contents, size, word_size, | 456 | qsort (XVECTOR (vec)->contents, size, word_size, |
| 457 | fontset_compare_rfontdef); | 457 | fontset_compare_rfontdef); |
| 458 | XSETCAR (font_group, make_number (charset_ordered_list_tick)); | 458 | XSETCAR (font_group, make_number (charset_ordered_list_tick)); |
| 459 | } | 459 | } |
| @@ -1875,7 +1875,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1875 | return Qnil; | 1875 | return Qnil; |
| 1876 | w = XWINDOW (window); | 1876 | w = XWINDOW (window); |
| 1877 | f = XFRAME (w->frame); | 1877 | f = XFRAME (w->frame); |
| 1878 | face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, | 1878 | face_id = face_at_buffer_position (w, pos, &dummy, |
| 1879 | pos + 100, 0, -1); | 1879 | pos + 100, 0, -1); |
| 1880 | } | 1880 | } |
| 1881 | if (! CHAR_VALID_P (c)) | 1881 | if (! CHAR_VALID_P (c)) |
diff --git a/src/frame.c b/src/frame.c index f2218b7bcb7..4494edda5d7 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -231,7 +231,7 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 231 | 231 | ||
| 232 | if (nlines != olines) | 232 | if (nlines != olines) |
| 233 | { | 233 | { |
| 234 | windows_or_buffers_changed++; | 234 | windows_or_buffers_changed = 14; |
| 235 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 235 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 236 | FRAME_MENU_BAR_LINES (f) = nlines; | 236 | FRAME_MENU_BAR_LINES (f) = nlines; |
| 237 | set_menu_bar_lines_1 (f->root_window, nlines - olines); | 237 | set_menu_bar_lines_1 (f->root_window, nlines - olines); |
| @@ -1489,7 +1489,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1489 | 1489 | ||
| 1490 | /* Cause frame titles to update--necessary if we now have just one frame. */ | 1490 | /* Cause frame titles to update--necessary if we now have just one frame. */ |
| 1491 | if (!is_tooltip_frame) | 1491 | if (!is_tooltip_frame) |
| 1492 | update_mode_lines = 1; | 1492 | update_mode_lines = 15; |
| 1493 | 1493 | ||
| 1494 | return Qnil; | 1494 | return Qnil; |
| 1495 | } | 1495 | } |
| @@ -1699,7 +1699,7 @@ If omitted, FRAME defaults to the currently selected frame. */) | |||
| 1699 | make_frame_visible_1 (f->root_window); | 1699 | make_frame_visible_1 (f->root_window); |
| 1700 | 1700 | ||
| 1701 | /* Make menu bar update for the Buffers and Frames menus. */ | 1701 | /* Make menu bar update for the Buffers and Frames menus. */ |
| 1702 | windows_or_buffers_changed++; | 1702 | windows_or_buffers_changed = 15; |
| 1703 | 1703 | ||
| 1704 | XSETFRAME (frame, f); | 1704 | XSETFRAME (frame, f); |
| 1705 | return frame; | 1705 | return frame; |
| @@ -1753,7 +1753,7 @@ displayed in the terminal. */) | |||
| 1753 | #endif | 1753 | #endif |
| 1754 | 1754 | ||
| 1755 | /* Make menu bar update for the Buffers and Frames menus. */ | 1755 | /* Make menu bar update for the Buffers and Frames menus. */ |
| 1756 | windows_or_buffers_changed++; | 1756 | windows_or_buffers_changed = 16; |
| 1757 | 1757 | ||
| 1758 | return Qnil; | 1758 | return Qnil; |
| 1759 | } | 1759 | } |
| @@ -1776,7 +1776,7 @@ If omitted, FRAME defaults to the currently selected frame. */) | |||
| 1776 | #endif | 1776 | #endif |
| 1777 | 1777 | ||
| 1778 | /* Make menu bar update for the Buffers and Frames menus. */ | 1778 | /* Make menu bar update for the Buffers and Frames menus. */ |
| 1779 | windows_or_buffers_changed++; | 1779 | windows_or_buffers_changed = 17; |
| 1780 | 1780 | ||
| 1781 | return Qnil; | 1781 | return Qnil; |
| 1782 | } | 1782 | } |
| @@ -2025,7 +2025,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name) | |||
| 2025 | } | 2025 | } |
| 2026 | 2026 | ||
| 2027 | fset_name (f, name); | 2027 | fset_name (f, name); |
| 2028 | update_mode_lines = 1; | 2028 | update_mode_lines = 16; |
| 2029 | } | 2029 | } |
| 2030 | 2030 | ||
| 2031 | void | 2031 | void |
| @@ -3245,7 +3245,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu | |||
| 3245 | XSETFRAME (frame, f); | 3245 | XSETFRAME (frame, f); |
| 3246 | x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); | 3246 | x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); |
| 3247 | ++face_change_count; | 3247 | ++face_change_count; |
| 3248 | ++windows_or_buffers_changed; | 3248 | windows_or_buffers_changed = 18; |
| 3249 | } | 3249 | } |
| 3250 | } | 3250 | } |
| 3251 | 3251 | ||
| @@ -3844,7 +3844,7 @@ XParseGeometry (char *string, | |||
| 3844 | { | 3844 | { |
| 3845 | int mask = NoValue; | 3845 | int mask = NoValue; |
| 3846 | char *strind; | 3846 | char *strind; |
| 3847 | unsigned long int tempWidth, tempHeight; | 3847 | unsigned long tempWidth, tempHeight; |
| 3848 | long int tempX, tempY; | 3848 | long int tempX, tempY; |
| 3849 | char *nextCharacter; | 3849 | char *nextCharacter; |
| 3850 | 3850 | ||
diff --git a/src/fringe.c b/src/fringe.c index 3537027f1dd..9c77e6557f4 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -1690,6 +1690,8 @@ If BITMAP already exists, the existing definition is replaced. */) | |||
| 1690 | DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, | 1690 | DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, |
| 1691 | 1, 2, 0, | 1691 | 1, 2, 0, |
| 1692 | doc: /* Set face for fringe bitmap BITMAP to FACE. | 1692 | doc: /* Set face for fringe bitmap BITMAP to FACE. |
| 1693 | FACE is merged with the `fringe' face, so normally FACE should specify | ||
| 1694 | only the foreground color. | ||
| 1693 | If FACE is nil, reset face to default fringe face. */) | 1695 | If FACE is nil, reset face to default fringe face. */) |
| 1694 | (Lisp_Object bitmap, Lisp_Object face) | 1696 | (Lisp_Object bitmap, Lisp_Object face) |
| 1695 | { | 1697 | { |
diff --git a/src/ftfont.c b/src/ftfont.c index eeee56891ec..224b8e82500 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -498,7 +498,7 @@ static Lisp_Object ftfont_list (struct frame *, Lisp_Object); | |||
| 498 | static Lisp_Object ftfont_match (struct frame *, Lisp_Object); | 498 | static Lisp_Object ftfont_match (struct frame *, Lisp_Object); |
| 499 | static Lisp_Object ftfont_list_family (struct frame *); | 499 | static Lisp_Object ftfont_list_family (struct frame *); |
| 500 | static Lisp_Object ftfont_open (struct frame *, Lisp_Object, int); | 500 | static Lisp_Object ftfont_open (struct frame *, Lisp_Object, int); |
| 501 | static void ftfont_close (struct frame *, struct font *); | 501 | static void ftfont_close (struct font *); |
| 502 | static int ftfont_has_char (Lisp_Object, int); | 502 | static int ftfont_has_char (Lisp_Object, int); |
| 503 | static unsigned ftfont_encode_char (struct font *, int); | 503 | static unsigned ftfont_encode_char (struct font *, int); |
| 504 | static int ftfont_text_extents (struct font *, unsigned *, int, | 504 | static int ftfont_text_extents (struct font *, unsigned *, int, |
| @@ -1317,7 +1317,7 @@ ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| 1319 | static void | 1319 | static void |
| 1320 | ftfont_close (struct frame *f, struct font *font) | 1320 | ftfont_close (struct font *font) |
| 1321 | { | 1321 | { |
| 1322 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | 1322 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
| 1323 | Lisp_Object val, cache; | 1323 | Lisp_Object val, cache; |
diff --git a/src/ftxfont.c b/src/ftxfont.c index 63d03b0e244..d1aa3e40403 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c | |||
| @@ -57,7 +57,7 @@ struct ftxfont_frame_data | |||
| 57 | /* Return an array of 6 GCs for antialiasing. */ | 57 | /* Return an array of 6 GCs for antialiasing. */ |
| 58 | 58 | ||
| 59 | static GC * | 59 | static GC * |
| 60 | ftxfont_get_gcs (struct frame *f, long unsigned int foreground, long unsigned int background) | 60 | ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long background) |
| 61 | { | 61 | { |
| 62 | XColor color; | 62 | XColor color; |
| 63 | XGCValues xgcv; | 63 | XGCValues xgcv; |
| @@ -260,9 +260,9 @@ ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static void | 262 | static void |
| 263 | ftxfont_close (struct frame *f, struct font *font) | 263 | ftxfont_close (struct font *font) |
| 264 | { | 264 | { |
| 265 | ftfont_driver.close (f, font); | 265 | ftfont_driver.close (font); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static int | 268 | static int |
diff --git a/src/gmalloc.c b/src/gmalloc.c index bc1d85ac5fb..c50df25cd41 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -58,6 +58,7 @@ extern void free (void *ptr); | |||
| 58 | 58 | ||
| 59 | /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ | 59 | /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ |
| 60 | #ifdef MSDOS | 60 | #ifdef MSDOS |
| 61 | extern void *aligned_alloc (size_t, size_t); | ||
| 61 | extern void *memalign (size_t, size_t); | 62 | extern void *memalign (size_t, size_t); |
| 62 | extern int posix_memalign (void **, size_t, size_t); | 63 | extern int posix_memalign (void **, size_t, size_t); |
| 63 | #endif | 64 | #endif |
| @@ -143,11 +144,11 @@ struct list | |||
| 143 | /* Free list headers for each fragment size. */ | 144 | /* Free list headers for each fragment size. */ |
| 144 | extern struct list _fraghead[]; | 145 | extern struct list _fraghead[]; |
| 145 | 146 | ||
| 146 | /* List of blocks allocated with `memalign' (or `valloc'). */ | 147 | /* List of blocks allocated with aligned_alloc and friends. */ |
| 147 | struct alignlist | 148 | struct alignlist |
| 148 | { | 149 | { |
| 149 | struct alignlist *next; | 150 | struct alignlist *next; |
| 150 | void *aligned; /* The address that memaligned returned. */ | 151 | void *aligned; /* The address that aligned_alloc returned. */ |
| 151 | void *exact; /* The address that malloc returned. */ | 152 | void *exact; /* The address that malloc returned. */ |
| 152 | }; | 153 | }; |
| 153 | extern struct alignlist *_aligned_blocks; | 154 | extern struct alignlist *_aligned_blocks; |
| @@ -977,7 +978,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. | |||
| 977 | /* Debugging hook for free. */ | 978 | /* Debugging hook for free. */ |
| 978 | void (*__free_hook) (void *__ptr); | 979 | void (*__free_hook) (void *__ptr); |
| 979 | 980 | ||
| 980 | /* List of blocks allocated by memalign. */ | 981 | /* List of blocks allocated by aligned_alloc. */ |
| 981 | struct alignlist *_aligned_blocks = NULL; | 982 | struct alignlist *_aligned_blocks = NULL; |
| 982 | 983 | ||
| 983 | /* Return memory to the heap. | 984 | /* Return memory to the heap. |
| @@ -1306,8 +1307,8 @@ special_realloc (void *ptr, size_t size) | |||
| 1306 | type == 0 ? bss_sbrk_heapinfo[block].busy.info.size * BLOCKSIZE | 1307 | type == 0 ? bss_sbrk_heapinfo[block].busy.info.size * BLOCKSIZE |
| 1307 | : (size_t) 1 << type; | 1308 | : (size_t) 1 << type; |
| 1308 | result = _malloc_internal_nolock (size); | 1309 | result = _malloc_internal_nolock (size); |
| 1309 | if (result != NULL) | 1310 | if (result) |
| 1310 | memcpy (result, ptr, min (oldsize, size)); | 1311 | return memcpy (result, ptr, min (oldsize, size)); |
| 1311 | return result; | 1312 | return result; |
| 1312 | } | 1313 | } |
| 1313 | #endif | 1314 | #endif |
| @@ -1487,13 +1488,20 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. | |||
| 1487 | /* Allocate an array of NMEMB elements each SIZE bytes long. | 1488 | /* Allocate an array of NMEMB elements each SIZE bytes long. |
| 1488 | The entire array is initialized to zeros. */ | 1489 | The entire array is initialized to zeros. */ |
| 1489 | void * | 1490 | void * |
| 1490 | calloc (register size_t nmemb, register size_t size) | 1491 | calloc (size_t nmemb, size_t size) |
| 1491 | { | 1492 | { |
| 1492 | register void *result = malloc (nmemb * size); | 1493 | void *result; |
| 1494 | size_t bytes = nmemb * size; | ||
| 1493 | 1495 | ||
| 1494 | if (result != NULL) | 1496 | if (size != 0 && bytes / size != nmemb) |
| 1495 | (void) memset (result, 0, nmemb * size); | 1497 | { |
| 1498 | errno = ENOMEM; | ||
| 1499 | return NULL; | ||
| 1500 | } | ||
| 1496 | 1501 | ||
| 1502 | result = malloc (bytes); | ||
| 1503 | if (result) | ||
| 1504 | return memset (result, 0, bytes); | ||
| 1497 | return result; | 1505 | return result; |
| 1498 | } | 1506 | } |
| 1499 | /* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | 1507 | /* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
| @@ -1559,7 +1567,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. * | |||
| 1559 | void *(*__memalign_hook) (size_t size, size_t alignment); | 1567 | void *(*__memalign_hook) (size_t size, size_t alignment); |
| 1560 | 1568 | ||
| 1561 | void * | 1569 | void * |
| 1562 | memalign (size_t alignment, size_t size) | 1570 | aligned_alloc (size_t alignment, size_t size) |
| 1563 | { | 1571 | { |
| 1564 | void *result; | 1572 | void *result; |
| 1565 | size_t adj, lastadj; | 1573 | size_t adj, lastadj; |
| @@ -1570,6 +1578,11 @@ memalign (size_t alignment, size_t size) | |||
| 1570 | 1578 | ||
| 1571 | /* Allocate a block with enough extra space to pad the block with up to | 1579 | /* Allocate a block with enough extra space to pad the block with up to |
| 1572 | (ALIGNMENT - 1) bytes if necessary. */ | 1580 | (ALIGNMENT - 1) bytes if necessary. */ |
| 1581 | if (- size < alignment) | ||
| 1582 | { | ||
| 1583 | errno = ENOMEM; | ||
| 1584 | return NULL; | ||
| 1585 | } | ||
| 1573 | result = malloc (size + alignment - 1); | 1586 | result = malloc (size + alignment - 1); |
| 1574 | if (result == NULL) | 1587 | if (result == NULL) |
| 1575 | return NULL; | 1588 | return NULL; |
| @@ -1631,6 +1644,15 @@ memalign (size_t alignment, size_t size) | |||
| 1631 | return result; | 1644 | return result; |
| 1632 | } | 1645 | } |
| 1633 | 1646 | ||
| 1647 | /* An obsolete alias for aligned_alloc, for any old libraries that use | ||
| 1648 | this alias. */ | ||
| 1649 | |||
| 1650 | void * | ||
| 1651 | memalign (size_t alignment, size_t size) | ||
| 1652 | { | ||
| 1653 | return aligned_alloc (alignment, size); | ||
| 1654 | } | ||
| 1655 | |||
| 1634 | int | 1656 | int |
| 1635 | posix_memalign (void **memptr, size_t alignment, size_t size) | 1657 | posix_memalign (void **memptr, size_t alignment, size_t size) |
| 1636 | { | 1658 | { |
| @@ -1641,7 +1663,7 @@ posix_memalign (void **memptr, size_t alignment, size_t size) | |||
| 1641 | || (alignment & (alignment - 1)) != 0) | 1663 | || (alignment & (alignment - 1)) != 0) |
| 1642 | return EINVAL; | 1664 | return EINVAL; |
| 1643 | 1665 | ||
| 1644 | mem = memalign (alignment, size); | 1666 | mem = aligned_alloc (alignment, size); |
| 1645 | if (mem == NULL) | 1667 | if (mem == NULL) |
| 1646 | return ENOMEM; | 1668 | return ENOMEM; |
| 1647 | 1669 | ||
| @@ -1686,7 +1708,7 @@ valloc (size_t size) | |||
| 1686 | if (pagesize == 0) | 1708 | if (pagesize == 0) |
| 1687 | pagesize = getpagesize (); | 1709 | pagesize = getpagesize (); |
| 1688 | 1710 | ||
| 1689 | return memalign (pagesize, size); | 1711 | return aligned_alloc (pagesize, size); |
| 1690 | } | 1712 | } |
| 1691 | 1713 | ||
| 1692 | #ifdef GC_MCHECK | 1714 | #ifdef GC_MCHECK |
| @@ -1792,8 +1814,7 @@ mallochook (size_t size) | |||
| 1792 | hdr->size = size; | 1814 | hdr->size = size; |
| 1793 | hdr->magic = MAGICWORD; | 1815 | hdr->magic = MAGICWORD; |
| 1794 | ((char *) &hdr[1])[size] = MAGICBYTE; | 1816 | ((char *) &hdr[1])[size] = MAGICBYTE; |
| 1795 | memset (hdr + 1, MALLOCFLOOD, size); | 1817 | return memset (hdr + 1, MALLOCFLOOD, size); |
| 1796 | return hdr + 1; | ||
| 1797 | } | 1818 | } |
| 1798 | 1819 | ||
| 1799 | static void * | 1820 | static void * |
diff --git a/src/gnutls.c b/src/gnutls.c index f9e86d1a697..82b2fc8baa4 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -488,8 +488,20 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) | |||
| 488 | else | 488 | else |
| 489 | { | 489 | { |
| 490 | ret = 1; | 490 | ret = 1; |
| 491 | GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str); | 491 | |
| 492 | /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */ | 492 | switch (err) |
| 493 | { | ||
| 494 | case GNUTLS_E_AGAIN: | ||
| 495 | GNUTLS_LOG2 (3, | ||
| 496 | max_log_level, | ||
| 497 | "retry:", | ||
| 498 | str); | ||
| 499 | default: | ||
| 500 | GNUTLS_LOG2 (1, | ||
| 501 | max_log_level, | ||
| 502 | "non-fatal error:", | ||
| 503 | str); | ||
| 504 | } | ||
| 493 | } | 505 | } |
| 494 | 506 | ||
| 495 | if (err == GNUTLS_E_WARNING_ALERT_RECEIVED | 507 | if (err == GNUTLS_E_WARNING_ALERT_RECEIVED |
| @@ -791,16 +803,10 @@ one trustfile (usually a CA bundle). */) | |||
| 791 | CHECK_LIST (proplist); | 803 | CHECK_LIST (proplist); |
| 792 | 804 | ||
| 793 | if (NILP (Fgnutls_available_p ())) | 805 | if (NILP (Fgnutls_available_p ())) |
| 794 | { | 806 | error ("GnuTLS not available"); |
| 795 | error ("GnuTLS not available"); | ||
| 796 | return gnutls_make_error (GNUTLS_EMACS_ERROR_NOT_LOADED); | ||
| 797 | } | ||
| 798 | 807 | ||
| 799 | if (!EQ (type, Qgnutls_x509pki) && !EQ (type, Qgnutls_anon)) | 808 | if (!EQ (type, Qgnutls_x509pki) && !EQ (type, Qgnutls_anon)) |
| 800 | { | 809 | error ("Invalid GnuTLS credential type"); |
| 801 | error ("Invalid GnuTLS credential type"); | ||
| 802 | return gnutls_make_error (GNUTLS_EMACS_ERROR_INVALID_TYPE); | ||
| 803 | } | ||
| 804 | 810 | ||
| 805 | hostname = Fplist_get (proplist, QCgnutls_bootprop_hostname); | 811 | hostname = Fplist_get (proplist, QCgnutls_bootprop_hostname); |
| 806 | priority_string = Fplist_get (proplist, QCgnutls_bootprop_priority); | 812 | priority_string = Fplist_get (proplist, QCgnutls_bootprop_priority); |
| @@ -816,7 +822,6 @@ one trustfile (usually a CA bundle). */) | |||
| 816 | c_hostname = SSDATA (hostname); | 822 | c_hostname = SSDATA (hostname); |
| 817 | 823 | ||
| 818 | state = XPROCESS (proc)->gnutls_state; | 824 | state = XPROCESS (proc)->gnutls_state; |
| 819 | XPROCESS (proc)->gnutls_p = 1; | ||
| 820 | 825 | ||
| 821 | if (TYPE_RANGED_INTEGERP (int, loglevel)) | 826 | if (TYPE_RANGED_INTEGERP (int, loglevel)) |
| 822 | { | 827 | { |
| @@ -839,7 +844,6 @@ one trustfile (usually a CA bundle). */) | |||
| 839 | emacs_gnutls_deinit (proc); | 844 | emacs_gnutls_deinit (proc); |
| 840 | 845 | ||
| 841 | /* Mark PROC as a GnuTLS process. */ | 846 | /* Mark PROC as a GnuTLS process. */ |
| 842 | XPROCESS (proc)->gnutls_p = 1; | ||
| 843 | XPROCESS (proc)->gnutls_state = NULL; | 847 | XPROCESS (proc)->gnutls_state = NULL; |
| 844 | XPROCESS (proc)->gnutls_x509_cred = NULL; | 848 | XPROCESS (proc)->gnutls_x509_cred = NULL; |
| 845 | XPROCESS (proc)->gnutls_anon_cred = NULL; | 849 | XPROCESS (proc)->gnutls_anon_cred = NULL; |
| @@ -1099,6 +1103,9 @@ one trustfile (usually a CA bundle). */) | |||
| 1099 | fn_gnutls_x509_crt_deinit (gnutls_verify_cert); | 1103 | fn_gnutls_x509_crt_deinit (gnutls_verify_cert); |
| 1100 | } | 1104 | } |
| 1101 | 1105 | ||
| 1106 | /* Set this flag only if the whole initialization succeeded. */ | ||
| 1107 | XPROCESS (proc)->gnutls_p = 1; | ||
| 1108 | |||
| 1102 | return gnutls_make_error (ret); | 1109 | return gnutls_make_error (ret); |
| 1103 | } | 1110 | } |
| 1104 | 1111 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index e20d01521f0..192b64a7e62 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -598,14 +598,17 @@ xg_check_special_colors (struct frame *f, | |||
| 598 | GtkStyleContext *gsty | 598 | GtkStyleContext *gsty |
| 599 | = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); | 599 | = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); |
| 600 | GdkRGBA col; | 600 | GdkRGBA col; |
| 601 | char buf[sizeof "rgbi://" + 3 * (DBL_MAX_10_EXP + sizeof "-1.000000" - 1)]; | 601 | char buf[sizeof "rgb://rrrr/gggg/bbbb"]; |
| 602 | int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED; | 602 | int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED; |
| 603 | if (get_fg) | 603 | if (get_fg) |
| 604 | gtk_style_context_get_color (gsty, state, &col); | 604 | gtk_style_context_get_color (gsty, state, &col); |
| 605 | else | 605 | else |
| 606 | gtk_style_context_get_background_color (gsty, state, &col); | 606 | gtk_style_context_get_background_color (gsty, state, &col); |
| 607 | 607 | ||
| 608 | sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); | 608 | sprintf (buf, "rgb:%04x/%04x/%04x", |
| 609 | (int)(col.red * 65535), | ||
| 610 | (int)(col.green * 65535), | ||
| 611 | (int)(col.blue * 65535)); | ||
| 609 | success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), | 612 | success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), |
| 610 | buf, color) | 613 | buf, color) |
| 611 | != 0); | 614 | != 0); |
| @@ -1038,7 +1041,7 @@ xg_win_to_widget (Display *dpy, Window wdesc) | |||
| 1038 | /* Set the background of widget W to PIXEL. */ | 1041 | /* Set the background of widget W to PIXEL. */ |
| 1039 | 1042 | ||
| 1040 | static void | 1043 | static void |
| 1041 | xg_set_widget_bg (struct frame *f, GtkWidget *w, long unsigned int pixel) | 1044 | xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel) |
| 1042 | { | 1045 | { |
| 1043 | #ifdef HAVE_GTK3 | 1046 | #ifdef HAVE_GTK3 |
| 1044 | GdkRGBA bg; | 1047 | GdkRGBA bg; |
| @@ -1439,7 +1442,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) | |||
| 1439 | BG is the pixel value to change to. */ | 1442 | BG is the pixel value to change to. */ |
| 1440 | 1443 | ||
| 1441 | void | 1444 | void |
| 1442 | xg_set_background_color (struct frame *f, long unsigned int bg) | 1445 | xg_set_background_color (struct frame *f, unsigned long bg) |
| 1443 | { | 1446 | { |
| 1444 | if (FRAME_GTK_WIDGET (f)) | 1447 | if (FRAME_GTK_WIDGET (f)) |
| 1445 | { | 1448 | { |
diff --git a/src/image.c b/src/image.c index 2b07b83b816..37a19e4f5a5 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -87,11 +87,12 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 87 | #define x_defined_color w32_defined_color | 87 | #define x_defined_color w32_defined_color |
| 88 | #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) | 88 | #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) |
| 89 | 89 | ||
| 90 | /* Versions of libpng and libgif that we were compiled with, or -1 if | 90 | /* Versions of libpng, libgif, and libjpeg that we were compiled with, |
| 91 | no PNG/GIF support was compiled in. This is tested by w32-win.el | 91 | or -1 if no PNG/GIF support was compiled in. This is tested by |
| 92 | to correctly set up the alist used to search for the respective | 92 | w32-win.el to correctly set up the alist used to search for the |
| 93 | image libraries. */ | 93 | respective image libraries. */ |
| 94 | Lisp_Object Qlibpng_version, Qlibgif_version; | 94 | Lisp_Object Qlibpng_version, Qlibgif_version, Qlibjpeg_version; |
| 95 | |||
| 95 | #endif /* HAVE_NTGUI */ | 96 | #endif /* HAVE_NTGUI */ |
| 96 | 97 | ||
| 97 | #ifdef HAVE_NS | 98 | #ifdef HAVE_NS |
| @@ -159,13 +160,13 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) | |||
| 159 | 160 | ||
| 160 | /* Functions to access the contents of a bitmap, given an id. */ | 161 | /* Functions to access the contents of a bitmap, given an id. */ |
| 161 | 162 | ||
| 162 | int | 163 | static int |
| 163 | x_bitmap_height (struct frame *f, ptrdiff_t id) | 164 | x_bitmap_height (struct frame *f, ptrdiff_t id) |
| 164 | { | 165 | { |
| 165 | return FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].height; | 166 | return FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
| 166 | } | 167 | } |
| 167 | 168 | ||
| 168 | int | 169 | static int |
| 169 | x_bitmap_width (struct frame *f, ptrdiff_t id) | 170 | x_bitmap_width (struct frame *f, ptrdiff_t id) |
| 170 | { | 171 | { |
| 171 | return FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].width; | 172 | return FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
| @@ -1520,7 +1521,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1520 | clear_current_matrices (fr); | 1521 | clear_current_matrices (fr); |
| 1521 | } | 1522 | } |
| 1522 | 1523 | ||
| 1523 | ++windows_or_buffers_changed; | 1524 | windows_or_buffers_changed = 19; |
| 1524 | } | 1525 | } |
| 1525 | 1526 | ||
| 1526 | unblock_input (); | 1527 | unblock_input (); |
| @@ -3025,13 +3026,13 @@ xbm_load (struct frame *f, struct image *img) | |||
| 3025 | if (STRINGP (line)) | 3026 | if (STRINGP (line)) |
| 3026 | memcpy (p, SDATA (line), nbytes); | 3027 | memcpy (p, SDATA (line), nbytes); |
| 3027 | else | 3028 | else |
| 3028 | memcpy (p, XBOOL_VECTOR (line)->data, nbytes); | 3029 | memcpy (p, bool_vector_data (line), nbytes); |
| 3029 | } | 3030 | } |
| 3030 | } | 3031 | } |
| 3031 | else if (STRINGP (data)) | 3032 | else if (STRINGP (data)) |
| 3032 | bits = SSDATA (data); | 3033 | bits = SSDATA (data); |
| 3033 | else | 3034 | else |
| 3034 | bits = (char *) XBOOL_VECTOR (data)->data; | 3035 | bits = (char *) bool_vector_data (data); |
| 3035 | 3036 | ||
| 3036 | #ifdef HAVE_NTGUI | 3037 | #ifdef HAVE_NTGUI |
| 3037 | { | 3038 | { |
| @@ -5105,6 +5106,27 @@ pbm_image_p (Lisp_Object object) | |||
| 5105 | } | 5106 | } |
| 5106 | 5107 | ||
| 5107 | 5108 | ||
| 5109 | /* Get next char skipping comments in Netpbm header. Returns -1 at | ||
| 5110 | end of input. */ | ||
| 5111 | |||
| 5112 | static int | ||
| 5113 | pbm_next_char (unsigned char **s, unsigned char *end) | ||
| 5114 | { | ||
| 5115 | int c = -1; | ||
| 5116 | |||
| 5117 | while (*s < end && (c = *(*s)++, c == '#')) | ||
| 5118 | { | ||
| 5119 | /* Skip to the next line break. */ | ||
| 5120 | while (*s < end && (c = *(*s)++, c != '\n' && c != '\r')) | ||
| 5121 | ; | ||
| 5122 | |||
| 5123 | c = -1; | ||
| 5124 | } | ||
| 5125 | |||
| 5126 | return c; | ||
| 5127 | } | ||
| 5128 | |||
| 5129 | |||
| 5108 | /* Scan a decimal number from *S and return it. Advance *S while | 5130 | /* Scan a decimal number from *S and return it. Advance *S while |
| 5109 | reading the number. END is the end of the string. Value is -1 at | 5131 | reading the number. END is the end of the string. Value is -1 at |
| 5110 | end of input. */ | 5132 | end of input. */ |
| @@ -5114,28 +5136,16 @@ pbm_scan_number (unsigned char **s, unsigned char *end) | |||
| 5114 | { | 5136 | { |
| 5115 | int c = 0, val = -1; | 5137 | int c = 0, val = -1; |
| 5116 | 5138 | ||
| 5117 | while (*s < end) | 5139 | /* Skip white-space. */ |
| 5118 | { | 5140 | while ((c = pbm_next_char (s, end)) != -1 && c_isspace (c)) |
| 5119 | /* Skip white-space. */ | 5141 | ; |
| 5120 | while (*s < end && (c = *(*s)++, c_isspace (c))) | ||
| 5121 | ; | ||
| 5122 | 5142 | ||
| 5123 | if (c == '#') | 5143 | if (c_isdigit (c)) |
| 5124 | { | 5144 | { |
| 5125 | /* Skip comment to end of line. */ | 5145 | /* Read decimal number. */ |
| 5126 | while (*s < end && (c = *(*s)++, c != '\n')) | 5146 | val = c - '0'; |
| 5127 | ; | 5147 | while ((c = pbm_next_char (s, end)) != -1 && c_isdigit (c)) |
| 5128 | } | 5148 | val = 10 * val + c - '0'; |
| 5129 | else if (c_isdigit (c)) | ||
| 5130 | { | ||
| 5131 | /* Read decimal number. */ | ||
| 5132 | val = c - '0'; | ||
| 5133 | while (*s < end && (c = *(*s)++, c_isdigit (c))) | ||
| 5134 | val = 10 * val + c - '0'; | ||
| 5135 | break; | ||
| 5136 | } | ||
| 5137 | else | ||
| 5138 | break; | ||
| 5139 | } | 5149 | } |
| 5140 | 5150 | ||
| 5141 | return val; | 5151 | return val; |
| @@ -9411,6 +9421,14 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 9411 | #else | 9421 | #else |
| 9412 | make_number (-1) | 9422 | make_number (-1) |
| 9413 | #endif | 9423 | #endif |
| 9424 | ); | ||
| 9425 | DEFSYM (Qlibjpeg_version, "libjpeg-version"); | ||
| 9426 | Fset (Qlibjpeg_version, | ||
| 9427 | #if HAVE_JPEG | ||
| 9428 | make_number (JPEG_LIB_VERSION) | ||
| 9429 | #else | ||
| 9430 | make_number (-1) | ||
| 9431 | #endif | ||
| 9414 | ); | 9432 | ); |
| 9415 | #endif | 9433 | #endif |
| 9416 | 9434 | ||
diff --git a/src/indent.c b/src/indent.c index d956e627ba9..891b42788ed 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -118,7 +118,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *w | |||
| 118 | 118 | ||
| 119 | for (i = 0; i < 256; i++) | 119 | for (i = 0; i < 256; i++) |
| 120 | if (character_width (i, disptab) | 120 | if (character_width (i, disptab) |
| 121 | != XFASTINT (widthtab->u.contents[i])) | 121 | != XFASTINT (widthtab->contents[i])) |
| 122 | return 0; | 122 | return 0; |
| 123 | 123 | ||
| 124 | return 1; | 124 | return 1; |
| @@ -138,7 +138,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab) | |||
| 138 | eassert (widthtab->header.size == 256); | 138 | eassert (widthtab->header.size == 256); |
| 139 | 139 | ||
| 140 | for (i = 0; i < 256; i++) | 140 | for (i = 0; i < 256; i++) |
| 141 | XSETFASTINT (widthtab->u.contents[i], character_width (i, disptab)); | 141 | XSETFASTINT (widthtab->contents[i], character_width (i, disptab)); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /* Allocate or free the width run cache, as requested by the | 144 | /* Allocate or free the width run cache, as requested by the |
| @@ -1136,7 +1136,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, | |||
| 1136 | width_run_cache_on_off (); | 1136 | width_run_cache_on_off (); |
| 1137 | if (dp == buffer_display_table ()) | 1137 | if (dp == buffer_display_table ()) |
| 1138 | width_table = (VECTORP (BVAR (current_buffer, width_table)) | 1138 | width_table = (VECTORP (BVAR (current_buffer, width_table)) |
| 1139 | ? XVECTOR (BVAR (current_buffer, width_table))->u.contents | 1139 | ? XVECTOR (BVAR (current_buffer, width_table))->contents |
| 1140 | : 0); | 1140 | : 0); |
| 1141 | else | 1141 | else |
| 1142 | /* If the window has its own display table, we can't use the width | 1142 | /* If the window has its own display table, we can't use the width |
diff --git a/src/insdel.c b/src/insdel.c index 0eb80c04d99..8de4f095396 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -827,7 +827,7 @@ insert_1_both (const char *string, | |||
| 827 | 827 | ||
| 828 | eassert (GPT <= GPT_BYTE); | 828 | eassert (GPT <= GPT_BYTE); |
| 829 | 829 | ||
| 830 | /* The insert may have been in the unchanged region, so check again. */ | 830 | /* The insert may have been in the unchanged region, so check again. */ |
| 831 | if (Z - GPT < END_UNCHANGED) | 831 | if (Z - GPT < END_UNCHANGED) |
| 832 | END_UNCHANGED = Z - GPT; | 832 | END_UNCHANGED = Z - GPT; |
| 833 | 833 | ||
| @@ -956,7 +956,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 956 | 956 | ||
| 957 | eassert (GPT <= GPT_BYTE); | 957 | eassert (GPT <= GPT_BYTE); |
| 958 | 958 | ||
| 959 | /* The insert may have been in the unchanged region, so check again. */ | 959 | /* The insert may have been in the unchanged region, so check again. */ |
| 960 | if (Z - GPT < END_UNCHANGED) | 960 | if (Z - GPT < END_UNCHANGED) |
| 961 | END_UNCHANGED = Z - GPT; | 961 | END_UNCHANGED = Z - GPT; |
| 962 | 962 | ||
| @@ -993,6 +993,11 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) | |||
| 993 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | 993 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 994 | nchars = nbytes; | 994 | nchars = nbytes; |
| 995 | 995 | ||
| 996 | /* No need to call prepare_to_modify_buffer, since this is called | ||
| 997 | from places that replace some region with a different text, so | ||
| 998 | prepare_to_modify_buffer was already called by the deletion part | ||
| 999 | of this dance. */ | ||
| 1000 | invalidate_buffer_caches (current_buffer, GPT, GPT); | ||
| 996 | record_insert (GPT, nchars); | 1001 | record_insert (GPT, nchars); |
| 997 | MODIFF++; | 1002 | MODIFF++; |
| 998 | 1003 | ||
| @@ -1148,7 +1153,7 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1148 | 1153 | ||
| 1149 | eassert (GPT <= GPT_BYTE); | 1154 | eassert (GPT <= GPT_BYTE); |
| 1150 | 1155 | ||
| 1151 | /* The insert may have been in the unchanged region, so check again. */ | 1156 | /* The insert may have been in the unchanged region, so check again. */ |
| 1152 | if (Z - GPT < END_UNCHANGED) | 1157 | if (Z - GPT < END_UNCHANGED) |
| 1153 | END_UNCHANGED = Z - GPT; | 1158 | END_UNCHANGED = Z - GPT; |
| 1154 | 1159 | ||
| @@ -1778,6 +1783,8 @@ modify_text (ptrdiff_t start, ptrdiff_t end) | |||
| 1778 | bset_point_before_scroll (current_buffer, Qnil); | 1783 | bset_point_before_scroll (current_buffer, Qnil); |
| 1779 | } | 1784 | } |
| 1780 | 1785 | ||
| 1786 | Lisp_Object Qregion_extract_function; | ||
| 1787 | |||
| 1781 | /* Check that it is okay to modify the buffer between START and END, | 1788 | /* Check that it is okay to modify the buffer between START and END, |
| 1782 | which are char positions. | 1789 | which are char positions. |
| 1783 | 1790 | ||
| @@ -1801,7 +1808,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, | |||
| 1801 | let redisplay consider other windows if this buffer is visible. */ | 1808 | let redisplay consider other windows if this buffer is visible. */ |
| 1802 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer | 1809 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer |
| 1803 | && buffer_window_count (current_buffer)) | 1810 | && buffer_window_count (current_buffer)) |
| 1804 | ++windows_or_buffers_changed; | 1811 | windows_or_buffers_changed = 20; |
| 1805 | 1812 | ||
| 1806 | if (buffer_intervals (current_buffer)) | 1813 | if (buffer_intervals (current_buffer)) |
| 1807 | { | 1814 | { |
| @@ -1843,6 +1850,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, | |||
| 1843 | #endif /* not CLASH_DETECTION */ | 1850 | #endif /* not CLASH_DETECTION */ |
| 1844 | 1851 | ||
| 1845 | /* If `select-active-regions' is non-nil, save the region text. */ | 1852 | /* If `select-active-regions' is non-nil, save the region text. */ |
| 1853 | /* FIXME: Move this to Elisp (via before-change-functions). */ | ||
| 1846 | if (!NILP (BVAR (current_buffer, mark_active)) | 1854 | if (!NILP (BVAR (current_buffer, mark_active)) |
| 1847 | && !inhibit_modification_hooks | 1855 | && !inhibit_modification_hooks |
| 1848 | && XMARKER (BVAR (current_buffer, mark))->buffer | 1856 | && XMARKER (BVAR (current_buffer, mark))->buffer |
| @@ -1851,14 +1859,8 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, | |||
| 1851 | ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) | 1859 | ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) |
| 1852 | : (!NILP (Vselect_active_regions) | 1860 | : (!NILP (Vselect_active_regions) |
| 1853 | && !NILP (Vtransient_mark_mode)))) | 1861 | && !NILP (Vtransient_mark_mode)))) |
| 1854 | { | 1862 | Vsaved_region_selection |
| 1855 | ptrdiff_t b = marker_position (BVAR (current_buffer, mark)); | 1863 | = call1 (Fsymbol_value (Qregion_extract_function), Qnil); |
| 1856 | ptrdiff_t e = PT; | ||
| 1857 | if (b < e) | ||
| 1858 | Vsaved_region_selection = make_buffer_string (b, e, 0); | ||
| 1859 | else if (b > e) | ||
| 1860 | Vsaved_region_selection = make_buffer_string (e, b, 0); | ||
| 1861 | } | ||
| 1862 | 1864 | ||
| 1863 | signal_before_change (start, end, preserve_ptr); | 1865 | signal_before_change (start, end, preserve_ptr); |
| 1864 | Vdeactivate_mark = Qt; | 1866 | Vdeactivate_mark = Qt; |
| @@ -1872,19 +1874,26 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, | |||
| 1872 | ptrdiff_t *preserve_ptr) | 1874 | ptrdiff_t *preserve_ptr) |
| 1873 | { | 1875 | { |
| 1874 | prepare_to_modify_buffer_1 (start, end, preserve_ptr); | 1876 | prepare_to_modify_buffer_1 (start, end, preserve_ptr); |
| 1877 | invalidate_buffer_caches (current_buffer, start, end); | ||
| 1878 | } | ||
| 1875 | 1879 | ||
| 1876 | if (current_buffer->newline_cache) | 1880 | /* Invalidate the caches maintained by the buffer BUF, if any, for the |
| 1877 | invalidate_region_cache (current_buffer, | 1881 | region between buffer positions START and END. */ |
| 1878 | current_buffer->newline_cache, | 1882 | void |
| 1879 | start - BEG, Z - end); | 1883 | invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) |
| 1880 | if (current_buffer->width_run_cache) | 1884 | { |
| 1881 | invalidate_region_cache (current_buffer, | 1885 | if (buf->newline_cache) |
| 1882 | current_buffer->width_run_cache, | 1886 | invalidate_region_cache (buf, |
| 1883 | start - BEG, Z - end); | 1887 | buf->newline_cache, |
| 1884 | if (current_buffer->bidi_paragraph_cache) | 1888 | start - BUF_BEG (buf), BUF_Z (buf) - end); |
| 1885 | invalidate_region_cache (current_buffer, | 1889 | if (buf->width_run_cache) |
| 1886 | current_buffer->bidi_paragraph_cache, | 1890 | invalidate_region_cache (buf, |
| 1887 | start - BEG, Z - end); | 1891 | buf->width_run_cache, |
| 1892 | start - BUF_BEG (buf), BUF_Z (buf) - end); | ||
| 1893 | if (buf->bidi_paragraph_cache) | ||
| 1894 | invalidate_region_cache (buf, | ||
| 1895 | buf->bidi_paragraph_cache, | ||
| 1896 | start - BUF_BEG (buf), BUF_Z (buf) - end); | ||
| 1888 | } | 1897 | } |
| 1889 | 1898 | ||
| 1890 | /* These macros work with an argument named `preserve_ptr' | 1899 | /* These macros work with an argument named `preserve_ptr' |
| @@ -2202,5 +2211,7 @@ as well as hooks attached to text properties and overlays. */); | |||
| 2202 | inhibit_modification_hooks = 0; | 2211 | inhibit_modification_hooks = 0; |
| 2203 | DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); | 2212 | DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); |
| 2204 | 2213 | ||
| 2214 | DEFSYM (Qregion_extract_function, "region-extract-function"); | ||
| 2215 | |||
| 2205 | defsubr (&Scombine_after_change_execute); | 2216 | defsubr (&Scombine_after_change_execute); |
| 2206 | } | 2217 | } |
diff --git a/src/keyboard.c b/src/keyboard.c index 0ff4cda034a..450592a07b6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -821,7 +821,7 @@ This function is called by the editor initialization to begin editing. */) | |||
| 821 | return Qnil; | 821 | return Qnil; |
| 822 | 822 | ||
| 823 | command_loop_level++; | 823 | command_loop_level++; |
| 824 | update_mode_lines = 1; | 824 | update_mode_lines = 17; |
| 825 | 825 | ||
| 826 | if (command_loop_level | 826 | if (command_loop_level |
| 827 | && current_buffer != XBUFFER (XWINDOW (selected_window)->contents)) | 827 | && current_buffer != XBUFFER (XWINDOW (selected_window)->contents)) |
| @@ -848,7 +848,7 @@ recursive_edit_unwind (Lisp_Object buffer) | |||
| 848 | Fset_buffer (buffer); | 848 | Fset_buffer (buffer); |
| 849 | 849 | ||
| 850 | command_loop_level--; | 850 | command_loop_level--; |
| 851 | update_mode_lines = 1; | 851 | update_mode_lines = 18; |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | 854 | ||
| @@ -1064,8 +1064,6 @@ cmd_error (Lisp_Object data) | |||
| 1064 | void | 1064 | void |
| 1065 | cmd_error_internal (Lisp_Object data, const char *context) | 1065 | cmd_error_internal (Lisp_Object data, const char *context) |
| 1066 | { | 1066 | { |
| 1067 | struct frame *sf = SELECTED_FRAME (); | ||
| 1068 | |||
| 1069 | /* The immediate context is not interesting for Quits, | 1067 | /* The immediate context is not interesting for Quits, |
| 1070 | since they are asynchronous. */ | 1068 | since they are asynchronous. */ |
| 1071 | if (EQ (XCAR (data), Qquit)) | 1069 | if (EQ (XCAR (data), Qquit)) |
| @@ -1079,9 +1077,23 @@ cmd_error_internal (Lisp_Object data, const char *context) | |||
| 1079 | call3 (Vcommand_error_function, data, | 1077 | call3 (Vcommand_error_function, data, |
| 1080 | context ? build_string (context) : empty_unibyte_string, | 1078 | context ? build_string (context) : empty_unibyte_string, |
| 1081 | Vsignaling_function); | 1079 | Vsignaling_function); |
| 1080 | |||
| 1081 | Vsignaling_function = Qnil; | ||
| 1082 | } | ||
| 1083 | |||
| 1084 | DEFUN ("command-error-default-function", Fcommand_error_default_function, | ||
| 1085 | Scommand_error_default_function, 3, 3, 0, | ||
| 1086 | doc: /* Produce default output for unhandled error message. | ||
| 1087 | Default value of `command-error-function'. */) | ||
| 1088 | (Lisp_Object data, Lisp_Object context, Lisp_Object signal) | ||
| 1089 | { | ||
| 1090 | struct frame *sf = SELECTED_FRAME (); | ||
| 1091 | |||
| 1092 | CHECK_STRING (context); | ||
| 1093 | |||
| 1082 | /* If the window system or terminal frame hasn't been initialized | 1094 | /* If the window system or terminal frame hasn't been initialized |
| 1083 | yet, or we're not interactive, write the message to stderr and exit. */ | 1095 | yet, or we're not interactive, write the message to stderr and exit. */ |
| 1084 | else if (!sf->glyphs_initialized_p | 1096 | if (!sf->glyphs_initialized_p |
| 1085 | /* The initial frame is a special non-displaying frame. It | 1097 | /* The initial frame is a special non-displaying frame. It |
| 1086 | will be current in daemon mode when there are no frames | 1098 | will be current in daemon mode when there are no frames |
| 1087 | to display, and in non-daemon mode before the real frame | 1099 | to display, and in non-daemon mode before the real frame |
| @@ -1096,7 +1108,7 @@ cmd_error_internal (Lisp_Object data, const char *context) | |||
| 1096 | || noninteractive) | 1108 | || noninteractive) |
| 1097 | { | 1109 | { |
| 1098 | print_error_message (data, Qexternal_debugging_output, | 1110 | print_error_message (data, Qexternal_debugging_output, |
| 1099 | context, Vsignaling_function); | 1111 | SSDATA (context), signal); |
| 1100 | Fterpri (Qexternal_debugging_output); | 1112 | Fterpri (Qexternal_debugging_output); |
| 1101 | Fkill_emacs (make_number (-1)); | 1113 | Fkill_emacs (make_number (-1)); |
| 1102 | } | 1114 | } |
| @@ -1107,10 +1119,9 @@ cmd_error_internal (Lisp_Object data, const char *context) | |||
| 1107 | message_log_maybe_newline (); | 1119 | message_log_maybe_newline (); |
| 1108 | bitch_at_user (); | 1120 | bitch_at_user (); |
| 1109 | 1121 | ||
| 1110 | print_error_message (data, Qt, context, Vsignaling_function); | 1122 | print_error_message (data, Qt, SSDATA (context), signal); |
| 1111 | } | 1123 | } |
| 1112 | 1124 | return Qnil; | |
| 1113 | Vsignaling_function = Qnil; | ||
| 1114 | } | 1125 | } |
| 1115 | 1126 | ||
| 1116 | static Lisp_Object command_loop_2 (Lisp_Object); | 1127 | static Lisp_Object command_loop_2 (Lisp_Object); |
| @@ -1310,6 +1321,8 @@ static void adjust_point_for_property (ptrdiff_t, bool); | |||
| 1310 | /* The last boundary auto-added to buffer-undo-list. */ | 1321 | /* The last boundary auto-added to buffer-undo-list. */ |
| 1311 | Lisp_Object last_undo_boundary; | 1322 | Lisp_Object last_undo_boundary; |
| 1312 | 1323 | ||
| 1324 | extern Lisp_Object Qregion_extract_function; | ||
| 1325 | |||
| 1313 | /* FIXME: This is wrong rather than test window-system, we should call | 1326 | /* FIXME: This is wrong rather than test window-system, we should call |
| 1314 | a new set-selection, which will then dispatch to x-set-selection, or | 1327 | a new set-selection, which will then dispatch to x-set-selection, or |
| 1315 | tty-set-selection, or w32-set-selection, ... */ | 1328 | tty-set-selection, or w32-set-selection, ... */ |
| @@ -1510,27 +1523,8 @@ command_loop_1 (void) | |||
| 1510 | already_adjusted = 0; | 1523 | already_adjusted = 0; |
| 1511 | 1524 | ||
| 1512 | if (NILP (Vthis_command)) | 1525 | if (NILP (Vthis_command)) |
| 1513 | { | 1526 | /* nil means key is undefined. */ |
| 1514 | /* nil means key is undefined. */ | 1527 | call0 (Qundefined); |
| 1515 | Lisp_Object keys = Fvector (i, keybuf); | ||
| 1516 | keys = Fkey_description (keys, Qnil); | ||
| 1517 | bitch_at_user (); | ||
| 1518 | message_with_string ("%s is undefined", keys, 0); | ||
| 1519 | kset_defining_kbd_macro (current_kboard, Qnil); | ||
| 1520 | update_mode_lines = 1; | ||
| 1521 | /* If this is a down-mouse event, don't reset prefix-arg; | ||
| 1522 | pass it to the command run by the up event. */ | ||
| 1523 | if (EVENT_HAS_PARAMETERS (last_command_event)) | ||
| 1524 | { | ||
| 1525 | Lisp_Object breakdown | ||
| 1526 | = parse_modifiers (EVENT_HEAD (last_command_event)); | ||
| 1527 | int modifiers = XINT (XCAR (XCDR (breakdown))); | ||
| 1528 | if (!(modifiers & down_modifier)) | ||
| 1529 | kset_prefix_arg (current_kboard, Qnil); | ||
| 1530 | } | ||
| 1531 | else | ||
| 1532 | kset_prefix_arg (current_kboard, Qnil); | ||
| 1533 | } | ||
| 1534 | else | 1528 | else |
| 1535 | { | 1529 | { |
| 1536 | /* Here for a command that isn't executed directly. */ | 1530 | /* Here for a command that isn't executed directly. */ |
| @@ -1637,16 +1631,11 @@ command_loop_1 (void) | |||
| 1637 | && NILP (Fmemq (Vthis_command, | 1631 | && NILP (Fmemq (Vthis_command, |
| 1638 | Vselection_inhibit_update_commands))) | 1632 | Vselection_inhibit_update_commands))) |
| 1639 | { | 1633 | { |
| 1640 | ptrdiff_t beg = | 1634 | Lisp_Object txt |
| 1641 | XINT (Fmarker_position (BVAR (current_buffer, mark))); | 1635 | = call1 (Fsymbol_value (Qregion_extract_function), Qnil); |
| 1642 | ptrdiff_t end = PT; | 1636 | if (XINT (Flength (txt)) > 0) |
| 1643 | if (beg < end) | 1637 | /* Don't set empty selections. */ |
| 1644 | call2 (Qx_set_selection, QPRIMARY, | 1638 | call2 (Qx_set_selection, QPRIMARY, txt); |
| 1645 | make_buffer_string (beg, end, 0)); | ||
| 1646 | else if (beg > end) | ||
| 1647 | call2 (Qx_set_selection, QPRIMARY, | ||
| 1648 | make_buffer_string (end, beg, 0)); | ||
| 1649 | /* Don't set empty selections. */ | ||
| 1650 | } | 1639 | } |
| 1651 | 1640 | ||
| 1652 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) | 1641 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) |
| @@ -1675,7 +1664,7 @@ command_loop_1 (void) | |||
| 1675 | cluster to prevent automatic composition. To recover | 1664 | cluster to prevent automatic composition. To recover |
| 1676 | the automatic composition, we must update the | 1665 | the automatic composition, we must update the |
| 1677 | display. */ | 1666 | display. */ |
| 1678 | windows_or_buffers_changed++; | 1667 | windows_or_buffers_changed = 21; |
| 1679 | if (!already_adjusted) | 1668 | if (!already_adjusted) |
| 1680 | adjust_point_for_property (last_point_position, | 1669 | adjust_point_for_property (last_point_position, |
| 1681 | MODIFF != prev_modiff); | 1670 | MODIFF != prev_modiff); |
| @@ -2097,7 +2086,7 @@ bind_polling_period (int n) | |||
| 2097 | 2086 | ||
| 2098 | /* Apply the control modifier to CHARACTER. */ | 2087 | /* Apply the control modifier to CHARACTER. */ |
| 2099 | 2088 | ||
| 2100 | #ifndef WINDOWSNT | 2089 | #ifndef HAVE_NTGUI |
| 2101 | static | 2090 | static |
| 2102 | #endif | 2091 | #endif |
| 2103 | int | 2092 | int |
| @@ -4376,7 +4365,7 @@ decode_timer (Lisp_Object timer, struct timespec *result) | |||
| 4376 | 4365 | ||
| 4377 | if (! (VECTORP (timer) && ASIZE (timer) == 9)) | 4366 | if (! (VECTORP (timer) && ASIZE (timer) == 9)) |
| 4378 | return 0; | 4367 | return 0; |
| 4379 | vector = XVECTOR (timer)->u.contents; | 4368 | vector = XVECTOR (timer)->contents; |
| 4380 | if (! NILP (vector[0])) | 4369 | if (! NILP (vector[0])) |
| 4381 | return 0; | 4370 | return 0; |
| 4382 | 4371 | ||
| @@ -8006,7 +7995,7 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void | |||
| 8006 | discard any previously made item. */ | 7995 | discard any previously made item. */ |
| 8007 | for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS) | 7996 | for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS) |
| 8008 | { | 7997 | { |
| 8009 | Lisp_Object *v = XVECTOR (tool_bar_items_vector)->u.contents + i; | 7998 | Lisp_Object *v = XVECTOR (tool_bar_items_vector)->contents + i; |
| 8010 | 7999 | ||
| 8011 | if (EQ (key, v[TOOL_BAR_ITEM_KEY])) | 8000 | if (EQ (key, v[TOOL_BAR_ITEM_KEY])) |
| 8012 | { | 8001 | { |
| @@ -8330,7 +8319,7 @@ append_tool_bar_item (void) | |||
| 8330 | /* Append entries from tool_bar_item_properties to the end of | 8319 | /* Append entries from tool_bar_item_properties to the end of |
| 8331 | tool_bar_items_vector. */ | 8320 | tool_bar_items_vector. */ |
| 8332 | vcopy (tool_bar_items_vector, ntool_bar_items, | 8321 | vcopy (tool_bar_items_vector, ntool_bar_items, |
| 8333 | XVECTOR (tool_bar_item_properties)->u.contents, TOOL_BAR_ITEM_NSLOTS); | 8322 | XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS); |
| 8334 | ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; | 8323 | ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; |
| 8335 | } | 8324 | } |
| 8336 | 8325 | ||
| @@ -9934,7 +9923,7 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, | |||
| 9934 | doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) | 9923 | doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) |
| 9935 | (void) | 9924 | (void) |
| 9936 | { | 9925 | { |
| 9937 | Lisp_Object *keys = XVECTOR (recent_keys)->u.contents; | 9926 | Lisp_Object *keys = XVECTOR (recent_keys)->contents; |
| 9938 | Lisp_Object val; | 9927 | Lisp_Object val; |
| 9939 | 9928 | ||
| 9940 | if (total_keys < NUM_RECENT_KEYS) | 9929 | if (total_keys < NUM_RECENT_KEYS) |
| @@ -9960,7 +9949,7 @@ See also `this-command-keys-vector'. */) | |||
| 9960 | (void) | 9949 | (void) |
| 9961 | { | 9950 | { |
| 9962 | return make_event_array (this_command_key_count, | 9951 | return make_event_array (this_command_key_count, |
| 9963 | XVECTOR (this_command_keys)->u.contents); | 9952 | XVECTOR (this_command_keys)->contents); |
| 9964 | } | 9953 | } |
| 9965 | 9954 | ||
| 9966 | DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0, | 9955 | DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0, |
| @@ -9972,7 +9961,7 @@ See also `this-command-keys'. */) | |||
| 9972 | (void) | 9961 | (void) |
| 9973 | { | 9962 | { |
| 9974 | return Fvector (this_command_key_count, | 9963 | return Fvector (this_command_key_count, |
| 9975 | XVECTOR (this_command_keys)->u.contents); | 9964 | XVECTOR (this_command_keys)->contents); |
| 9976 | } | 9965 | } |
| 9977 | 9966 | ||
| 9978 | DEFUN ("this-single-command-keys", Fthis_single_command_keys, | 9967 | DEFUN ("this-single-command-keys", Fthis_single_command_keys, |
| @@ -9987,7 +9976,7 @@ The value is always a vector. */) | |||
| 9987 | { | 9976 | { |
| 9988 | return Fvector (this_command_key_count | 9977 | return Fvector (this_command_key_count |
| 9989 | - this_single_command_key_start, | 9978 | - this_single_command_key_start, |
| 9990 | (XVECTOR (this_command_keys)->u.contents | 9979 | (XVECTOR (this_command_keys)->contents |
| 9991 | + this_single_command_key_start)); | 9980 | + this_single_command_key_start)); |
| 9992 | } | 9981 | } |
| 9993 | 9982 | ||
| @@ -10001,7 +9990,7 @@ shows the events before all translations (except for input methods). | |||
| 10001 | The value is always a vector. */) | 9990 | The value is always a vector. */) |
| 10002 | (void) | 9991 | (void) |
| 10003 | { | 9992 | { |
| 10004 | return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->u.contents); | 9993 | return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->contents); |
| 10005 | } | 9994 | } |
| 10006 | 9995 | ||
| 10007 | DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, | 9996 | DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, |
| @@ -11127,6 +11116,7 @@ syms_of_keyboard (void) | |||
| 11127 | defsubr (&Sabort_recursive_edit); | 11116 | defsubr (&Sabort_recursive_edit); |
| 11128 | defsubr (&Sexit_recursive_edit); | 11117 | defsubr (&Sexit_recursive_edit); |
| 11129 | defsubr (&Srecursion_depth); | 11118 | defsubr (&Srecursion_depth); |
| 11119 | defsubr (&Scommand_error_default_function); | ||
| 11130 | defsubr (&Stop_level); | 11120 | defsubr (&Stop_level); |
| 11131 | defsubr (&Sdiscard_input); | 11121 | defsubr (&Sdiscard_input); |
| 11132 | defsubr (&Sopen_dribble_file); | 11122 | defsubr (&Sopen_dribble_file); |
| @@ -11606,13 +11596,13 @@ peculiar kind of quitting. */); | |||
| 11606 | Vthrow_on_input = Qnil; | 11596 | Vthrow_on_input = Qnil; |
| 11607 | 11597 | ||
| 11608 | DEFVAR_LISP ("command-error-function", Vcommand_error_function, | 11598 | DEFVAR_LISP ("command-error-function", Vcommand_error_function, |
| 11609 | doc: /* If non-nil, function to output error messages. | 11599 | doc: /* Function to output error messages. |
| 11610 | The arguments are the error data, a list of the form | 11600 | Called with three arguments: |
| 11611 | (SIGNALED-CONDITIONS . SIGNAL-DATA) | 11601 | - the error data, a list of the form (SIGNALED-CONDITION . SIGNAL-DATA) |
| 11612 | such as just as `condition-case' would bind its variable to, | 11602 | such as what `condition-case' would bind its variable to, |
| 11613 | the context (a string which normally goes at the start of the message), | 11603 | - the context (a string which normally goes at the start of the message), |
| 11614 | and the Lisp function within which the error was signaled. */); | 11604 | - the Lisp function within which the error was signaled. */); |
| 11615 | Vcommand_error_function = Qnil; | 11605 | Vcommand_error_function = intern ("command-error-default-function"); |
| 11616 | 11606 | ||
| 11617 | DEFVAR_LISP ("enable-disabled-menus-and-buttons", | 11607 | DEFVAR_LISP ("enable-disabled-menus-and-buttons", |
| 11618 | Venable_disabled_menus_and_buttons, | 11608 | Venable_disabled_menus_and_buttons, |
diff --git a/src/keymap.c b/src/keymap.c index 7a18cd5d983..562787ee8a5 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -3383,9 +3383,12 @@ describe_map (Lisp_Object map, Lisp_Object prefix, | |||
| 3383 | 3383 | ||
| 3384 | if (vect[i].shadowed) | 3384 | if (vect[i].shadowed) |
| 3385 | { | 3385 | { |
| 3386 | SET_PT (PT - 1); | 3386 | ptrdiff_t pt = max (PT - 1, BEG); |
| 3387 | |||
| 3388 | SET_PT (pt); | ||
| 3387 | insert_string ("\n (that binding is currently shadowed by another mode)"); | 3389 | insert_string ("\n (that binding is currently shadowed by another mode)"); |
| 3388 | SET_PT (PT + 1); | 3390 | pt = min (PT + 1, Z); |
| 3391 | SET_PT (pt); | ||
| 3389 | } | 3392 | } |
| 3390 | } | 3393 | } |
| 3391 | 3394 | ||
diff --git a/src/lisp.h b/src/lisp.h index e1a6fc7c91a..a5aec41be38 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -45,7 +45,7 @@ INLINE_HEADER_BEGIN | |||
| 45 | definitions visible to the debugger. It's used for symbols that | 45 | definitions visible to the debugger. It's used for symbols that |
| 46 | .gdbinit needs, symbols whose values may not fit in 'int' (where an | 46 | .gdbinit needs, symbols whose values may not fit in 'int' (where an |
| 47 | enum would suffice). */ | 47 | enum would suffice). */ |
| 48 | #ifdef MAIN_PROGRAM | 48 | #if defined MAIN_PROGRAM |
| 49 | # define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE | 49 | # define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE |
| 50 | # define DEFINE_GDB_SYMBOL_END(id) = id; | 50 | # define DEFINE_GDB_SYMBOL_END(id) = id; |
| 51 | #else | 51 | #else |
| @@ -71,7 +71,7 @@ typedef unsigned long long int EMACS_UINT; | |||
| 71 | # define pI "ll" | 71 | # define pI "ll" |
| 72 | # elif INT_MAX < LONG_MAX | 72 | # elif INT_MAX < LONG_MAX |
| 73 | typedef long int EMACS_INT; | 73 | typedef long int EMACS_INT; |
| 74 | typedef unsigned long int EMACS_UINT; | 74 | typedef unsigned long EMACS_UINT; |
| 75 | # define EMACS_INT_MAX LONG_MAX | 75 | # define EMACS_INT_MAX LONG_MAX |
| 76 | # define pI "l" | 76 | # define pI "l" |
| 77 | # else | 77 | # else |
| @@ -82,10 +82,26 @@ typedef unsigned int EMACS_UINT; | |||
| 82 | # endif | 82 | # endif |
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | /* Number of bits to put in each character in the internal representation | ||
| 86 | of bool vectors. This should not vary across implementations. */ | ||
| 87 | enum { BOOL_VECTOR_BITS_PER_CHAR = | ||
| 88 | #define BOOL_VECTOR_BITS_PER_CHAR 8 | ||
| 89 | BOOL_VECTOR_BITS_PER_CHAR | ||
| 90 | }; | ||
| 91 | |||
| 85 | /* An unsigned integer type representing a fixed-length bit sequence, | 92 | /* An unsigned integer type representing a fixed-length bit sequence, |
| 86 | suitable for words in a Lisp bool vector. */ | 93 | suitable for words in a Lisp bool vector. Normally it is size_t |
| 94 | for speed, but it is unsigned char on weird platforms. */ | ||
| 95 | #if BOOL_VECTOR_BITS_PER_CHAR == CHAR_BIT | ||
| 87 | typedef size_t bits_word; | 96 | typedef size_t bits_word; |
| 88 | #define BITS_WORD_MAX SIZE_MAX | 97 | # define BITS_WORD_MAX SIZE_MAX |
| 98 | enum { BITS_PER_BITS_WORD = CHAR_BIT * sizeof (bits_word) }; | ||
| 99 | #else | ||
| 100 | typedef unsigned char bits_word; | ||
| 101 | # define BITS_WORD_MAX ((1u << BOOL_VECTOR_BITS_PER_CHAR) - 1) | ||
| 102 | enum { BITS_PER_BITS_WORD = BOOL_VECTOR_BITS_PER_CHAR }; | ||
| 103 | #endif | ||
| 104 | verify (BITS_WORD_MAX >> (BITS_PER_BITS_WORD - 1) == 1); | ||
| 89 | 105 | ||
| 90 | /* Number of bits in some machine integer types. */ | 106 | /* Number of bits in some machine integer types. */ |
| 91 | enum | 107 | enum |
| @@ -94,7 +110,6 @@ enum | |||
| 94 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), | 110 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), |
| 95 | BITS_PER_INT = CHAR_BIT * sizeof (int), | 111 | BITS_PER_INT = CHAR_BIT * sizeof (int), |
| 96 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), | 112 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), |
| 97 | BITS_PER_BITS_WORD = CHAR_BIT * sizeof (bits_word), | ||
| 98 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) | 113 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) |
| 99 | }; | 114 | }; |
| 100 | 115 | ||
| @@ -406,8 +421,10 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; | |||
| 406 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 | 421 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 |
| 407 | 422 | ||
| 408 | /* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, | 423 | /* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, |
| 409 | MSVC doesn't support them, and xlc complains vociferously about them. */ | 424 | MSVC doesn't support them, and xlc and Oracle Studio c99 complain |
| 410 | #if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ | 425 | vociferously about them. */ |
| 426 | #if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \ | ||
| 427 | || (defined __SUNPRO_C && __STDC__)) | ||
| 411 | #define ENUM_BF(TYPE) unsigned int | 428 | #define ENUM_BF(TYPE) unsigned int |
| 412 | #else | 429 | #else |
| 413 | #define ENUM_BF(TYPE) enum TYPE | 430 | #define ENUM_BF(TYPE) enum TYPE |
| @@ -614,10 +631,6 @@ enum More_Lisp_Bits | |||
| 614 | /* Used to extract pseudovector subtype information. */ | 631 | /* Used to extract pseudovector subtype information. */ |
| 615 | PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS, | 632 | PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS, |
| 616 | PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS, | 633 | PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS, |
| 617 | |||
| 618 | /* Number of bits to put in each character in the internal representation | ||
| 619 | of bool vectors. This should not vary across implementations. */ | ||
| 620 | BOOL_VECTOR_BITS_PER_CHAR = 8 | ||
| 621 | }; | 634 | }; |
| 622 | 635 | ||
| 623 | /* These functions extract various sorts of values from a Lisp_Object. | 636 | /* These functions extract various sorts of values from a Lisp_Object. |
| @@ -775,7 +788,7 @@ extern int char_table_translate (Lisp_Object, int); | |||
| 775 | /* Defined in data.c. */ | 788 | /* Defined in data.c. */ |
| 776 | extern Lisp_Object Qarrayp, Qbufferp, Qbuffer_or_string_p, Qchar_table_p; | 789 | extern Lisp_Object Qarrayp, Qbufferp, Qbuffer_or_string_p, Qchar_table_p; |
| 777 | extern Lisp_Object Qconsp, Qfloatp, Qintegerp, Qlambda, Qlistp, Qmarkerp, Qnil; | 790 | extern Lisp_Object Qconsp, Qfloatp, Qintegerp, Qlambda, Qlistp, Qmarkerp, Qnil; |
| 778 | extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qvectorp; | 791 | extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qt, Qvectorp; |
| 779 | extern Lisp_Object Qbool_vector_p; | 792 | extern Lisp_Object Qbool_vector_p; |
| 780 | extern Lisp_Object Qvector_or_char_table_p, Qwholenump; | 793 | extern Lisp_Object Qvector_or_char_table_p, Qwholenump; |
| 781 | extern Lisp_Object Qwindow; | 794 | extern Lisp_Object Qwindow; |
| @@ -1150,7 +1163,7 @@ STRING_COPYIN (Lisp_Object string, ptrdiff_t index, char const *new, | |||
| 1150 | and PSEUDOVECTORP cast their pointers to struct vectorlike_header *, | 1163 | and PSEUDOVECTORP cast their pointers to struct vectorlike_header *, |
| 1151 | because when two such pointers potentially alias, a compiler won't | 1164 | because when two such pointers potentially alias, a compiler won't |
| 1152 | incorrectly reorder loads and stores to their size fields. See | 1165 | incorrectly reorder loads and stores to their size fields. See |
| 1153 | <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8546>. */ | 1166 | Bug#8546. */ |
| 1154 | struct vectorlike_header | 1167 | struct vectorlike_header |
| 1155 | { | 1168 | { |
| 1156 | /* The only field contains various pieces of information: | 1169 | /* The only field contains various pieces of information: |
| @@ -1175,22 +1188,22 @@ struct vectorlike_header | |||
| 1175 | ptrdiff_t size; | 1188 | ptrdiff_t size; |
| 1176 | }; | 1189 | }; |
| 1177 | 1190 | ||
| 1178 | /* Regular vector is just a header plus array of Lisp_Objects... */ | 1191 | /* A regular vector is just a header plus an array of Lisp_Objects. */ |
| 1179 | 1192 | ||
| 1180 | struct Lisp_Vector | 1193 | struct Lisp_Vector |
| 1181 | { | 1194 | { |
| 1182 | struct vectorlike_header header; | 1195 | struct vectorlike_header header; |
| 1183 | union { | 1196 | Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; |
| 1184 | /* ...but sometimes there is also a pointer internally used in | 1197 | }; |
| 1185 | vector allocation code. Usually you don't want to touch this. */ | ||
| 1186 | struct Lisp_Vector *next; | ||
| 1187 | 1198 | ||
| 1188 | /* We can't use FLEXIBLE_ARRAY_MEMBER here. */ | 1199 | /* C11 prohibits alignof (struct Lisp_Vector), so compute it manually. */ |
| 1189 | Lisp_Object contents[1]; | 1200 | enum |
| 1190 | } u; | 1201 | { |
| 1202 | ALIGNOF_STRUCT_LISP_VECTOR | ||
| 1203 | = alignof (union { struct vectorlike_header a; Lisp_Object b; }) | ||
| 1191 | }; | 1204 | }; |
| 1192 | 1205 | ||
| 1193 | /* A boolvector is a kind of vectorlike, with contents are like a string. */ | 1206 | /* A boolvector is a kind of vectorlike, with contents like a string. */ |
| 1194 | 1207 | ||
| 1195 | struct Lisp_Bool_Vector | 1208 | struct Lisp_Bool_Vector |
| 1196 | { | 1209 | { |
| @@ -1199,8 +1212,10 @@ struct Lisp_Bool_Vector | |||
| 1199 | struct vectorlike_header header; | 1212 | struct vectorlike_header header; |
| 1200 | /* This is the size in bits. */ | 1213 | /* This is the size in bits. */ |
| 1201 | EMACS_INT size; | 1214 | EMACS_INT size; |
| 1202 | /* This contains the actual bits, packed into bytes. */ | 1215 | /* The actual bits, packed into bytes. |
| 1203 | unsigned char data[FLEXIBLE_ARRAY_MEMBER]; | 1216 | The bits are in little-endian order in the bytes, and |
| 1217 | the bytes are in little-endian order in the words. */ | ||
| 1218 | bits_word data[FLEXIBLE_ARRAY_MEMBER]; | ||
| 1204 | }; | 1219 | }; |
| 1205 | 1220 | ||
| 1206 | INLINE EMACS_INT | 1221 | INLINE EMACS_INT |
| @@ -1211,12 +1226,72 @@ bool_vector_size (Lisp_Object a) | |||
| 1211 | return size; | 1226 | return size; |
| 1212 | } | 1227 | } |
| 1213 | 1228 | ||
| 1229 | INLINE bits_word * | ||
| 1230 | bool_vector_data (Lisp_Object a) | ||
| 1231 | { | ||
| 1232 | return XBOOL_VECTOR (a)->data; | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | INLINE unsigned char * | ||
| 1236 | bool_vector_uchar_data (Lisp_Object a) | ||
| 1237 | { | ||
| 1238 | return (unsigned char *) bool_vector_data (a); | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | /* The number of data words and bytes in a bool vector with SIZE bits. */ | ||
| 1242 | |||
| 1243 | INLINE EMACS_INT | ||
| 1244 | bool_vector_words (EMACS_INT size) | ||
| 1245 | { | ||
| 1246 | eassume (0 <= size && size <= EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1)); | ||
| 1247 | return (size + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD; | ||
| 1248 | } | ||
| 1249 | |||
| 1250 | INLINE EMACS_INT | ||
| 1251 | bool_vector_bytes (EMACS_INT size) | ||
| 1252 | { | ||
| 1253 | eassume (0 <= size && size <= EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1)); | ||
| 1254 | return (size + BOOL_VECTOR_BITS_PER_CHAR - 1) / BOOL_VECTOR_BITS_PER_CHAR; | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | /* True if A's Ith bit is set. */ | ||
| 1258 | |||
| 1259 | INLINE bool | ||
| 1260 | bool_vector_bitref (Lisp_Object a, EMACS_INT i) | ||
| 1261 | { | ||
| 1262 | eassume (0 <= i && i < bool_vector_size (a)); | ||
| 1263 | return !! (bool_vector_uchar_data (a)[i / BOOL_VECTOR_BITS_PER_CHAR] | ||
| 1264 | & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))); | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | INLINE Lisp_Object | ||
| 1268 | bool_vector_ref (Lisp_Object a, EMACS_INT i) | ||
| 1269 | { | ||
| 1270 | return bool_vector_bitref (a, i) ? Qt : Qnil; | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | /* Set A's Ith bit to B. */ | ||
| 1274 | |||
| 1275 | INLINE void | ||
| 1276 | bool_vector_set (Lisp_Object a, EMACS_INT i, bool b) | ||
| 1277 | { | ||
| 1278 | unsigned char *addr; | ||
| 1279 | |||
| 1280 | eassume (0 <= i && i < bool_vector_size (a)); | ||
| 1281 | addr = &bool_vector_uchar_data (a)[i / BOOL_VECTOR_BITS_PER_CHAR]; | ||
| 1282 | |||
| 1283 | if (b) | ||
| 1284 | *addr |= 1 << (i % BOOL_VECTOR_BITS_PER_CHAR); | ||
| 1285 | else | ||
| 1286 | *addr &= ~ (1 << (i % BOOL_VECTOR_BITS_PER_CHAR)); | ||
| 1287 | } | ||
| 1288 | |||
| 1214 | /* Some handy constants for calculating sizes | 1289 | /* Some handy constants for calculating sizes |
| 1215 | and offsets, mostly of vectorlike objects. */ | 1290 | and offsets, mostly of vectorlike objects. */ |
| 1216 | 1291 | ||
| 1217 | enum | 1292 | enum |
| 1218 | { | 1293 | { |
| 1219 | header_size = offsetof (struct Lisp_Vector, u.contents), | 1294 | header_size = offsetof (struct Lisp_Vector, contents), |
| 1220 | bool_header_size = offsetof (struct Lisp_Bool_Vector, data), | 1295 | bool_header_size = offsetof (struct Lisp_Bool_Vector, data), |
| 1221 | word_size = sizeof (Lisp_Object) | 1296 | word_size = sizeof (Lisp_Object) |
| 1222 | }; | 1297 | }; |
| @@ -1226,13 +1301,13 @@ enum | |||
| 1226 | INLINE Lisp_Object | 1301 | INLINE Lisp_Object |
| 1227 | AREF (Lisp_Object array, ptrdiff_t idx) | 1302 | AREF (Lisp_Object array, ptrdiff_t idx) |
| 1228 | { | 1303 | { |
| 1229 | return XVECTOR (array)->u.contents[idx]; | 1304 | return XVECTOR (array)->contents[idx]; |
| 1230 | } | 1305 | } |
| 1231 | 1306 | ||
| 1232 | INLINE Lisp_Object * | 1307 | INLINE Lisp_Object * |
| 1233 | aref_addr (Lisp_Object array, ptrdiff_t idx) | 1308 | aref_addr (Lisp_Object array, ptrdiff_t idx) |
| 1234 | { | 1309 | { |
| 1235 | return & XVECTOR (array)->u.contents[idx]; | 1310 | return & XVECTOR (array)->contents[idx]; |
| 1236 | } | 1311 | } |
| 1237 | 1312 | ||
| 1238 | INLINE ptrdiff_t | 1313 | INLINE ptrdiff_t |
| @@ -1245,7 +1320,7 @@ INLINE void | |||
| 1245 | ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | 1320 | ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) |
| 1246 | { | 1321 | { |
| 1247 | eassert (0 <= idx && idx < ASIZE (array)); | 1322 | eassert (0 <= idx && idx < ASIZE (array)); |
| 1248 | XVECTOR (array)->u.contents[idx] = val; | 1323 | XVECTOR (array)->contents[idx] = val; |
| 1249 | } | 1324 | } |
| 1250 | 1325 | ||
| 1251 | INLINE void | 1326 | INLINE void |
| @@ -1254,7 +1329,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1254 | /* Like ASET, but also can be used in the garbage collector: | 1329 | /* Like ASET, but also can be used in the garbage collector: |
| 1255 | sweep_weak_table calls set_hash_key etc. while the table is marked. */ | 1330 | sweep_weak_table calls set_hash_key etc. while the table is marked. */ |
| 1256 | eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG)); | 1331 | eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG)); |
| 1257 | XVECTOR (array)->u.contents[idx] = val; | 1332 | XVECTOR (array)->contents[idx] = val; |
| 1258 | } | 1333 | } |
| 1259 | 1334 | ||
| 1260 | /* If a struct is made to look like a vector, this macro returns the length | 1335 | /* If a struct is made to look like a vector, this macro returns the length |
| @@ -1758,14 +1833,14 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */ | |||
| 1758 | { | 1833 | { |
| 1759 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ | 1834 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ |
| 1760 | unsigned gcmarkbit : 1; | 1835 | unsigned gcmarkbit : 1; |
| 1761 | int spacer : 15; | 1836 | unsigned spacer : 15; |
| 1762 | }; | 1837 | }; |
| 1763 | 1838 | ||
| 1764 | struct Lisp_Marker | 1839 | struct Lisp_Marker |
| 1765 | { | 1840 | { |
| 1766 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ | 1841 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ |
| 1767 | unsigned gcmarkbit : 1; | 1842 | unsigned gcmarkbit : 1; |
| 1768 | int spacer : 13; | 1843 | unsigned spacer : 13; |
| 1769 | /* This flag is temporarily used in the functions | 1844 | /* This flag is temporarily used in the functions |
| 1770 | decode/encode_coding_object to record that the marker position | 1845 | decode/encode_coding_object to record that the marker position |
| 1771 | must be adjusted after the conversion. */ | 1846 | must be adjusted after the conversion. */ |
| @@ -1819,7 +1894,7 @@ struct Lisp_Overlay | |||
| 1819 | { | 1894 | { |
| 1820 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ | 1895 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ |
| 1821 | unsigned gcmarkbit : 1; | 1896 | unsigned gcmarkbit : 1; |
| 1822 | int spacer : 15; | 1897 | unsigned spacer : 15; |
| 1823 | struct Lisp_Overlay *next; | 1898 | struct Lisp_Overlay *next; |
| 1824 | Lisp_Object start; | 1899 | Lisp_Object start; |
| 1825 | Lisp_Object end; | 1900 | Lisp_Object end; |
| @@ -1897,7 +1972,7 @@ struct Lisp_Save_Value | |||
| 1897 | { | 1972 | { |
| 1898 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ | 1973 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ |
| 1899 | unsigned gcmarkbit : 1; | 1974 | unsigned gcmarkbit : 1; |
| 1900 | int spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); | 1975 | unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); |
| 1901 | 1976 | ||
| 1902 | /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of | 1977 | /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of |
| 1903 | V's data entries are determined by V->save_type. E.g., if | 1978 | V's data entries are determined by V->save_type. E.g., if |
| @@ -1973,7 +2048,7 @@ struct Lisp_Free | |||
| 1973 | { | 2048 | { |
| 1974 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ | 2049 | ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ |
| 1975 | unsigned gcmarkbit : 1; | 2050 | unsigned gcmarkbit : 1; |
| 1976 | int spacer : 15; | 2051 | unsigned spacer : 15; |
| 1977 | union Lisp_Misc *chain; | 2052 | union Lisp_Misc *chain; |
| 1978 | }; | 2053 | }; |
| 1979 | 2054 | ||
| @@ -2737,7 +2812,7 @@ union specbinding | |||
| 2737 | } let; | 2812 | } let; |
| 2738 | struct { | 2813 | struct { |
| 2739 | ENUM_BF (specbind_tag) kind : CHAR_BIT; | 2814 | ENUM_BF (specbind_tag) kind : CHAR_BIT; |
| 2740 | bool debug_on_exit : 1; | 2815 | unsigned debug_on_exit : 1; |
| 2741 | Lisp_Object function; | 2816 | Lisp_Object function; |
| 2742 | Lisp_Object *args; | 2817 | Lisp_Object *args; |
| 2743 | ptrdiff_t nargs; | 2818 | ptrdiff_t nargs; |
| @@ -2807,14 +2882,13 @@ struct handler | |||
| 2807 | 2882 | ||
| 2808 | /* Fill in the components of c, and put it on the list. */ | 2883 | /* Fill in the components of c, and put it on the list. */ |
| 2809 | #define PUSH_HANDLER(c, tag_ch_val, handlertype) \ | 2884 | #define PUSH_HANDLER(c, tag_ch_val, handlertype) \ |
| 2810 | if (handlerlist && handlerlist->nextfree) \ | 2885 | if (handlerlist->nextfree) \ |
| 2811 | (c) = handlerlist->nextfree; \ | 2886 | (c) = handlerlist->nextfree; \ |
| 2812 | else \ | 2887 | else \ |
| 2813 | { \ | 2888 | { \ |
| 2814 | (c) = xmalloc (sizeof (struct handler)); \ | 2889 | (c) = xmalloc (sizeof (struct handler)); \ |
| 2815 | (c)->nextfree = NULL; \ | 2890 | (c)->nextfree = NULL; \ |
| 2816 | if (handlerlist) \ | 2891 | handlerlist->nextfree = (c); \ |
| 2817 | handlerlist->nextfree = (c); \ | ||
| 2818 | } \ | 2892 | } \ |
| 2819 | (c)->type = (handlertype); \ | 2893 | (c)->type = (handlertype); \ |
| 2820 | (c)->tag_or_ch = (tag_ch_val); \ | 2894 | (c)->tag_or_ch = (tag_ch_val); \ |
| @@ -3089,7 +3163,7 @@ INLINE void | |||
| 3089 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) | 3163 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) |
| 3090 | { | 3164 | { |
| 3091 | eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); | 3165 | eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); |
| 3092 | memcpy (XVECTOR (v)->u.contents + offset, args, count * sizeof *args); | 3166 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); |
| 3093 | } | 3167 | } |
| 3094 | 3168 | ||
| 3095 | /* Functions to modify hash tables. */ | 3169 | /* Functions to modify hash tables. */ |
| @@ -3405,6 +3479,7 @@ extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, | |||
| 3405 | extern void modify_text (ptrdiff_t, ptrdiff_t); | 3479 | extern void modify_text (ptrdiff_t, ptrdiff_t); |
| 3406 | extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); | 3480 | extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); |
| 3407 | extern void prepare_to_modify_buffer_1 (ptrdiff_t, ptrdiff_t, ptrdiff_t *); | 3481 | extern void prepare_to_modify_buffer_1 (ptrdiff_t, ptrdiff_t, ptrdiff_t *); |
| 3482 | extern void invalidate_buffer_caches (struct buffer *, ptrdiff_t, ptrdiff_t); | ||
| 3408 | extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); | 3483 | extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 3409 | extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, | 3484 | extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 3410 | ptrdiff_t, ptrdiff_t); | 3485 | ptrdiff_t, ptrdiff_t); |
| @@ -3461,7 +3536,6 @@ extern void update_echo_area (void); | |||
| 3461 | extern void truncate_echo_area (ptrdiff_t); | 3536 | extern void truncate_echo_area (ptrdiff_t); |
| 3462 | extern void redisplay (void); | 3537 | extern void redisplay (void); |
| 3463 | extern void redisplay_preserve_echo_area (int); | 3538 | extern void redisplay_preserve_echo_area (int); |
| 3464 | extern void prepare_menu_bars (void); | ||
| 3465 | 3539 | ||
| 3466 | void set_frame_cursor_types (struct frame *, Lisp_Object); | 3540 | void set_frame_cursor_types (struct frame *, Lisp_Object); |
| 3467 | extern void syms_of_xdisp (void); | 3541 | extern void syms_of_xdisp (void); |
| @@ -3524,6 +3598,8 @@ list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h) | |||
| 3524 | make_number (w), make_number (h)); | 3598 | make_number (w), make_number (h)); |
| 3525 | } | 3599 | } |
| 3526 | 3600 | ||
| 3601 | extern Lisp_Object make_uninit_bool_vector (EMACS_INT); | ||
| 3602 | extern Lisp_Object bool_vector_fill (Lisp_Object, Lisp_Object); | ||
| 3527 | extern _Noreturn void string_overflow (void); | 3603 | extern _Noreturn void string_overflow (void); |
| 3528 | extern Lisp_Object make_string (const char *, ptrdiff_t); | 3604 | extern Lisp_Object make_string (const char *, ptrdiff_t); |
| 3529 | extern Lisp_Object make_formatted_string (char *, const char *, ...) | 3605 | extern Lisp_Object make_formatted_string (char *, const char *, ...) |
| @@ -4417,10 +4493,6 @@ functionp (Lisp_Object object) | |||
| 4417 | return 0; | 4493 | return 0; |
| 4418 | } | 4494 | } |
| 4419 | 4495 | ||
| 4420 | /* Round x to the next multiple of y. Does not overflow. Evaluates | ||
| 4421 | arguments repeatedly. */ | ||
| 4422 | #define ROUNDUP(x,y) ((y)*((x)/(y) + ((x)%(y)!=0))) | ||
| 4423 | |||
| 4424 | INLINE_HEADER_END | 4496 | INLINE_HEADER_END |
| 4425 | 4497 | ||
| 4426 | #endif /* EMACS_LISP_H */ | 4498 | #endif /* EMACS_LISP_H */ |
diff --git a/src/lread.c b/src/lread.c index fe2b92a34b3..6c1b17f62b7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1500,7 +1500,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1500 | for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes; | 1500 | for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes; |
| 1501 | CONSP (tail); tail = XCDR (tail)) | 1501 | CONSP (tail); tail = XCDR (tail)) |
| 1502 | { | 1502 | { |
| 1503 | ptrdiff_t fnlen, lsuffix = SBYTES (XCAR (tail)); | 1503 | Lisp_Object suffix = XCAR (tail); |
| 1504 | ptrdiff_t fnlen, lsuffix = SBYTES (suffix); | ||
| 1504 | Lisp_Object handler; | 1505 | Lisp_Object handler; |
| 1505 | 1506 | ||
| 1506 | /* Concatenate path element/specified name with the suffix. | 1507 | /* Concatenate path element/specified name with the suffix. |
| @@ -1511,7 +1512,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1511 | ? 2 : 0); | 1512 | ? 2 : 0); |
| 1512 | fnlen = SBYTES (filename) - prefixlen; | 1513 | fnlen = SBYTES (filename) - prefixlen; |
| 1513 | memcpy (fn, SDATA (filename) + prefixlen, fnlen); | 1514 | memcpy (fn, SDATA (filename) + prefixlen, fnlen); |
| 1514 | memcpy (fn + fnlen, SDATA (XCAR (tail)), lsuffix + 1); | 1515 | memcpy (fn + fnlen, SDATA (suffix), lsuffix + 1); |
| 1515 | fnlen += lsuffix; | 1516 | fnlen += lsuffix; |
| 1516 | /* Check that the file exists and is not a directory. */ | 1517 | /* Check that the file exists and is not a directory. */ |
| 1517 | /* We used to only check for handlers on non-absolute file names: | 1518 | /* We used to only check for handlers on non-absolute file names: |
| @@ -1521,7 +1522,18 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1521 | handler = Ffind_file_name_handler (filename, Qfile_exists_p); | 1522 | handler = Ffind_file_name_handler (filename, Qfile_exists_p); |
| 1522 | It's not clear why that was the case and it breaks things like | 1523 | It's not clear why that was the case and it breaks things like |
| 1523 | (load "/bar.el") where the file is actually "/bar.el.gz". */ | 1524 | (load "/bar.el") where the file is actually "/bar.el.gz". */ |
| 1524 | string = make_string (fn, fnlen); | 1525 | /* make_string has its own ideas on when to return a unibyte |
| 1526 | string and when a multibyte string, but we know better. | ||
| 1527 | We must have a unibyte string when dumping, since | ||
| 1528 | file-name encoding is shaky at best at that time, and in | ||
| 1529 | particular default-file-name-coding-system is reset | ||
| 1530 | several times during loadup. We therefore don't want to | ||
| 1531 | encode the file before passing it to file I/O library | ||
| 1532 | functions. */ | ||
| 1533 | if (!STRING_MULTIBYTE (filename) && !STRING_MULTIBYTE (suffix)) | ||
| 1534 | string = make_unibyte_string (fn, fnlen); | ||
| 1535 | else | ||
| 1536 | string = make_string (fn, fnlen); | ||
| 1525 | handler = Ffind_file_name_handler (string, Qfile_exists_p); | 1537 | handler = Ffind_file_name_handler (string, Qfile_exists_p); |
| 1526 | if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate)) | 1538 | if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate)) |
| 1527 | { | 1539 | { |
| @@ -2565,9 +2577,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2565 | if (c == '"') | 2577 | if (c == '"') |
| 2566 | { | 2578 | { |
| 2567 | Lisp_Object tmp, val; | 2579 | Lisp_Object tmp, val; |
| 2568 | EMACS_INT size_in_chars | 2580 | EMACS_INT size_in_chars = bool_vector_bytes (XFASTINT (length)); |
| 2569 | = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) | 2581 | unsigned char *data; |
| 2570 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2571 | 2582 | ||
| 2572 | UNREAD (c); | 2583 | UNREAD (c); |
| 2573 | tmp = read1 (readcharfun, pch, first_in_list); | 2584 | tmp = read1 (readcharfun, pch, first_in_list); |
| @@ -2581,11 +2592,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2581 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) | 2592 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) |
| 2582 | invalid_syntax ("#&..."); | 2593 | invalid_syntax ("#&..."); |
| 2583 | 2594 | ||
| 2584 | val = Fmake_bool_vector (length, Qnil); | 2595 | val = make_uninit_bool_vector (XFASTINT (length)); |
| 2585 | memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars); | 2596 | data = bool_vector_uchar_data (val); |
| 2597 | memcpy (data, SDATA (tmp), size_in_chars); | ||
| 2586 | /* Clear the extraneous bits in the last byte. */ | 2598 | /* Clear the extraneous bits in the last byte. */ |
| 2587 | if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) | 2599 | if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) |
| 2588 | XBOOL_VECTOR (val)->data[size_in_chars - 1] | 2600 | data[size_in_chars - 1] |
| 2589 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 2601 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 2590 | return val; | 2602 | return val; |
| 2591 | } | 2603 | } |
| @@ -3462,7 +3474,7 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag) | |||
| 3462 | vector = Fmake_vector (len, Qnil); | 3474 | vector = Fmake_vector (len, Qnil); |
| 3463 | 3475 | ||
| 3464 | size = ASIZE (vector); | 3476 | size = ASIZE (vector); |
| 3465 | ptr = XVECTOR (vector)->u.contents; | 3477 | ptr = XVECTOR (vector)->contents; |
| 3466 | for (i = 0; i < size; i++) | 3478 | for (i = 0; i < size; i++) |
| 3467 | { | 3479 | { |
| 3468 | item = Fcar (tem); | 3480 | item = Fcar (tem); |
diff --git a/src/macfont.h b/src/macfont.h index 141d60bfb0a..4b57c18692e 100644 --- a/src/macfont.h +++ b/src/macfont.h | |||
| @@ -134,6 +134,9 @@ enum { | |||
| 134 | 134 | ||
| 135 | #define mac_nsctfont_copy_font_descriptor CTFontCopyFontDescriptor | 135 | #define mac_nsctfont_copy_font_descriptor CTFontCopyFontDescriptor |
| 136 | 136 | ||
| 137 | #ifndef kCTVersionNumber10_9 | ||
| 138 | #define kCTVersionNumber10_9 0x00060000 | ||
| 139 | #endif | ||
| 137 | #define MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE \ | 140 | #define MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE \ |
| 138 | (CFSTR ("MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE")) | 141 | (CFSTR ("MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE")) |
| 139 | 142 | ||
diff --git a/src/macfont.m b/src/macfont.m index b3bf96d8c4e..10623eb12fe 100644 --- a/src/macfont.m +++ b/src/macfont.m | |||
| @@ -57,6 +57,13 @@ static Boolean mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef, | |||
| 57 | static CFStringRef mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef); | 57 | static CFStringRef mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef); |
| 58 | static CFIndex mac_ctfont_shape (CTFontRef, CFStringRef, | 58 | static CFIndex mac_ctfont_shape (CTFontRef, CFStringRef, |
| 59 | struct mac_glyph_layout *, CFIndex); | 59 | struct mac_glyph_layout *, CFIndex); |
| 60 | static CFArrayRef | ||
| 61 | mac_font_copy_default_descriptors_for_language (CFStringRef language); | ||
| 62 | |||
| 63 | static CFStringRef | ||
| 64 | mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, | ||
| 65 | CFArrayRef languages); | ||
| 66 | |||
| 60 | #if USE_CT_GLYPH_INFO | 67 | #if USE_CT_GLYPH_INFO |
| 61 | static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, | 68 | static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, |
| 62 | CTCharacterCollection, | 69 | CTCharacterCollection, |
| @@ -64,7 +71,7 @@ static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, | |||
| 64 | #endif | 71 | #endif |
| 65 | 72 | ||
| 66 | /* The font property key specifying the font design destination. The | 73 | /* The font property key specifying the font design destination. The |
| 67 | value is an unsigned integer code: 0 for WYSIWIG, and 1 for Video | 74 | value is an unsigned integer code: 0 for WYSIWYG, and 1 for Video |
| 68 | text. (See the documentation of X Logical Font Description | 75 | text. (See the documentation of X Logical Font Description |
| 69 | Conventions.) In the Mac font driver, 1 means the screen font is | 76 | Conventions.) In the Mac font driver, 1 means the screen font is |
| 70 | used for calculating some glyph metrics. You can see the | 77 | used for calculating some glyph metrics. You can see the |
| @@ -366,7 +373,7 @@ mac_font_shape_1 (NSFont *font, NSString *string, | |||
| 366 | if (!(textStorage && layoutManager && textContainer)) | 373 | if (!(textStorage && layoutManager && textContainer)) |
| 367 | { | 374 | { |
| 368 | [textStorage release]; | 375 | [textStorage release]; |
| 369 | 376 | ||
| 370 | return 0; | 377 | return 0; |
| 371 | } | 378 | } |
| 372 | 379 | ||
| @@ -624,19 +631,26 @@ get_cgcolor(unsigned long idx, struct frame *f) | |||
| 624 | } | 631 | } |
| 625 | 632 | ||
| 626 | #define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, s) \ | 633 | #define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, s) \ |
| 627 | CGContextSetFillColorWithColor (context, \ | 634 | do { \ |
| 628 | get_cgcolor (NS_FACE_FOREGROUND (s->face), \ | 635 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face), \ |
| 629 | s->f)) | 636 | s->f); \ |
| 630 | 637 | CGContextSetFillColorWithColor (context, refcol_) ; \ | |
| 638 | CGColorRelease (refcol_); \ | ||
| 639 | } while (0) | ||
| 631 | #define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, s) \ | 640 | #define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, s) \ |
| 632 | CGContextSetFillColorWithColor (context, \ | 641 | do { \ |
| 633 | get_cgcolor (NS_FACE_BACKGROUND (s->face), \ | 642 | CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (s->face),\ |
| 634 | s->f)) | 643 | s->f); \ |
| 635 | 644 | CGContextSetFillColorWithColor (context, refcol_); \ | |
| 645 | CGColorRelease (refcol_); \ | ||
| 646 | } while (0) | ||
| 636 | #define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, s) \ | 647 | #define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, s) \ |
| 637 | CGContextSetStrokeColorWithColor (context, \ | 648 | do { \ |
| 638 | get_cgcolor (NS_FACE_FOREGROUND (s->face),\ | 649 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face),\ |
| 639 | s->f)) | 650 | s->f); \ |
| 651 | CGContextSetStrokeColorWithColor (context, refcol_); \ | ||
| 652 | CGColorRelease (refcol_); \ | ||
| 653 | } while (0) | ||
| 640 | 654 | ||
| 641 | 655 | ||
| 642 | /* Mac font driver. */ | 656 | /* Mac font driver. */ |
| @@ -669,7 +683,7 @@ static struct | |||
| 669 | { "iso8859-15", { 0x00A0, 0x00A1, 0x00D0, 0x0152 }}, | 683 | { "iso8859-15", { 0x00A0, 0x00A1, 0x00D0, 0x0152 }}, |
| 670 | { "iso8859-16", { 0x00A0, 0x0218}}, | 684 | { "iso8859-16", { 0x00A0, 0x0218}}, |
| 671 | { "gb2312.1980-0", { 0x4E13 }, CFSTR ("zh-Hans")}, | 685 | { "gb2312.1980-0", { 0x4E13 }, CFSTR ("zh-Hans")}, |
| 672 | { "big5-0", { /* 0xF6B1 in ftfont.c */ 0xF7E5 }, CFSTR ("zh-Hant") }, | 686 | { "big5-0", { /* 0xF6B1 in ftfont.c */ 0x4EDC }, CFSTR ("zh-Hant") }, |
| 673 | { "jisx0208.1983-0", { 0x4E55 }, CFSTR ("ja")}, | 687 | { "jisx0208.1983-0", { 0x4E55 }, CFSTR ("ja")}, |
| 674 | { "ksc5601.1987-0", { 0xAC00 }, CFSTR ("ko")}, | 688 | { "ksc5601.1987-0", { 0xAC00 }, CFSTR ("ko")}, |
| 675 | { "cns11643.1992-1", { 0xFE32 }, CFSTR ("zh-Hant")}, | 689 | { "cns11643.1992-1", { 0xFE32 }, CFSTR ("zh-Hant")}, |
| @@ -693,9 +707,31 @@ static struct | |||
| 693 | { NULL } | 707 | { NULL } |
| 694 | }; | 708 | }; |
| 695 | 709 | ||
| 710 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 | ||
| 711 | static const struct | ||
| 712 | { | ||
| 713 | CFStringRef language; | ||
| 714 | CFStringRef font_names[3]; | ||
| 715 | } macfont_language_default_font_names[] = { | ||
| 716 | { CFSTR ("ja"), { CFSTR ("HiraKakuProN-W3"), /* 10.5 - 10.9 */ | ||
| 717 | CFSTR ("HiraKakuPro-W3"), /* 10.4 */ | ||
| 718 | NULL }}, | ||
| 719 | { CFSTR ("ko"), { CFSTR ("AppleSDGothicNeo-Regular"), /* 10.8 - 10.9 */ | ||
| 720 | CFSTR ("AppleGothic"), /* 10.4 - 10.7 */ | ||
| 721 | NULL }}, | ||
| 722 | { CFSTR ("zh-Hans"), { CFSTR ("STHeitiSC-Light"), /* 10.6 - 10.9 */ | ||
| 723 | CFSTR ("STXihei"), /* 10.4 - 10.5 */ | ||
| 724 | NULL }}, | ||
| 725 | { CFSTR ("zh-Hant"), { CFSTR ("STHeitiTC-Light"), /* 10.6 - 10.9 */ | ||
| 726 | CFSTR ("LiHeiPro"), /* 10.4 - 10.5 */ | ||
| 727 | NULL }}, | ||
| 728 | { NULL } | ||
| 729 | }; | ||
| 730 | #endif | ||
| 731 | |||
| 696 | static CGFloat macfont_antialias_threshold; | 732 | static CGFloat macfont_antialias_threshold; |
| 697 | 733 | ||
| 698 | void | 734 | static void |
| 699 | macfont_update_antialias_threshold (void) | 735 | macfont_update_antialias_threshold (void) |
| 700 | { | 736 | { |
| 701 | int threshold; | 737 | int threshold; |
| @@ -1159,7 +1195,7 @@ struct macfont_cache | |||
| 1159 | 1195 | ||
| 1160 | /* The cached glyph for a character c is stored as the (c % | 1196 | /* The cached glyph for a character c is stored as the (c % |
| 1161 | NGLYPHS_IN_VALUE)-th CGGlyph block of a value for the key (c / | 1197 | NGLYPHS_IN_VALUE)-th CGGlyph block of a value for the key (c / |
| 1162 | NGLYPHS_IN_VALUE). However, the glyph for a BMP characrer c is | 1198 | NGLYPHS_IN_VALUE). However, the glyph for a BMP character c is |
| 1163 | not stored here if row_nkeys_or_perm[c / 256] >= | 1199 | not stored here if row_nkeys_or_perm[c / 256] >= |
| 1164 | ROW_PERM_OFFSET. */ | 1200 | ROW_PERM_OFFSET. */ |
| 1165 | CFMutableDictionaryRef dictionary; | 1201 | CFMutableDictionaryRef dictionary; |
| @@ -1518,7 +1554,7 @@ static Lisp_Object macfont_match (struct frame *, Lisp_Object); | |||
| 1518 | static Lisp_Object macfont_list_family (struct frame *); | 1554 | static Lisp_Object macfont_list_family (struct frame *); |
| 1519 | static void macfont_free_entity (Lisp_Object); | 1555 | static void macfont_free_entity (Lisp_Object); |
| 1520 | static Lisp_Object macfont_open (struct frame *, Lisp_Object, int); | 1556 | static Lisp_Object macfont_open (struct frame *, Lisp_Object, int); |
| 1521 | static void macfont_close (struct frame *, struct font *); | 1557 | static void macfont_close (struct font *); |
| 1522 | static int macfont_has_char (Lisp_Object, int); | 1558 | static int macfont_has_char (Lisp_Object, int); |
| 1523 | static unsigned macfont_encode_char (struct font *, int); | 1559 | static unsigned macfont_encode_char (struct font *, int); |
| 1524 | static int macfont_text_extents (struct font *, unsigned int *, int, | 1560 | static int macfont_text_extents (struct font *, unsigned int *, int, |
| @@ -2045,33 +2081,7 @@ macfont_list (struct frame *f, Lisp_Object spec) | |||
| 2045 | if (! attributes) | 2081 | if (! attributes) |
| 2046 | goto finish; | 2082 | goto finish; |
| 2047 | 2083 | ||
| 2048 | charset = ((CFCharacterSetRef) | 2084 | languages = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); |
| 2049 | CFDictionaryGetValue (attributes, | ||
| 2050 | MAC_FONT_CHARACTER_SET_ATTRIBUTE)); | ||
| 2051 | if (charset) | ||
| 2052 | { | ||
| 2053 | CFRetain (charset); | ||
| 2054 | CFDictionaryRemoveValue (attributes, MAC_FONT_CHARACTER_SET_ATTRIBUTE); | ||
| 2055 | } | ||
| 2056 | else | ||
| 2057 | { | ||
| 2058 | val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX)); | ||
| 2059 | if (! NILP (val)) | ||
| 2060 | { | ||
| 2061 | val = assq_no_quit (XCDR (val), Vscript_representative_chars); | ||
| 2062 | if (CONSP (val) && VECTORP (XCDR (val))) | ||
| 2063 | chars = XCDR (val); | ||
| 2064 | } | ||
| 2065 | val = Qnil; | ||
| 2066 | } | ||
| 2067 | |||
| 2068 | languages = ((CFArrayRef) | ||
| 2069 | CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE)); | ||
| 2070 | if (languages) | ||
| 2071 | { | ||
| 2072 | CFRetain (languages); | ||
| 2073 | CFDictionaryRemoveValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); | ||
| 2074 | } | ||
| 2075 | 2085 | ||
| 2076 | if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) | 2086 | if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) |
| 2077 | spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); | 2087 | spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); |
| @@ -2155,6 +2165,31 @@ macfont_list (struct frame *f, Lisp_Object spec) | |||
| 2155 | } | 2165 | } |
| 2156 | } | 2166 | } |
| 2157 | 2167 | ||
| 2168 | charset = CFDictionaryGetValue (attributes, | ||
| 2169 | MAC_FONT_CHARACTER_SET_ATTRIBUTE); | ||
| 2170 | if (charset) | ||
| 2171 | { | ||
| 2172 | CFRetain (charset); | ||
| 2173 | CFDictionaryRemoveValue (attributes, MAC_FONT_CHARACTER_SET_ATTRIBUTE); | ||
| 2174 | } | ||
| 2175 | else | ||
| 2176 | { | ||
| 2177 | val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX)); | ||
| 2178 | if (! NILP (val)) | ||
| 2179 | { | ||
| 2180 | val = assq_no_quit (XCDR (val), Vscript_representative_chars); | ||
| 2181 | if (CONSP (val) && VECTORP (XCDR (val))) | ||
| 2182 | chars = XCDR (val); | ||
| 2183 | } | ||
| 2184 | val = Qnil; | ||
| 2185 | } | ||
| 2186 | |||
| 2187 | if (languages) | ||
| 2188 | { | ||
| 2189 | CFRetain (languages); | ||
| 2190 | CFDictionaryRemoveValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); | ||
| 2191 | } | ||
| 2192 | |||
| 2158 | val = Qnil; | 2193 | val = Qnil; |
| 2159 | extra = AREF (spec, FONT_EXTRA_INDEX); | 2194 | extra = AREF (spec, FONT_EXTRA_INDEX); |
| 2160 | families_count = CFArrayGetCount (families); | 2195 | families_count = CFArrayGetCount (families); |
| @@ -2465,7 +2500,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) | |||
| 2465 | macfont_info = (struct macfont_info *) font; | 2500 | macfont_info = (struct macfont_info *) font; |
| 2466 | macfont_info->macfont = macfont; | 2501 | macfont_info->macfont = macfont; |
| 2467 | macfont_info->cgfont = mac_font_copy_graphics_font (macfont); | 2502 | macfont_info->cgfont = mac_font_copy_graphics_font (macfont); |
| 2468 | 2503 | ||
| 2469 | val = assq_no_quit (QCdestination, AREF (entity, FONT_EXTRA_INDEX)); | 2504 | val = assq_no_quit (QCdestination, AREF (entity, FONT_EXTRA_INDEX)); |
| 2470 | if (CONSP (val) && EQ (XCDR (val), make_number (1))) | 2505 | if (CONSP (val) && EQ (XCDR (val), make_number (1))) |
| 2471 | macfont_info->screen_font = mac_screen_font_create_with_name (font_name, | 2506 | macfont_info->screen_font = mac_screen_font_create_with_name (font_name, |
| @@ -2580,7 +2615,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) | |||
| 2580 | } | 2615 | } |
| 2581 | 2616 | ||
| 2582 | static void | 2617 | static void |
| 2583 | macfont_close (struct frame * f, struct font *font) | 2618 | macfont_close (struct font *font) |
| 2584 | { | 2619 | { |
| 2585 | struct macfont_info *macfont_info = (struct macfont_info *) font; | 2620 | struct macfont_info *macfont_info = (struct macfont_info *) font; |
| 2586 | int i; | 2621 | int i; |
| @@ -2667,7 +2702,7 @@ macfont_text_extents (struct font *font, unsigned int *code, int nglyphs, | |||
| 2667 | } | 2702 | } |
| 2668 | unblock_input (); | 2703 | unblock_input (); |
| 2669 | 2704 | ||
| 2670 | if (metrics) | 2705 | if (metrics) |
| 2671 | metrics->width = width; | 2706 | metrics->width = width; |
| 2672 | 2707 | ||
| 2673 | return width; | 2708 | return width; |
| @@ -2729,7 +2764,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2729 | for (i = 0; i < len; i++) | 2764 | for (i = 0; i < len; i++) |
| 2730 | { | 2765 | { |
| 2731 | int width; | 2766 | int width; |
| 2732 | 2767 | ||
| 2733 | glyphs[i] = *(s->char2b + s->cmp_from + i); | 2768 | glyphs[i] = *(s->char2b + s->cmp_from + i); |
| 2734 | width = (s->padding_p ? 1 | 2769 | width = (s->padding_p ? 1 |
| 2735 | : macfont_glyph_extents (s->font, glyphs[i], | 2770 | : macfont_glyph_extents (s->font, glyphs[i], |
| @@ -2786,7 +2821,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2786 | return len; | 2821 | return len; |
| 2787 | } | 2822 | } |
| 2788 | 2823 | ||
| 2789 | Lisp_Object | 2824 | static Lisp_Object |
| 2790 | macfont_shape (Lisp_Object lgstring) | 2825 | macfont_shape (Lisp_Object lgstring) |
| 2791 | { | 2826 | { |
| 2792 | struct font *font; | 2827 | struct font *font; |
| @@ -2989,7 +3024,7 @@ struct non_default_uvs_table | |||
| 2989 | #define BUINT32_VALUE(lval) OSReadBigInt32 (&(lval), 0) | 3024 | #define BUINT32_VALUE(lval) OSReadBigInt32 (&(lval), 0) |
| 2990 | 3025 | ||
| 2991 | /* Return UVS subtable for the specified FONT. If the subtable is not | 3026 | /* Return UVS subtable for the specified FONT. If the subtable is not |
| 2992 | found or ill-formated, then return NULL. */ | 3027 | found or ill-formatted, then return NULL. */ |
| 2993 | 3028 | ||
| 2994 | static CFDataRef | 3029 | static CFDataRef |
| 2995 | mac_font_copy_uvs_table (FontRef font) | 3030 | mac_font_copy_uvs_table (FontRef font) |
| @@ -3323,49 +3358,80 @@ mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) | |||
| 3323 | 3358 | ||
| 3324 | if (charset_string && CFStringGetLength (charset_string) > 0) | 3359 | if (charset_string && CFStringGetLength (charset_string) > 0) |
| 3325 | { | 3360 | { |
| 3326 | CFAttributedStringRef attr_string = NULL; | 3361 | CFStringRef keys[] = { |
| 3327 | CTLineRef ctline = NULL; | 3362 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 |
| 3328 | CFDictionaryRef attrs = | 3363 | kCTLanguageAttributeName |
| 3329 | CFDictionaryCreate (NULL, NULL, NULL, 0, | 3364 | #else |
| 3330 | &kCFTypeDictionaryKeyCallBacks, | 3365 | CFSTR ("NSLanguage") |
| 3331 | &kCFTypeDictionaryValueCallBacks); | 3366 | #endif |
| 3367 | }; | ||
| 3368 | CFTypeRef values[] = {NULL}; | ||
| 3369 | CFIndex num_values = 0; | ||
| 3370 | CFArrayRef languages | ||
| 3371 | = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); | ||
| 3332 | 3372 | ||
| 3333 | if (attrs) | 3373 | if (languages && CFArrayGetCount (languages) > 0) |
| 3334 | { | ||
| 3335 | attr_string = CFAttributedStringCreate (NULL, charset_string, attrs); | ||
| 3336 | CFRelease (attrs); | ||
| 3337 | } | ||
| 3338 | if (attr_string) | ||
| 3339 | { | 3374 | { |
| 3340 | ctline = CTLineCreateWithAttributedString (attr_string); | 3375 | if (CTGetCoreTextVersion () >= kCTVersionNumber10_9) |
| 3341 | CFRelease (attr_string); | 3376 | values[num_values++] = CFArrayGetValueAtIndex (languages, 0); |
| 3377 | else | ||
| 3378 | { | ||
| 3379 | CFCharacterSetRef charset = | ||
| 3380 | CFDictionaryGetValue (attributes, | ||
| 3381 | MAC_FONT_CHARACTER_SET_ATTRIBUTE); | ||
| 3382 | |||
| 3383 | result = mac_font_copy_default_name_for_charset_and_languages (charset, languages); | ||
| 3384 | } | ||
| 3342 | } | 3385 | } |
| 3343 | if (ctline) | 3386 | if (result == NULL) |
| 3344 | { | 3387 | { |
| 3345 | CFArrayRef runs = CTLineGetGlyphRuns (ctline); | 3388 | CFAttributedStringRef attr_string = NULL; |
| 3346 | CFIndex i, nruns = CFArrayGetCount (runs); | 3389 | CTLineRef ctline = NULL; |
| 3347 | CTFontRef font; | 3390 | CFDictionaryRef attrs |
| 3348 | 3391 | = CFDictionaryCreate (NULL, (const void **) keys, | |
| 3349 | for (i = 0; i < nruns; i++) | 3392 | (const void **) values, num_values, |
| 3393 | &kCFTypeDictionaryKeyCallBacks, | ||
| 3394 | &kCFTypeDictionaryValueCallBacks); | ||
| 3395 | |||
| 3396 | if (attrs) | ||
| 3350 | { | 3397 | { |
| 3351 | CTRunRef run = CFArrayGetValueAtIndex (runs, i); | 3398 | attr_string = CFAttributedStringCreate (NULL, charset_string, |
| 3352 | CFDictionaryRef attributes = CTRunGetAttributes (run); | 3399 | attrs); |
| 3353 | CTFontRef font_in_run; | 3400 | CFRelease (attrs); |
| 3401 | } | ||
| 3402 | if (attr_string) | ||
| 3403 | { | ||
| 3404 | ctline = CTLineCreateWithAttributedString (attr_string); | ||
| 3405 | CFRelease (attr_string); | ||
| 3406 | } | ||
| 3407 | if (ctline) | ||
| 3408 | { | ||
| 3409 | CFArrayRef runs = CTLineGetGlyphRuns (ctline); | ||
| 3410 | CFIndex i, nruns = CFArrayGetCount (runs); | ||
| 3411 | CTFontRef font; | ||
| 3354 | 3412 | ||
| 3355 | if (attributes == NULL) | 3413 | for (i = 0; i < nruns; i++) |
| 3356 | break; | 3414 | { |
| 3357 | font_in_run = | 3415 | CTRunRef run = CFArrayGetValueAtIndex (runs, i); |
| 3358 | CFDictionaryGetValue (attributes, kCTFontAttributeName); | 3416 | CFDictionaryRef attributes = CTRunGetAttributes (run); |
| 3359 | if (font_in_run == NULL) | 3417 | CTFontRef font_in_run; |
| 3360 | break; | 3418 | |
| 3361 | if (i == 0) | 3419 | if (attributes == NULL) |
| 3362 | font = font_in_run; | 3420 | break; |
| 3363 | else if (!mac_ctfont_equal_in_postscript_name (font, font_in_run)) | 3421 | font_in_run = |
| 3364 | break; | 3422 | CFDictionaryGetValue (attributes, kCTFontAttributeName); |
| 3423 | if (font_in_run == NULL) | ||
| 3424 | break; | ||
| 3425 | if (i == 0) | ||
| 3426 | font = font_in_run; | ||
| 3427 | else if (!mac_ctfont_equal_in_postscript_name (font, | ||
| 3428 | font_in_run)) | ||
| 3429 | break; | ||
| 3430 | } | ||
| 3431 | if (nruns > 0 && i == nruns) | ||
| 3432 | result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute); | ||
| 3433 | CFRelease (ctline); | ||
| 3365 | } | 3434 | } |
| 3366 | if (nruns > 0 && i == nruns) | ||
| 3367 | result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute); | ||
| 3368 | CFRelease (ctline); | ||
| 3369 | } | 3435 | } |
| 3370 | } | 3436 | } |
| 3371 | 3437 | ||
| @@ -3559,7 +3625,7 @@ mac_ctfont_create_line_with_string_and_font (CFStringRef string, | |||
| 3559 | return ctline; | 3625 | return ctline; |
| 3560 | } | 3626 | } |
| 3561 | 3627 | ||
| 3562 | CFIndex | 3628 | static CFIndex |
| 3563 | mac_ctfont_shape (CTFontRef font, CFStringRef string, | 3629 | mac_ctfont_shape (CTFontRef font, CFStringRef string, |
| 3564 | struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) | 3630 | struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) |
| 3565 | { | 3631 | { |
| @@ -3712,7 +3778,7 @@ mac_ctfont_shape (CTFontRef font, CFStringRef string, | |||
| 3712 | created by CFStringCreateWithCharacters as of Mac OS X 10.5.8 and | 3778 | created by CFStringCreateWithCharacters as of Mac OS X 10.5.8 and |
| 3713 | 10.6.3. For now, we use the NSGlyphInfo version instead. */ | 3779 | 10.6.3. For now, we use the NSGlyphInfo version instead. */ |
| 3714 | #if USE_CT_GLYPH_INFO | 3780 | #if USE_CT_GLYPH_INFO |
| 3715 | CGGlyph | 3781 | static CGGlyph |
| 3716 | mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, | 3782 | mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, |
| 3717 | CGFontIndex cid) | 3783 | CGFontIndex cid) |
| 3718 | { | 3784 | { |
| @@ -3805,7 +3871,7 @@ mac_font_family_group (CFStringRef family) | |||
| 3805 | } | 3871 | } |
| 3806 | } | 3872 | } |
| 3807 | 3873 | ||
| 3808 | CFComparisonResult | 3874 | static CFComparisonResult |
| 3809 | mac_font_family_compare (const void *val1, const void *val2, void *context) | 3875 | mac_font_family_compare (const void *val1, const void *val2, void *context) |
| 3810 | { | 3876 | { |
| 3811 | CFStringRef family1 = (CFStringRef) val1, family2 = (CFStringRef) val2; | 3877 | CFStringRef family1 = (CFStringRef) val1, family2 = (CFStringRef) val2; |
| @@ -3821,6 +3887,142 @@ mac_font_family_compare (const void *val1, const void *val2, void *context) | |||
| 3821 | } | 3887 | } |
| 3822 | #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ | 3888 | #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ |
| 3823 | 3889 | ||
| 3890 | static CFArrayRef | ||
| 3891 | mac_font_copy_default_descriptors_for_language (CFStringRef language) | ||
| 3892 | { | ||
| 3893 | CFArrayRef result = NULL; | ||
| 3894 | |||
| 3895 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 | ||
| 3896 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 | ||
| 3897 | if (CTFontCopyDefaultCascadeListForLanguages != NULL) | ||
| 3898 | #endif | ||
| 3899 | { | ||
| 3900 | CTFontRef user_font = | ||
| 3901 | CTFontCreateUIFontForLanguage (kCTFontUserFontType, 0, language); | ||
| 3902 | |||
| 3903 | if (user_font) | ||
| 3904 | { | ||
| 3905 | CFArrayRef languages = | ||
| 3906 | CFArrayCreate (NULL, (const void **) &language, 1, | ||
| 3907 | &kCFTypeArrayCallBacks); | ||
| 3908 | |||
| 3909 | if (languages) | ||
| 3910 | { | ||
| 3911 | result = CTFontCopyDefaultCascadeListForLanguages (user_font, | ||
| 3912 | languages); | ||
| 3913 | CFRelease (languages); | ||
| 3914 | } | ||
| 3915 | CFRelease (user_font); | ||
| 3916 | } | ||
| 3917 | } | ||
| 3918 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 | ||
| 3919 | else /* CTFontCopyDefaultCascadeListForLanguages == NULL */ | ||
| 3920 | #endif | ||
| 3921 | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 */ | ||
| 3922 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 | ||
| 3923 | { | ||
| 3924 | CFIndex i; | ||
| 3925 | |||
| 3926 | for (i = 0; macfont_language_default_font_names[i].language; i++) | ||
| 3927 | { | ||
| 3928 | if (CFStringCompare (macfont_language_default_font_names[i].language, | ||
| 3929 | language, 0) == kCFCompareEqualTo) | ||
| 3930 | { | ||
| 3931 | CFMutableArrayRef descriptors = | ||
| 3932 | CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); | ||
| 3933 | |||
| 3934 | if (descriptors) | ||
| 3935 | { | ||
| 3936 | CFIndex j; | ||
| 3937 | |||
| 3938 | for (j = 0; | ||
| 3939 | macfont_language_default_font_names[i].font_names[j]; | ||
| 3940 | j++) | ||
| 3941 | { | ||
| 3942 | CFDictionaryRef attributes = | ||
| 3943 | CFDictionaryCreate (NULL, | ||
| 3944 | ((const void **) | ||
| 3945 | &MAC_FONT_NAME_ATTRIBUTE), | ||
| 3946 | ((const void **) | ||
| 3947 | &macfont_language_default_font_names[i].font_names[j]), | ||
| 3948 | 1, &kCFTypeDictionaryKeyCallBacks, | ||
| 3949 | &kCFTypeDictionaryValueCallBacks); | ||
| 3950 | |||
| 3951 | if (attributes) | ||
| 3952 | { | ||
| 3953 | FontDescriptorRef pat_desc = | ||
| 3954 | mac_font_descriptor_create_with_attributes (attributes); | ||
| 3955 | |||
| 3956 | if (pat_desc) | ||
| 3957 | { | ||
| 3958 | FontDescriptorRef descriptor = | ||
| 3959 | mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL); | ||
| 3960 | |||
| 3961 | if (descriptor) | ||
| 3962 | { | ||
| 3963 | CFArrayAppendValue (descriptors, descriptor); | ||
| 3964 | CFRelease (descriptor); | ||
| 3965 | } | ||
| 3966 | CFRelease (pat_desc); | ||
| 3967 | } | ||
| 3968 | CFRelease (attributes); | ||
| 3969 | } | ||
| 3970 | } | ||
| 3971 | result = descriptors; | ||
| 3972 | } | ||
| 3973 | break; | ||
| 3974 | } | ||
| 3975 | } | ||
| 3976 | } | ||
| 3977 | #endif | ||
| 3978 | |||
| 3979 | return result; | ||
| 3980 | } | ||
| 3981 | |||
| 3982 | static CFStringRef | ||
| 3983 | mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, | ||
| 3984 | CFArrayRef languages) | ||
| 3985 | { | ||
| 3986 | CFStringRef result = NULL; | ||
| 3987 | CFStringRef language = CFArrayGetValueAtIndex (languages, 0); | ||
| 3988 | CFArrayRef descriptors = | ||
| 3989 | mac_font_copy_default_descriptors_for_language (language); | ||
| 3990 | |||
| 3991 | if (descriptors) | ||
| 3992 | { | ||
| 3993 | CFIndex i, count = CFArrayGetCount (descriptors); | ||
| 3994 | |||
| 3995 | for (i = 0; i < count; i++) | ||
| 3996 | { | ||
| 3997 | FontDescriptorRef descriptor = | ||
| 3998 | CFArrayGetValueAtIndex (descriptors, i); | ||
| 3999 | |||
| 4000 | if (macfont_supports_charset_and_languages_p (descriptor, charset, | ||
| 4001 | Qnil, languages)) | ||
| 4002 | { | ||
| 4003 | CFStringRef family = | ||
| 4004 | mac_font_descriptor_copy_attribute (descriptor, | ||
| 4005 | MAC_FONT_FAMILY_NAME_ATTRIBUTE); | ||
| 4006 | if (family) | ||
| 4007 | { | ||
| 4008 | if (!CFStringHasPrefix (family, CFSTR (".")) | ||
| 4009 | && (CFStringCompare (family, CFSTR ("LastResort"), 0) | ||
| 4010 | != kCFCompareEqualTo)) | ||
| 4011 | { | ||
| 4012 | result = family; | ||
| 4013 | break; | ||
| 4014 | } | ||
| 4015 | else | ||
| 4016 | CFRelease (family); | ||
| 4017 | } | ||
| 4018 | } | ||
| 4019 | } | ||
| 4020 | CFRelease (descriptors); | ||
| 4021 | } | ||
| 4022 | |||
| 4023 | return result; | ||
| 4024 | } | ||
| 4025 | |||
| 3824 | void * | 4026 | void * |
| 3825 | macfont_get_nsctfont (struct font *font) | 4027 | macfont_get_nsctfont (struct font *font) |
| 3826 | { | 4028 | { |
diff --git a/src/macros.c b/src/macros.c index 0c11efcdc9a..232188a408b 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -55,7 +55,7 @@ Use \\[name-last-kbd-macro] to give it a permanent name. | |||
| 55 | Non-nil arg (prefix arg) means append to last macro defined; | 55 | Non-nil arg (prefix arg) means append to last macro defined; |
| 56 | this begins by re-executing that macro as if you typed it again. | 56 | this begins by re-executing that macro as if you typed it again. |
| 57 | If optional second arg, NO-EXEC, is non-nil, do not re-execute last | 57 | If optional second arg, NO-EXEC, is non-nil, do not re-execute last |
| 58 | macro before appending to it. */) | 58 | macro before appending to it. */) |
| 59 | (Lisp_Object append, Lisp_Object no_exec) | 59 | (Lisp_Object append, Lisp_Object no_exec) |
| 60 | { | 60 | { |
| 61 | if (!NILP (KVAR (current_kboard, defining_kbd_macro))) | 61 | if (!NILP (KVAR (current_kboard, defining_kbd_macro))) |
| @@ -66,7 +66,7 @@ macro before appending to it. */) | |||
| 66 | current_kboard->kbd_macro_buffer = xmalloc (30 * word_size); | 66 | current_kboard->kbd_macro_buffer = xmalloc (30 * word_size); |
| 67 | current_kboard->kbd_macro_bufsize = 30; | 67 | current_kboard->kbd_macro_bufsize = 30; |
| 68 | } | 68 | } |
| 69 | update_mode_lines++; | 69 | update_mode_lines = 19; |
| 70 | if (NILP (append)) | 70 | if (NILP (append)) |
| 71 | { | 71 | { |
| 72 | if (current_kboard->kbd_macro_bufsize > 200) | 72 | if (current_kboard->kbd_macro_bufsize > 200) |
| @@ -138,7 +138,7 @@ void | |||
| 138 | end_kbd_macro (void) | 138 | end_kbd_macro (void) |
| 139 | { | 139 | { |
| 140 | kset_defining_kbd_macro (current_kboard, Qnil); | 140 | kset_defining_kbd_macro (current_kboard, Qnil); |
| 141 | update_mode_lines++; | 141 | update_mode_lines = 20; |
| 142 | kset_last_kbd_macro | 142 | kset_last_kbd_macro |
| 143 | (current_kboard, | 143 | (current_kboard, |
| 144 | make_event_array ((current_kboard->kbd_macro_end | 144 | make_event_array ((current_kboard->kbd_macro_end |
diff --git a/src/menu.h b/src/menu.h index 17d66290647..cd89f5eecea 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -51,7 +51,7 @@ extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool, | |||
| 51 | Lisp_Object, const char **); | 51 | Lisp_Object, const char **); |
| 52 | extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, | 52 | extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, |
| 53 | Lisp_Object, const char **); | 53 | Lisp_Object, const char **); |
| 54 | extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int, | 54 | extern Lisp_Object tty_menu_show (struct frame *, int, int, bool, bool, |
| 55 | Lisp_Object, int, const char **); | 55 | Lisp_Object, bool, const char **); |
| 56 | extern ptrdiff_t menu_item_width (const unsigned char *); | 56 | extern ptrdiff_t menu_item_width (const unsigned char *); |
| 57 | #endif /* MENU_H */ | 57 | #endif /* MENU_H */ |
diff --git a/src/minibuf.c b/src/minibuf.c index cc6f234f7da..8eb1a2890e0 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -866,7 +866,7 @@ read_minibuf_unwind (void) | |||
| 866 | resize_mini_window (XWINDOW (window), 0); | 866 | resize_mini_window (XWINDOW (window), 0); |
| 867 | 867 | ||
| 868 | /* Enforce full redisplay. FIXME: make it more selective. */ | 868 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 869 | windows_or_buffers_changed++; | 869 | windows_or_buffers_changed = 22; |
| 870 | 870 | ||
| 871 | /* In case the previous minibuffer displayed in this miniwindow is | 871 | /* In case the previous minibuffer displayed in this miniwindow is |
| 872 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, | 872 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, |
| @@ -1199,9 +1199,7 @@ is used to further constrain the set of candidates. */) | |||
| 1199 | type = (HASH_TABLE_P (collection) ? hash_table | 1199 | type = (HASH_TABLE_P (collection) ? hash_table |
| 1200 | : VECTORP (collection) ? obarray_table | 1200 | : VECTORP (collection) ? obarray_table |
| 1201 | : ((NILP (collection) | 1201 | : ((NILP (collection) |
| 1202 | || (CONSP (collection) | 1202 | || (CONSP (collection) && !FUNCTIONP (collection))) |
| 1203 | && (!SYMBOLP (XCAR (collection)) | ||
| 1204 | || NILP (XCAR (collection))))) | ||
| 1205 | ? list_table : function_table)); | 1203 | ? list_table : function_table)); |
| 1206 | ptrdiff_t idx = 0, obsize = 0; | 1204 | ptrdiff_t idx = 0, obsize = 0; |
| 1207 | int matchcount = 0; | 1205 | int matchcount = 0; |
| @@ -1460,9 +1458,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1460 | Lisp_Object allmatches; | 1458 | Lisp_Object allmatches; |
| 1461 | int type = HASH_TABLE_P (collection) ? 3 | 1459 | int type = HASH_TABLE_P (collection) ? 3 |
| 1462 | : VECTORP (collection) ? 2 | 1460 | : VECTORP (collection) ? 2 |
| 1463 | : NILP (collection) || (CONSP (collection) | 1461 | : NILP (collection) || (CONSP (collection) && !FUNCTIONP (collection)); |
| 1464 | && (!SYMBOLP (XCAR (collection)) | ||
| 1465 | || NILP (XCAR (collection)))); | ||
| 1466 | ptrdiff_t idx = 0, obsize = 0; | 1462 | ptrdiff_t idx = 0, obsize = 0; |
| 1467 | ptrdiff_t bindcount = -1; | 1463 | ptrdiff_t bindcount = -1; |
| 1468 | Lisp_Object bucket, tem, zero; | 1464 | Lisp_Object bucket, tem, zero; |
| @@ -1691,9 +1687,7 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1691 | 1687 | ||
| 1692 | CHECK_STRING (string); | 1688 | CHECK_STRING (string); |
| 1693 | 1689 | ||
| 1694 | if ((CONSP (collection) | 1690 | if (NILP (collection) || (CONSP (collection) && !FUNCTIONP (collection))) |
| 1695 | && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection)))) | ||
| 1696 | || NILP (collection)) | ||
| 1697 | { | 1691 | { |
| 1698 | tem = Fassoc_string (string, collection, completion_ignore_case ? Qt : Qnil); | 1692 | tem = Fassoc_string (string, collection, completion_ignore_case ? Qt : Qnil); |
| 1699 | if (NILP (tem)) | 1693 | if (NILP (tem)) |
diff --git a/src/msdos.c b/src/msdos.c index cb4f8c3df89..b778245a7be 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -2387,7 +2387,7 @@ Each input key receives two values in this vector: first the ASCII code, | |||
| 2387 | and then the scan code. */) | 2387 | and then the scan code. */) |
| 2388 | (void) | 2388 | (void) |
| 2389 | { | 2389 | { |
| 2390 | Lisp_Object val, *keys = XVECTOR (recent_doskeys)->u.contents; | 2390 | Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents; |
| 2391 | 2391 | ||
| 2392 | if (total_doskeys < NUM_RECENT_DOSKEYS) | 2392 | if (total_doskeys < NUM_RECENT_DOSKEYS) |
| 2393 | return Fvector (total_doskeys, keys); | 2393 | return Fvector (total_doskeys, keys); |
diff --git a/src/nsfns.m b/src/nsfns.m index 011edf38cef..ee6020f2b43 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -403,23 +403,23 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 403 | if (!NILP (f->title)) | 403 | if (!NILP (f->title)) |
| 404 | arg = f->title; | 404 | arg = f->title; |
| 405 | else | 405 | else |
| 406 | /* explicit name and no icon-name -> explicit_name */ | 406 | /* Explicit name and no icon-name -> explicit_name. */ |
| 407 | if (f->explicit_name) | 407 | if (f->explicit_name) |
| 408 | arg = f->name; | 408 | arg = f->name; |
| 409 | else | 409 | else |
| 410 | { | 410 | { |
| 411 | /* no explicit name and no icon-name -> | 411 | /* No explicit name and no icon-name -> |
| 412 | name has to be rebuild from icon_title_format */ | 412 | name has to be rebuild from icon_title_format. */ |
| 413 | windows_or_buffers_changed++; | 413 | windows_or_buffers_changed = 62; |
| 414 | return; | 414 | return; |
| 415 | } | 415 | } |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | /* Don't change the name if it's already NAME. */ | 418 | /* Don't change the name if it's already NAME. */ |
| 419 | if ([[view window] miniwindowTitle] && | 419 | if ([[view window] miniwindowTitle] |
| 420 | ([[[view window] miniwindowTitle] | 420 | && ([[[view window] miniwindowTitle] |
| 421 | isEqualToString: [NSString stringWithUTF8String: | 421 | isEqualToString: [NSString stringWithUTF8String: |
| 422 | SSDATA (arg)]])) | 422 | SSDATA (arg)]])) |
| 423 | return; | 423 | return; |
| 424 | 424 | ||
| 425 | [[view window] setMiniwindowTitle: | 425 | [[view window] setMiniwindowTitle: |
| @@ -451,8 +451,8 @@ ns_set_name_internal (struct frame *f, Lisp_Object name) | |||
| 451 | 451 | ||
| 452 | str = [NSString stringWithUTF8String: SSDATA (encoded_icon_name)]; | 452 | str = [NSString stringWithUTF8String: SSDATA (encoded_icon_name)]; |
| 453 | 453 | ||
| 454 | if ([[view window] miniwindowTitle] && | 454 | if ([[view window] miniwindowTitle] |
| 455 | ! [[[view window] miniwindowTitle] isEqualToString: str]) | 455 | && ! [[[view window] miniwindowTitle] isEqualToString: str]) |
| 456 | [[view window] setMiniwindowTitle: str]; | 456 | [[view window] setMiniwindowTitle: str]; |
| 457 | 457 | ||
| 458 | } | 458 | } |
| @@ -469,7 +469,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 469 | /* If we're switching from explicit to implicit, we had better | 469 | /* If we're switching from explicit to implicit, we had better |
| 470 | update the mode lines and thereby update the title. */ | 470 | update the mode lines and thereby update the title. */ |
| 471 | if (f->explicit_name && NILP (name)) | 471 | if (f->explicit_name && NILP (name)) |
| 472 | update_mode_lines = 1; | 472 | update_mode_lines = 21; |
| 473 | 473 | ||
| 474 | f->explicit_name = ! NILP (name); | 474 | f->explicit_name = ! NILP (name); |
| 475 | } | 475 | } |
| @@ -477,7 +477,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 477 | return; | 477 | return; |
| 478 | 478 | ||
| 479 | if (NILP (name)) | 479 | if (NILP (name)) |
| 480 | name = build_string([ns_app_name UTF8String]); | 480 | name = build_string ([ns_app_name UTF8String]); |
| 481 | else | 481 | else |
| 482 | CHECK_STRING (name); | 482 | CHECK_STRING (name); |
| 483 | 483 | ||
| @@ -487,7 +487,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 487 | 487 | ||
| 488 | fset_name (f, name); | 488 | fset_name (f, name); |
| 489 | 489 | ||
| 490 | /* title overrides explicit name */ | 490 | /* Title overrides explicit name. */ |
| 491 | if (! NILP (f->title)) | 491 | if (! NILP (f->title)) |
| 492 | name = f->title; | 492 | name = f->title; |
| 493 | 493 | ||
| @@ -534,7 +534,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) | |||
| 534 | if (EQ (name, f->title)) | 534 | if (EQ (name, f->title)) |
| 535 | return; | 535 | return; |
| 536 | 536 | ||
| 537 | update_mode_lines = 1; | 537 | update_mode_lines = 22; |
| 538 | 538 | ||
| 539 | fset_title (f, name); | 539 | fset_title (f, name); |
| 540 | 540 | ||
| @@ -1194,6 +1194,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1194 | x_default_parameter (f, parms, Qfont, | 1194 | x_default_parameter (f, parms, Qfont, |
| 1195 | build_string (fontname), | 1195 | build_string (fontname), |
| 1196 | "font", "Font", RES_TYPE_STRING); | 1196 | "font", "Font", RES_TYPE_STRING); |
| 1197 | xfree (fontname); | ||
| 1197 | } | 1198 | } |
| 1198 | unblock_input (); | 1199 | unblock_input (); |
| 1199 | 1200 | ||
| @@ -2357,28 +2358,86 @@ each physical monitor, use `display-monitor-attributes-list'. */) | |||
| 2357 | } | 2358 | } |
| 2358 | 2359 | ||
| 2359 | #ifdef NS_IMPL_COCOA | 2360 | #ifdef NS_IMPL_COCOA |
| 2360 | /* Returns the name for the screen that DICT came from, or NULL. | 2361 | |
| 2362 | /* Returns the name for the screen that OBJ represents, or NULL. | ||
| 2361 | Caller must free return value. | 2363 | Caller must free return value. |
| 2362 | */ | 2364 | */ |
| 2363 | 2365 | ||
| 2364 | static char * | 2366 | static char * |
| 2365 | ns_screen_name (CGDirectDisplayID did) | 2367 | ns_get_name_from_ioreg (io_object_t obj) |
| 2366 | { | 2368 | { |
| 2367 | char *name = NULL; | 2369 | char *name = NULL; |
| 2370 | |||
| 2368 | NSDictionary *info = (NSDictionary *) | 2371 | NSDictionary *info = (NSDictionary *) |
| 2369 | IODisplayCreateInfoDictionary (CGDisplayIOServicePort (did), | 2372 | IODisplayCreateInfoDictionary (obj, kIODisplayOnlyPreferredName); |
| 2370 | kIODisplayOnlyPreferredName); | 2373 | NSDictionary *names = [info objectForKey: |
| 2371 | NSDictionary *names | 2374 | [NSString stringWithUTF8String: |
| 2372 | = [info objectForKey: | 2375 | kDisplayProductName]]; |
| 2373 | [NSString stringWithUTF8String:kDisplayProductName]]; | 2376 | |
| 2374 | 2377 | if ([names count] > 0) | |
| 2375 | if ([names count] > 0) { | 2378 | { |
| 2376 | NSString *n = [names objectForKey: [[names allKeys] objectAtIndex:0]]; | 2379 | NSString *n = [names objectForKey: [[names allKeys] |
| 2377 | if (n != nil) | 2380 | objectAtIndex:0]]; |
| 2378 | name = xstrdup ([n UTF8String]); | 2381 | if (n != nil) name = xstrdup ([n UTF8String]); |
| 2379 | } | 2382 | } |
| 2380 | 2383 | ||
| 2381 | [info release]; | 2384 | [info release]; |
| 2385 | |||
| 2386 | return name; | ||
| 2387 | } | ||
| 2388 | |||
| 2389 | /* Returns the name for the screen that DID came from, or NULL. | ||
| 2390 | Caller must free return value. | ||
| 2391 | */ | ||
| 2392 | |||
| 2393 | static char * | ||
| 2394 | ns_screen_name (CGDirectDisplayID did) | ||
| 2395 | { | ||
| 2396 | char *name = NULL; | ||
| 2397 | |||
| 2398 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 | ||
| 2399 | mach_port_t masterPort; | ||
| 2400 | io_iterator_t it; | ||
| 2401 | io_object_t obj; | ||
| 2402 | |||
| 2403 | // CGDisplayIOServicePort is deprecated. Do it another (harder) way. | ||
| 2404 | |||
| 2405 | if (IOMasterPort (MACH_PORT_NULL, &masterPort) != kIOReturnSuccess | ||
| 2406 | || IOServiceGetMatchingServices (masterPort, | ||
| 2407 | IOServiceMatching ("IONDRVDevice"), | ||
| 2408 | &it) != kIOReturnSuccess) | ||
| 2409 | return name; | ||
| 2410 | |||
| 2411 | /* Must loop until we find a name. Many devices can have the same unit | ||
| 2412 | number (represents different GPU parts), but only one has a name. */ | ||
| 2413 | while (! name && (obj = IOIteratorNext (it))) | ||
| 2414 | { | ||
| 2415 | CFMutableDictionaryRef props; | ||
| 2416 | const void *val; | ||
| 2417 | |||
| 2418 | if (IORegistryEntryCreateCFProperties (obj, | ||
| 2419 | &props, | ||
| 2420 | kCFAllocatorDefault, | ||
| 2421 | kNilOptions) == kIOReturnSuccess | ||
| 2422 | && props != nil | ||
| 2423 | && (val = CFDictionaryGetValue(props, @"IOFBDependentIndex"))) | ||
| 2424 | { | ||
| 2425 | unsigned nr = [(NSNumber *)val unsignedIntegerValue]; | ||
| 2426 | if (nr == CGDisplayUnitNumber (did)) | ||
| 2427 | name = ns_get_name_from_ioreg (obj); | ||
| 2428 | } | ||
| 2429 | |||
| 2430 | CFRelease (props); | ||
| 2431 | IOObjectRelease (obj); | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | IOObjectRelease (it); | ||
| 2435 | |||
| 2436 | #else | ||
| 2437 | |||
| 2438 | name = ns_get_name_from_ioreg (CGDisplayIOServicePort (did)); | ||
| 2439 | |||
| 2440 | #endif | ||
| 2382 | return name; | 2441 | return name; |
| 2383 | } | 2442 | } |
| 2384 | #endif | 2443 | #endif |
diff --git a/src/nsfont.m b/src/nsfont.m index bd9a2acc983..58663804a2f 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -624,7 +624,7 @@ static Lisp_Object nsfont_match (struct frame *, Lisp_Object); | |||
| 624 | static Lisp_Object nsfont_list_family (struct frame *); | 624 | static Lisp_Object nsfont_list_family (struct frame *); |
| 625 | static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity, | 625 | static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity, |
| 626 | int pixel_size); | 626 | int pixel_size); |
| 627 | static void nsfont_close (struct frame *f, struct font *font); | 627 | static void nsfont_close (struct font *font); |
| 628 | static int nsfont_has_char (Lisp_Object entity, int c); | 628 | static int nsfont_has_char (Lisp_Object entity, int c); |
| 629 | static unsigned int nsfont_encode_char (struct font *font, int c); | 629 | static unsigned int nsfont_encode_char (struct font *font, int c); |
| 630 | static int nsfont_text_extents (struct font *font, unsigned int *code, | 630 | static int nsfont_text_extents (struct font *font, unsigned int *code, |
| @@ -929,29 +929,30 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | 931 | ||
| 932 | /* Close FONT on frame F. */ | 932 | /* Close FONT. */ |
| 933 | static void | 933 | static void |
| 934 | nsfont_close (struct frame *f, struct font *font) | 934 | nsfont_close (struct font *font) |
| 935 | { | 935 | { |
| 936 | struct nsfont_info *font_info = (struct nsfont_info *)font; | 936 | struct nsfont_info *font_info = (struct nsfont_info *) font; |
| 937 | int i; | ||
| 938 | |||
| 939 | /* FIXME: this occurs apparently due to same failure to detect same font | ||
| 940 | that causes need for cache in nsfont_open () */ | ||
| 941 | if (!font_info) | ||
| 942 | return; | ||
| 943 | 937 | ||
| 944 | for (i =0; i<0x100; i++) | 938 | /* FIXME: font_info may be NULL due to same failure to detect |
| 939 | same font that causes need for cache in nsfont_open. */ | ||
| 940 | if (font_info && font_info->name) | ||
| 945 | { | 941 | { |
| 946 | xfree (font_info->glyphs[i]); | 942 | int i; |
| 947 | xfree (font_info->metrics[i]); | 943 | |
| 948 | } | 944 | for (i = 0; i < 0x100; i++) |
| 949 | [font_info->nsfont release]; | 945 | { |
| 946 | xfree (font_info->glyphs[i]); | ||
| 947 | xfree (font_info->metrics[i]); | ||
| 948 | } | ||
| 949 | [font_info->nsfont release]; | ||
| 950 | #ifdef NS_IMPL_COCOA | 950 | #ifdef NS_IMPL_COCOA |
| 951 | CGFontRelease (font_info->cgfont); | 951 | CGFontRelease (font_info->cgfont); |
| 952 | #endif | 952 | #endif |
| 953 | xfree (font_info->name); | 953 | xfree (font_info->name); |
| 954 | xfree (font_info); | 954 | font_info->name = NULL; |
| 955 | } | ||
| 955 | } | 956 | } |
| 956 | 957 | ||
| 957 | 958 | ||
diff --git a/src/nsterm.h b/src/nsterm.h index 71faa075f32..22a8aec9436 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -85,6 +85,10 @@ typedef float EmacsCGFloat; | |||
| 85 | /* We override sendEvent: as a means to stop/start the event loop */ | 85 | /* We override sendEvent: as a means to stop/start the event loop */ |
| 86 | @interface EmacsApp : NSApplication | 86 | @interface EmacsApp : NSApplication |
| 87 | { | 87 | { |
| 88 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 | ||
| 89 | BOOL shouldKeepRunning; | ||
| 90 | BOOL isFirst; | ||
| 91 | #endif | ||
| 88 | #ifdef NS_IMPL_GNUSTEP | 92 | #ifdef NS_IMPL_GNUSTEP |
| 89 | @public | 93 | @public |
| 90 | int nextappdefined; | 94 | int nextappdefined; |
diff --git a/src/nsterm.m b/src/nsterm.m index 5b2c6a3f686..0e7667b6dc6 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -173,6 +173,7 @@ Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper; | |||
| 173 | extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; | 173 | extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; |
| 174 | 174 | ||
| 175 | static Lisp_Object QUTF8_STRING; | 175 | static Lisp_Object QUTF8_STRING; |
| 176 | static Lisp_Object Qcocoa, Qgnustep; | ||
| 176 | 177 | ||
| 177 | /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold, | 178 | /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold, |
| 178 | the maximum font size to NOT antialias. On GNUstep there is currently | 179 | the maximum font size to NOT antialias. On GNUstep there is currently |
| @@ -1460,15 +1461,16 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1460 | /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ | 1461 | /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ |
| 1461 | block_input (); | 1462 | block_input (); |
| 1462 | 1463 | ||
| 1463 | #ifdef NS_IMPL_COCOA | ||
| 1464 | if ([nsname isEqualToString: @"ns_selection_bg_color"]) | 1464 | if ([nsname isEqualToString: @"ns_selection_bg_color"]) |
| 1465 | { | 1465 | { |
| 1466 | #ifdef NS_IMPL_COCOA | ||
| 1466 | NSString *defname = [[NSUserDefaults standardUserDefaults] | 1467 | NSString *defname = [[NSUserDefaults standardUserDefaults] |
| 1467 | stringForKey: @"AppleHighlightColor"]; | 1468 | stringForKey: @"AppleHighlightColor"]; |
| 1468 | |||
| 1469 | if (defname != nil) | 1469 | if (defname != nil) |
| 1470 | nsname = defname; | 1470 | nsname = defname; |
| 1471 | else if ((new = [NSColor selectedTextBackgroundColor]) != nil) | 1471 | else |
| 1472 | #endif | ||
| 1473 | if ((new = [NSColor selectedTextBackgroundColor]) != nil) | ||
| 1472 | { | 1474 | { |
| 1473 | *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; | 1475 | *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; |
| 1474 | unblock_input (); | 1476 | unblock_input (); |
| @@ -1494,7 +1496,6 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1494 | nsname = NS_SELECTION_FG_COLOR_DEFAULT; | 1496 | nsname = NS_SELECTION_FG_COLOR_DEFAULT; |
| 1495 | name = [nsname UTF8String]; | 1497 | name = [nsname UTF8String]; |
| 1496 | } | 1498 | } |
| 1497 | #endif // NS_IMPL_COCOA | ||
| 1498 | 1499 | ||
| 1499 | /* First, check for some sort of numeric specification. */ | 1500 | /* First, check for some sort of numeric specification. */ |
| 1500 | hex[0] = '\0'; | 1501 | hex[0] = '\0'; |
| @@ -4366,6 +4367,46 @@ ns_term_shutdown (int sig) | |||
| 4366 | 4367 | ||
| 4367 | @implementation EmacsApp | 4368 | @implementation EmacsApp |
| 4368 | 4369 | ||
| 4370 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 | ||
| 4371 | - (id)init | ||
| 4372 | { | ||
| 4373 | if (self = [super init]) | ||
| 4374 | self->isFirst = YES; | ||
| 4375 | |||
| 4376 | return self; | ||
| 4377 | } | ||
| 4378 | |||
| 4379 | - (void)run | ||
| 4380 | { | ||
| 4381 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
| 4382 | |||
| 4383 | if (isFirst) [self finishLaunching]; | ||
| 4384 | isFirst = NO; | ||
| 4385 | |||
| 4386 | shouldKeepRunning = YES; | ||
| 4387 | do | ||
| 4388 | { | ||
| 4389 | [pool release]; | ||
| 4390 | pool = [[NSAutoreleasePool alloc] init]; | ||
| 4391 | |||
| 4392 | NSEvent *event = | ||
| 4393 | [self nextEventMatchingMask:NSAnyEventMask | ||
| 4394 | untilDate:[NSDate distantFuture] | ||
| 4395 | inMode:NSDefaultRunLoopMode | ||
| 4396 | dequeue:YES]; | ||
| 4397 | [self sendEvent:event]; | ||
| 4398 | [self updateWindows]; | ||
| 4399 | } while (shouldKeepRunning); | ||
| 4400 | |||
| 4401 | [pool release]; | ||
| 4402 | } | ||
| 4403 | |||
| 4404 | - (void)stop: (id)sender | ||
| 4405 | { | ||
| 4406 | shouldKeepRunning = NO; | ||
| 4407 | } | ||
| 4408 | #endif | ||
| 4409 | |||
| 4369 | - (void)logNotification: (NSNotification *)notification | 4410 | - (void)logNotification: (NSNotification *)notification |
| 4370 | { | 4411 | { |
| 4371 | const char *name = [[notification name] UTF8String]; | 4412 | const char *name = [[notification name] UTF8String]; |
| @@ -6048,7 +6089,7 @@ if (cols > 0 && rows > 0) | |||
| 6048 | 6089 | ||
| 6049 | SET_FRAME_ICONIFIED (emacsframe, 0); | 6090 | SET_FRAME_ICONIFIED (emacsframe, 0); |
| 6050 | SET_FRAME_VISIBLE (emacsframe, 1); | 6091 | SET_FRAME_VISIBLE (emacsframe, 1); |
| 6051 | windows_or_buffers_changed++; | 6092 | windows_or_buffers_changed = 63; |
| 6052 | 6093 | ||
| 6053 | if (emacs_event) | 6094 | if (emacs_event) |
| 6054 | { | 6095 | { |
| @@ -7501,11 +7542,17 @@ baseline level. The default value is nil. */); | |||
| 7501 | /* Tell Emacs about this window system. */ | 7542 | /* Tell Emacs about this window system. */ |
| 7502 | Fprovide (Qns, Qnil); | 7543 | Fprovide (Qns, Qnil); |
| 7503 | 7544 | ||
| 7545 | DEFSYM (Qcocoa, "cocoa"); | ||
| 7546 | DEFSYM (Qgnustep, "gnustep"); | ||
| 7547 | |||
| 7504 | syms_of_nsfont (); | 7548 | syms_of_nsfont (); |
| 7505 | #ifdef NS_IMPL_COCOA | 7549 | #ifdef NS_IMPL_COCOA |
| 7550 | Fprovide (Qcocoa, Qnil); | ||
| 7506 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 | 7551 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 |
| 7507 | syms_of_macfont (); | 7552 | syms_of_macfont (); |
| 7508 | #endif | 7553 | #endif |
| 7554 | #else | ||
| 7555 | Fprovide (Qgnustep, Qnil); | ||
| 7509 | #endif | 7556 | #endif |
| 7510 | 7557 | ||
| 7511 | } | 7558 | } |
diff --git a/src/print.c b/src/print.c index 965d719f852..e3c56a6de62 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1705,8 +1705,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1705 | unsigned char c; | 1705 | unsigned char c; |
| 1706 | struct gcpro gcpro1; | 1706 | struct gcpro gcpro1; |
| 1707 | EMACS_INT size = bool_vector_size (obj); | 1707 | EMACS_INT size = bool_vector_size (obj); |
| 1708 | ptrdiff_t size_in_chars = ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) | 1708 | ptrdiff_t size_in_chars = bool_vector_bytes (size); |
| 1709 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 1710 | ptrdiff_t real_size_in_chars = size_in_chars; | 1709 | ptrdiff_t real_size_in_chars = size_in_chars; |
| 1711 | GCPRO1 (obj); | 1710 | GCPRO1 (obj); |
| 1712 | 1711 | ||
| @@ -1726,7 +1725,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1726 | for (i = 0; i < size_in_chars; i++) | 1725 | for (i = 0; i < size_in_chars; i++) |
| 1727 | { | 1726 | { |
| 1728 | QUIT; | 1727 | QUIT; |
| 1729 | c = XBOOL_VECTOR (obj)->data[i]; | 1728 | c = bool_vector_uchar_data (obj)[i]; |
| 1730 | if (c == '\n' && print_escape_newlines) | 1729 | if (c == '\n' && print_escape_newlines) |
| 1731 | { | 1730 | { |
| 1732 | PRINTCHAR ('\\'); | 1731 | PRINTCHAR ('\\'); |
diff --git a/src/process.c b/src/process.c index 91bc090e76e..307eab3ab30 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1333,15 +1333,15 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1333 | 1333 | ||
| 1334 | for (i = 0; i < nargs; i++) | 1334 | for (i = 0; i < nargs; i++) |
| 1335 | { | 1335 | { |
| 1336 | if (! RANGED_INTEGERP (0, p->u.contents[i], 65535)) | 1336 | if (! RANGED_INTEGERP (0, p->contents[i], 65535)) |
| 1337 | return Qnil; | 1337 | return Qnil; |
| 1338 | 1338 | ||
| 1339 | if (nargs <= 5 /* IPv4 */ | 1339 | if (nargs <= 5 /* IPv4 */ |
| 1340 | && i < 4 /* host, not port */ | 1340 | && i < 4 /* host, not port */ |
| 1341 | && XINT (p->u.contents[i]) > 255) | 1341 | && XINT (p->contents[i]) > 255) |
| 1342 | return Qnil; | 1342 | return Qnil; |
| 1343 | 1343 | ||
| 1344 | args[i+1] = p->u.contents[i]; | 1344 | args[i+1] = p->contents[i]; |
| 1345 | } | 1345 | } |
| 1346 | 1346 | ||
| 1347 | return Fformat (nargs+1, args); | 1347 | return Fformat (nargs+1, args); |
| @@ -1983,7 +1983,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len) | |||
| 1983 | len = sizeof (sin->sin_addr) + 1; | 1983 | len = sizeof (sin->sin_addr) + 1; |
| 1984 | address = Fmake_vector (make_number (len), Qnil); | 1984 | address = Fmake_vector (make_number (len), Qnil); |
| 1985 | p = XVECTOR (address); | 1985 | p = XVECTOR (address); |
| 1986 | p->u.contents[--len] = make_number (ntohs (sin->sin_port)); | 1986 | p->contents[--len] = make_number (ntohs (sin->sin_port)); |
| 1987 | cp = (unsigned char *) &sin->sin_addr; | 1987 | cp = (unsigned char *) &sin->sin_addr; |
| 1988 | break; | 1988 | break; |
| 1989 | } | 1989 | } |
| @@ -1995,9 +1995,9 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len) | |||
| 1995 | len = sizeof (sin6->sin6_addr)/2 + 1; | 1995 | len = sizeof (sin6->sin6_addr)/2 + 1; |
| 1996 | address = Fmake_vector (make_number (len), Qnil); | 1996 | address = Fmake_vector (make_number (len), Qnil); |
| 1997 | p = XVECTOR (address); | 1997 | p = XVECTOR (address); |
| 1998 | p->u.contents[--len] = make_number (ntohs (sin6->sin6_port)); | 1998 | p->contents[--len] = make_number (ntohs (sin6->sin6_port)); |
| 1999 | for (i = 0; i < len; i++) | 1999 | for (i = 0; i < len; i++) |
| 2000 | p->u.contents[i] = make_number (ntohs (ip6[i])); | 2000 | p->contents[i] = make_number (ntohs (ip6[i])); |
| 2001 | return address; | 2001 | return address; |
| 2002 | } | 2002 | } |
| 2003 | #endif | 2003 | #endif |
| @@ -2022,7 +2022,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len) | |||
| 2022 | 2022 | ||
| 2023 | i = 0; | 2023 | i = 0; |
| 2024 | while (i < len) | 2024 | while (i < len) |
| 2025 | p->u.contents[i++] = make_number (*cp++); | 2025 | p->contents[i++] = make_number (*cp++); |
| 2026 | 2026 | ||
| 2027 | return address; | 2027 | return address; |
| 2028 | } | 2028 | } |
| @@ -2093,7 +2093,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2093 | { | 2093 | { |
| 2094 | struct sockaddr_in *sin = (struct sockaddr_in *) sa; | 2094 | struct sockaddr_in *sin = (struct sockaddr_in *) sa; |
| 2095 | len = sizeof (sin->sin_addr) + 1; | 2095 | len = sizeof (sin->sin_addr) + 1; |
| 2096 | hostport = XINT (p->u.contents[--len]); | 2096 | hostport = XINT (p->contents[--len]); |
| 2097 | sin->sin_port = htons (hostport); | 2097 | sin->sin_port = htons (hostport); |
| 2098 | cp = (unsigned char *)&sin->sin_addr; | 2098 | cp = (unsigned char *)&sin->sin_addr; |
| 2099 | sa->sa_family = family; | 2099 | sa->sa_family = family; |
| @@ -2104,12 +2104,12 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2104 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; | 2104 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; |
| 2105 | uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; | 2105 | uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; |
| 2106 | len = sizeof (sin6->sin6_addr) + 1; | 2106 | len = sizeof (sin6->sin6_addr) + 1; |
| 2107 | hostport = XINT (p->u.contents[--len]); | 2107 | hostport = XINT (p->contents[--len]); |
| 2108 | sin6->sin6_port = htons (hostport); | 2108 | sin6->sin6_port = htons (hostport); |
| 2109 | for (i = 0; i < len; i++) | 2109 | for (i = 0; i < len; i++) |
| 2110 | if (INTEGERP (p->u.contents[i])) | 2110 | if (INTEGERP (p->contents[i])) |
| 2111 | { | 2111 | { |
| 2112 | int j = XFASTINT (p->u.contents[i]) & 0xffff; | 2112 | int j = XFASTINT (p->contents[i]) & 0xffff; |
| 2113 | ip6[i] = ntohs (j); | 2113 | ip6[i] = ntohs (j); |
| 2114 | } | 2114 | } |
| 2115 | sa->sa_family = family; | 2115 | sa->sa_family = family; |
| @@ -2140,8 +2140,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2140 | } | 2140 | } |
| 2141 | 2141 | ||
| 2142 | for (i = 0; i < len; i++) | 2142 | for (i = 0; i < len; i++) |
| 2143 | if (INTEGERP (p->u.contents[i])) | 2143 | if (INTEGERP (p->contents[i])) |
| 2144 | *cp++ = XFASTINT (p->u.contents[i]) & 0xff; | 2144 | *cp++ = XFASTINT (p->contents[i]) & 0xff; |
| 2145 | } | 2145 | } |
| 2146 | 2146 | ||
| 2147 | #ifdef DATAGRAM_SOCKETS | 2147 | #ifdef DATAGRAM_SOCKETS |
| @@ -3723,7 +3723,9 @@ network_interface_info (Lisp_Object ifname) | |||
| 3723 | 3723 | ||
| 3724 | any = 1; | 3724 | any = 1; |
| 3725 | for (n = 0; n < 6; n++) | 3725 | for (n = 0; n < 6; n++) |
| 3726 | p->u.contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); | 3726 | p->contents[n] = make_number (((unsigned char *) |
| 3727 | &rq.ifr_hwaddr.sa_data[0]) | ||
| 3728 | [n]); | ||
| 3727 | elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); | 3729 | elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); |
| 3728 | } | 3730 | } |
| 3729 | #elif defined (HAVE_GETIFADDRS) && defined (LLADDR) | 3731 | #elif defined (HAVE_GETIFADDRS) && defined (LLADDR) |
| @@ -3746,7 +3748,7 @@ network_interface_info (Lisp_Object ifname) | |||
| 3746 | 3748 | ||
| 3747 | memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen); | 3749 | memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen); |
| 3748 | for (n = 0; n < 6; n++) | 3750 | for (n = 0; n < 6; n++) |
| 3749 | p->u.contents[n] = make_number (linkaddr[n]); | 3751 | p->contents[n] = make_number (linkaddr[n]); |
| 3750 | 3752 | ||
| 3751 | elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr); | 3753 | elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr); |
| 3752 | break; | 3754 | break; |
| @@ -4607,7 +4609,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4607 | { | 4609 | { |
| 4608 | struct Lisp_Process *p = | 4610 | struct Lisp_Process *p = |
| 4609 | XPROCESS (chan_process[channel]); | 4611 | XPROCESS (chan_process[channel]); |
| 4610 | if (p && p->gnutls_p && p->infd | 4612 | if (p && p->gnutls_p && p->gnutls_state && p->infd |
| 4611 | && ((emacs_gnutls_record_check_pending | 4613 | && ((emacs_gnutls_record_check_pending |
| 4612 | (p->gnutls_state)) | 4614 | (p->gnutls_state)) |
| 4613 | > 0)) | 4615 | > 0)) |
| @@ -4621,6 +4623,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4621 | { | 4623 | { |
| 4622 | /* Check this specific channel. */ | 4624 | /* Check this specific channel. */ |
| 4623 | if (wait_proc->gnutls_p /* Check for valid process. */ | 4625 | if (wait_proc->gnutls_p /* Check for valid process. */ |
| 4626 | && wait_proc->gnutls_state | ||
| 4624 | /* Do we have pending data? */ | 4627 | /* Do we have pending data? */ |
| 4625 | && ((emacs_gnutls_record_check_pending | 4628 | && ((emacs_gnutls_record_check_pending |
| 4626 | (wait_proc->gnutls_state)) | 4629 | (wait_proc->gnutls_state)) |
| @@ -5002,7 +5005,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5002 | proc_buffered_char[channel] = -1; | 5005 | proc_buffered_char[channel] = -1; |
| 5003 | } | 5006 | } |
| 5004 | #ifdef HAVE_GNUTLS | 5007 | #ifdef HAVE_GNUTLS |
| 5005 | if (p->gnutls_p) | 5008 | if (p->gnutls_p && p->gnutls_state) |
| 5006 | nbytes = emacs_gnutls_read (p, chars + carryover + buffered, | 5009 | nbytes = emacs_gnutls_read (p, chars + carryover + buffered, |
| 5007 | readmax - buffered); | 5010 | readmax - buffered); |
| 5008 | else | 5011 | else |
| @@ -5243,7 +5246,7 @@ DEFUN ("internal-default-process-filter", Finternal_default_process_filter, | |||
| 5243 | else | 5246 | else |
| 5244 | set_marker_both (p->mark, p->buffer, PT, PT_BYTE); | 5247 | set_marker_both (p->mark, p->buffer, PT, PT_BYTE); |
| 5245 | 5248 | ||
| 5246 | update_mode_lines++; | 5249 | update_mode_lines = 23; |
| 5247 | 5250 | ||
| 5248 | /* Make sure opoint and the old restrictions | 5251 | /* Make sure opoint and the old restrictions |
| 5249 | float ahead of any new text just as point would. */ | 5252 | float ahead of any new text just as point would. */ |
| @@ -5496,7 +5499,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, | |||
| 5496 | #endif | 5499 | #endif |
| 5497 | { | 5500 | { |
| 5498 | #ifdef HAVE_GNUTLS | 5501 | #ifdef HAVE_GNUTLS |
| 5499 | if (p->gnutls_p) | 5502 | if (p->gnutls_p && p->gnutls_state) |
| 5500 | written = emacs_gnutls_write (p, cur_buf, cur_len); | 5503 | written = emacs_gnutls_write (p, cur_buf, cur_len); |
| 5501 | else | 5504 | else |
| 5502 | #endif | 5505 | #endif |
| @@ -6387,7 +6390,7 @@ status_notify (struct Lisp_Process *deleting_process) | |||
| 6387 | } | 6390 | } |
| 6388 | } /* end for */ | 6391 | } /* end for */ |
| 6389 | 6392 | ||
| 6390 | update_mode_lines++; /* In case buffers use %s in mode-line-format. */ | 6393 | update_mode_lines = 24; /* In case buffers use %s in mode-line-format. */ |
| 6391 | UNGCPRO; | 6394 | UNGCPRO; |
| 6392 | } | 6395 | } |
| 6393 | 6396 | ||
diff --git a/src/regex.c b/src/regex.c index 4ab98bbf098..615fb3fdf34 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | # endif | 43 | # endif |
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | #if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && ! defined __clang__ | 46 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) && ! defined __clang__ |
| 47 | # pragma GCC diagnostic ignored "-Wunused-but-set-variable" | 47 | # pragma GCC diagnostic ignored "-Wunused-but-set-variable" |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
diff --git a/src/regex.h b/src/regex.h index bb737df5239..8f5bb56fbd1 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -40,7 +40,7 @@ extern "C" { | |||
| 40 | The bits are given in alphabetical order, and | 40 | The bits are given in alphabetical order, and |
| 41 | the definitions shifted by one from the previous bit; thus, when we | 41 | the definitions shifted by one from the previous bit; thus, when we |
| 42 | add or remove a bit, only one other definition need change. */ | 42 | add or remove a bit, only one other definition need change. */ |
| 43 | typedef unsigned long int reg_syntax_t; | 43 | typedef unsigned long reg_syntax_t; |
| 44 | 44 | ||
| 45 | /* If this bit is not set, then \ inside a bracket expression is literal. | 45 | /* If this bit is not set, then \ inside a bracket expression is literal. |
| 46 | If set, then such a \ quotes the following character. */ | 46 | If set, then such a \ quotes the following character. */ |
diff --git a/src/search.c b/src/search.c index 99e8d2501fe..c9e27627cd1 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -720,42 +720,45 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, | |||
| 720 | 720 | ||
| 721 | { | 721 | { |
| 722 | /* The termination address of the dumb loop. */ | 722 | /* The termination address of the dumb loop. */ |
| 723 | register unsigned char *ceiling_addr | 723 | unsigned char *lim_addr = BYTE_POS_ADDR (ceiling_byte) + 1; |
| 724 | = BYTE_POS_ADDR (ceiling_byte) + 1; | 724 | ptrdiff_t lim_byte = ceiling_byte + 1; |
| 725 | register unsigned char *cursor | ||
| 726 | = BYTE_POS_ADDR (start_byte); | ||
| 727 | unsigned char *base = cursor; | ||
| 728 | 725 | ||
| 729 | while (cursor < ceiling_addr) | 726 | /* Nonpositive offsets (relative to LIM_ADDR and LIM_BYTE) |
| 730 | { | 727 | of the base, the cursor, and the next line. */ |
| 728 | ptrdiff_t base = start_byte - lim_byte; | ||
| 729 | ptrdiff_t cursor, next; | ||
| 730 | |||
| 731 | for (cursor = base; cursor < 0; cursor = next) | ||
| 732 | { | ||
| 731 | /* The dumb loop. */ | 733 | /* The dumb loop. */ |
| 732 | unsigned char *nl = memchr (cursor, '\n', ceiling_addr - cursor); | 734 | unsigned char *nl = memchr (lim_addr + cursor, '\n', - cursor); |
| 735 | next = nl ? nl - lim_addr : 0; | ||
| 733 | 736 | ||
| 734 | /* If we're looking for newlines, cache the fact that | 737 | /* If we're looking for newlines, cache the fact that |
| 735 | the region from start to cursor is free of them. */ | 738 | this line's region is free of them. */ |
| 736 | if (newline_cache) | 739 | if (newline_cache) |
| 737 | { | 740 | { |
| 738 | unsigned char *low = cursor; | ||
| 739 | unsigned char *lim = nl ? nl : ceiling_addr; | ||
| 740 | know_region_cache (current_buffer, newline_cache, | 741 | know_region_cache (current_buffer, newline_cache, |
| 741 | BYTE_TO_CHAR (low - base + start_byte), | 742 | BYTE_TO_CHAR (lim_byte + cursor), |
| 742 | BYTE_TO_CHAR (lim - base + start_byte)); | 743 | BYTE_TO_CHAR (lim_byte + next)); |
| 744 | /* know_region_cache can relocate buffer text. */ | ||
| 745 | lim_addr = BYTE_POS_ADDR (ceiling_byte) + 1; | ||
| 743 | } | 746 | } |
| 744 | 747 | ||
| 745 | if (! nl) | 748 | if (! nl) |
| 746 | break; | 749 | break; |
| 750 | next++; | ||
| 747 | 751 | ||
| 748 | if (--count == 0) | 752 | if (--count == 0) |
| 749 | { | 753 | { |
| 750 | immediate_quit = 0; | 754 | immediate_quit = 0; |
| 751 | if (bytepos) | 755 | if (bytepos) |
| 752 | *bytepos = nl + 1 - base + start_byte; | 756 | *bytepos = lim_byte + next; |
| 753 | return BYTE_TO_CHAR (nl + 1 - base + start_byte); | 757 | return BYTE_TO_CHAR (lim_byte + next); |
| 754 | } | 758 | } |
| 755 | cursor = nl + 1; | ||
| 756 | } | 759 | } |
| 757 | 760 | ||
| 758 | start_byte += ceiling_addr - base; | 761 | start_byte = lim_byte; |
| 759 | start = BYTE_TO_CHAR (start_byte); | 762 | start = BYTE_TO_CHAR (start_byte); |
| 760 | } | 763 | } |
| 761 | } | 764 | } |
| @@ -794,24 +797,28 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, | |||
| 794 | 797 | ||
| 795 | { | 798 | { |
| 796 | /* The termination address of the dumb loop. */ | 799 | /* The termination address of the dumb loop. */ |
| 797 | register unsigned char *ceiling_addr = BYTE_POS_ADDR (ceiling_byte); | 800 | unsigned char *ceiling_addr = BYTE_POS_ADDR (ceiling_byte); |
| 798 | register unsigned char *cursor = BYTE_POS_ADDR (start_byte - 1); | 801 | |
| 799 | unsigned char *base = cursor; | 802 | /* Offsets (relative to CEILING_ADDR and CEILING_BYTE) of |
| 803 | the base, the cursor, and the previous line. These | ||
| 804 | offsets are at least -1. */ | ||
| 805 | ptrdiff_t base = start_byte - ceiling_byte; | ||
| 806 | ptrdiff_t cursor, prev; | ||
| 800 | 807 | ||
| 801 | while (cursor >= ceiling_addr) | 808 | for (cursor = base; 0 < cursor; cursor = prev) |
| 802 | { | 809 | { |
| 803 | unsigned char *nl = memrchr (ceiling_addr, '\n', | 810 | unsigned char *nl = memrchr (ceiling_addr, '\n', cursor); |
| 804 | cursor + 1 - ceiling_addr); | 811 | prev = nl ? nl - ceiling_addr : -1; |
| 805 | 812 | ||
| 806 | /* If we're looking for newlines, cache the fact that | 813 | /* If we're looking for newlines, cache the fact that |
| 807 | the region from after the cursor to start is free of them. */ | 814 | this line's region is free of them. */ |
| 808 | if (newline_cache) | 815 | if (newline_cache) |
| 809 | { | 816 | { |
| 810 | unsigned char *low = nl ? nl : ceiling_addr - 1; | ||
| 811 | unsigned char *lim = cursor; | ||
| 812 | know_region_cache (current_buffer, newline_cache, | 817 | know_region_cache (current_buffer, newline_cache, |
| 813 | BYTE_TO_CHAR (low - base + start_byte), | 818 | BYTE_TO_CHAR (ceiling_byte + prev + 1), |
| 814 | BYTE_TO_CHAR (lim - base + start_byte)); | 819 | BYTE_TO_CHAR (ceiling_byte + cursor)); |
| 820 | /* know_region_cache can relocate buffer text. */ | ||
| 821 | ceiling_addr = BYTE_POS_ADDR (ceiling_byte); | ||
| 815 | } | 822 | } |
| 816 | 823 | ||
| 817 | if (! nl) | 824 | if (! nl) |
| @@ -821,13 +828,12 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, | |||
| 821 | { | 828 | { |
| 822 | immediate_quit = 0; | 829 | immediate_quit = 0; |
| 823 | if (bytepos) | 830 | if (bytepos) |
| 824 | *bytepos = nl - base + start_byte; | 831 | *bytepos = ceiling_byte + prev + 1; |
| 825 | return BYTE_TO_CHAR (nl - base + start_byte); | 832 | return BYTE_TO_CHAR (ceiling_byte + prev + 1); |
| 826 | } | 833 | } |
| 827 | cursor = nl - 1; | ||
| 828 | } | 834 | } |
| 829 | 835 | ||
| 830 | start_byte += ceiling_addr - 1 - base; | 836 | start_byte = ceiling_byte; |
| 831 | start = BYTE_TO_CHAR (start_byte); | 837 | start = BYTE_TO_CHAR (start_byte); |
| 832 | } | 838 | } |
| 833 | } | 839 | } |
diff --git a/src/term.c b/src/term.c index b4c2e2560cc..f86d71ac2f4 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1892,55 +1892,18 @@ static void | |||
| 1892 | turn_on_face (struct frame *f, int face_id) | 1892 | turn_on_face (struct frame *f, int face_id) |
| 1893 | { | 1893 | { |
| 1894 | struct face *face = FACE_FROM_ID (f, face_id); | 1894 | struct face *face = FACE_FROM_ID (f, face_id); |
| 1895 | long fg = face->foreground; | 1895 | unsigned long fg = face->foreground; |
| 1896 | long bg = face->background; | 1896 | unsigned long bg = face->background; |
| 1897 | struct tty_display_info *tty = FRAME_TTY (f); | 1897 | struct tty_display_info *tty = FRAME_TTY (f); |
| 1898 | 1898 | ||
| 1899 | /* Do this first because TS_end_standout_mode may be the same | 1899 | /* Use reverse video if the face specifies that. |
| 1900 | Do this first because TS_end_standout_mode may be the same | ||
| 1900 | as TS_exit_attribute_mode, which turns all appearances off. */ | 1901 | as TS_exit_attribute_mode, which turns all appearances off. */ |
| 1901 | if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE)) | 1902 | if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE) |
| 1902 | { | 1903 | && (inverse_video |
| 1903 | if (tty->TN_max_colors > 0) | 1904 | ? fg == FACE_TTY_DEFAULT_FG_COLOR || bg == FACE_TTY_DEFAULT_BG_COLOR |
| 1904 | { | 1905 | : fg == FACE_TTY_DEFAULT_BG_COLOR || bg == FACE_TTY_DEFAULT_FG_COLOR)) |
| 1905 | if (fg >= 0 && bg >= 0) | 1906 | tty_toggle_highlight (tty); |
| 1906 | { | ||
| 1907 | /* If the terminal supports colors, we can set them | ||
| 1908 | below without using reverse video. The face's fg | ||
| 1909 | and bg colors are set as they should appear on | ||
| 1910 | the screen, i.e. they take the inverse-video'ness | ||
| 1911 | of the face already into account. */ | ||
| 1912 | } | ||
| 1913 | else if (inverse_video) | ||
| 1914 | { | ||
| 1915 | if (fg == FACE_TTY_DEFAULT_FG_COLOR | ||
| 1916 | || bg == FACE_TTY_DEFAULT_BG_COLOR) | ||
| 1917 | tty_toggle_highlight (tty); | ||
| 1918 | } | ||
| 1919 | else | ||
| 1920 | { | ||
| 1921 | if (fg == FACE_TTY_DEFAULT_BG_COLOR | ||
| 1922 | || bg == FACE_TTY_DEFAULT_FG_COLOR) | ||
| 1923 | tty_toggle_highlight (tty); | ||
| 1924 | } | ||
| 1925 | } | ||
| 1926 | else | ||
| 1927 | { | ||
| 1928 | /* If we can't display colors, use reverse video | ||
| 1929 | if the face specifies that. */ | ||
| 1930 | if (inverse_video) | ||
| 1931 | { | ||
| 1932 | if (fg == FACE_TTY_DEFAULT_FG_COLOR | ||
| 1933 | || bg == FACE_TTY_DEFAULT_BG_COLOR) | ||
| 1934 | tty_toggle_highlight (tty); | ||
| 1935 | } | ||
| 1936 | else | ||
| 1937 | { | ||
| 1938 | if (fg == FACE_TTY_DEFAULT_BG_COLOR | ||
| 1939 | || bg == FACE_TTY_DEFAULT_FG_COLOR) | ||
| 1940 | tty_toggle_highlight (tty); | ||
| 1941 | } | ||
| 1942 | } | ||
| 1943 | } | ||
| 1944 | 1907 | ||
| 1945 | if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) | 1908 | if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) |
| 1946 | OUTPUT1_IF (tty, tty->TS_enter_bold_mode); | 1909 | OUTPUT1_IF (tty, tty->TS_enter_bold_mode); |
| @@ -1965,7 +1928,7 @@ turn_on_face (struct frame *f, int face_id) | |||
| 1965 | char *p; | 1928 | char *p; |
| 1966 | 1929 | ||
| 1967 | ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; | 1930 | ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; |
| 1968 | if (fg >= 0 && ts) | 1931 | if (face_tty_specified_color (fg) && ts) |
| 1969 | { | 1932 | { |
| 1970 | p = tparam (ts, NULL, 0, fg, 0, 0, 0); | 1933 | p = tparam (ts, NULL, 0, fg, 0, 0, 0); |
| 1971 | OUTPUT (tty, p); | 1934 | OUTPUT (tty, p); |
| @@ -1973,7 +1936,7 @@ turn_on_face (struct frame *f, int face_id) | |||
| 1973 | } | 1936 | } |
| 1974 | 1937 | ||
| 1975 | ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; | 1938 | ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; |
| 1976 | if (bg >= 0 && ts) | 1939 | if (face_tty_specified_color (bg) && ts) |
| 1977 | { | 1940 | { |
| 1978 | p = tparam (ts, NULL, 0, bg, 0, 0, 0); | 1941 | p = tparam (ts, NULL, 0, bg, 0, 0, 0); |
| 1979 | OUTPUT (tty, p); | 1942 | OUTPUT (tty, p); |
| @@ -2027,12 +1990,10 @@ turn_off_face (struct frame *f, int face_id) | |||
| 2027 | 1990 | ||
| 2028 | 1991 | ||
| 2029 | /* Return true if the terminal on frame F supports all of the | 1992 | /* Return true if the terminal on frame F supports all of the |
| 2030 | capabilities in CAPS simultaneously, with foreground and background | 1993 | capabilities in CAPS simultaneously. */ |
| 2031 | colors FG and BG. */ | ||
| 2032 | 1994 | ||
| 2033 | bool | 1995 | bool |
| 2034 | tty_capable_p (struct tty_display_info *tty, unsigned int caps, | 1996 | tty_capable_p (struct tty_display_info *tty, unsigned int caps) |
| 2035 | unsigned long fg, unsigned long bg) | ||
| 2036 | { | 1997 | { |
| 2037 | #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ | 1998 | #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ |
| 2038 | if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \ | 1999 | if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \ |
| @@ -2867,7 +2828,8 @@ tty_menu_search_pane (tty_menu *menu, int pane) | |||
| 2867 | { | 2828 | { |
| 2868 | if (pane == menu->panenumber[i]) | 2829 | if (pane == menu->panenumber[i]) |
| 2869 | return menu->submenu[i]; | 2830 | return menu->submenu[i]; |
| 2870 | if ((try = tty_menu_search_pane (menu->submenu[i], pane))) | 2831 | try = tty_menu_search_pane (menu->submenu[i], pane); |
| 2832 | if (try) | ||
| 2871 | return try; | 2833 | return try; |
| 2872 | } | 2834 | } |
| 2873 | return (tty_menu *) 0; | 2835 | return (tty_menu *) 0; |
| @@ -2920,7 +2882,7 @@ mouse_get_xy (int *x, int *y) | |||
| 2920 | 2882 | ||
| 2921 | static void | 2883 | static void |
| 2922 | tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces, | 2884 | tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces, |
| 2923 | int mx, int my, int first_item, int disp_help) | 2885 | int mx, int my, int first_item, bool disp_help) |
| 2924 | { | 2886 | { |
| 2925 | int i, face, width, enabled, mousehere, row, col; | 2887 | int i, face, width, enabled, mousehere, row, col; |
| 2926 | struct frame *sf = SELECTED_FRAME (); | 2888 | struct frame *sf = SELECTED_FRAME (); |
| @@ -2997,16 +2959,19 @@ tty_menu_add_pane (tty_menu *menu, const char *txt) | |||
| 2997 | 2959 | ||
| 2998 | /* Create a new item in a menu pane. */ | 2960 | /* Create a new item in a menu pane. */ |
| 2999 | 2961 | ||
| 3000 | static int | 2962 | static bool |
| 3001 | tty_menu_add_selection (tty_menu *menu, int pane, | 2963 | tty_menu_add_selection (tty_menu *menu, int pane, |
| 3002 | char *txt, int enable, char const *help_text) | 2964 | char *txt, bool enable, char const *help_text) |
| 3003 | { | 2965 | { |
| 3004 | int len; | 2966 | int len; |
| 3005 | unsigned char *p; | 2967 | unsigned char *p; |
| 3006 | 2968 | ||
| 3007 | if (pane) | 2969 | if (pane) |
| 3008 | if (!(menu = tty_menu_search_pane (menu, pane))) | 2970 | { |
| 3009 | return TTYM_FAILURE; | 2971 | menu = tty_menu_search_pane (menu, pane); |
| 2972 | if (! menu) | ||
| 2973 | return 0; | ||
| 2974 | } | ||
| 3010 | tty_menu_make_room (menu); | 2975 | tty_menu_make_room (menu); |
| 3011 | menu->submenu[menu->count] = (tty_menu *) 0; | 2976 | menu->submenu[menu->count] = (tty_menu *) 0; |
| 3012 | menu->text[menu->count] = txt; | 2977 | menu->text[menu->count] = txt; |
| @@ -3027,7 +2992,7 @@ tty_menu_add_selection (tty_menu *menu, int pane, | |||
| 3027 | if (len > menu->width) | 2992 | if (len > menu->width) |
| 3028 | menu->width = len; | 2993 | menu->width = len; |
| 3029 | 2994 | ||
| 3030 | return TTYM_SUCCESS; | 2995 | return 1; |
| 3031 | } | 2996 | } |
| 3032 | 2997 | ||
| 3033 | /* Decide where the menu would be placed if requested at (X,Y). */ | 2998 | /* Decide where the menu would be placed if requested at (X,Y). */ |
| @@ -3155,7 +3120,7 @@ read_menu_input (struct frame *sf, int *x, int *y, int min_y, int max_y, | |||
| 3155 | else | 3120 | else |
| 3156 | { | 3121 | { |
| 3157 | Lisp_Object cmd; | 3122 | Lisp_Object cmd; |
| 3158 | int usable_input = 1; | 3123 | bool usable_input = 1; |
| 3159 | mi_result st = MI_CONTINUE; | 3124 | mi_result st = MI_CONTINUE; |
| 3160 | struct tty_display_info *tty = FRAME_TTY (sf); | 3125 | struct tty_display_info *tty = FRAME_TTY (sf); |
| 3161 | Lisp_Object saved_mouse_tracking = do_mouse_tracking; | 3126 | Lisp_Object saved_mouse_tracking = do_mouse_tracking; |
| @@ -3215,10 +3180,11 @@ static int | |||
| 3215 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | 3180 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, |
| 3216 | int x0, int y0, char **txt, | 3181 | int x0, int y0, char **txt, |
| 3217 | void (*help_callback)(char const *, int, int), | 3182 | void (*help_callback)(char const *, int, int), |
| 3218 | int kbd_navigation) | 3183 | bool kbd_navigation) |
| 3219 | { | 3184 | { |
| 3220 | struct tty_menu_state *state; | 3185 | struct tty_menu_state *state; |
| 3221 | int statecount, x, y, i, leave, onepane; | 3186 | int statecount, x, y, i; |
| 3187 | bool leave, onepane; | ||
| 3222 | int result IF_LINT (= 0); | 3188 | int result IF_LINT (= 0); |
| 3223 | int title_faces[4]; /* face to display the menu title */ | 3189 | int title_faces[4]; /* face to display the menu title */ |
| 3224 | int faces[4], buffers_num_deleted = 0; | 3190 | int faces[4], buffers_num_deleted = 0; |
| @@ -3285,7 +3251,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3285 | tty_hide_cursor (tty); | 3251 | tty_hide_cursor (tty); |
| 3286 | if (buffers_num_deleted) | 3252 | if (buffers_num_deleted) |
| 3287 | menu->text[0][7] = ' '; | 3253 | menu->text[0][7] = ' '; |
| 3288 | if ((onepane = menu->count == 1 && menu->submenu[0])) | 3254 | onepane = menu->count == 1 && menu->submenu[0]; |
| 3255 | if (onepane) | ||
| 3289 | { | 3256 | { |
| 3290 | menu->width = menu->submenu[0]->width; | 3257 | menu->width = menu->submenu[0]->width; |
| 3291 | state[0].menu = menu->submenu[0]; | 3258 | state[0].menu = menu->submenu[0]; |
| @@ -3478,7 +3445,7 @@ tty_menu_help_callback (char const *help_string, int pane, int item) | |||
| 3478 | Lisp_Object pane_name; | 3445 | Lisp_Object pane_name; |
| 3479 | Lisp_Object menu_object; | 3446 | Lisp_Object menu_object; |
| 3480 | 3447 | ||
| 3481 | first_item = XVECTOR (menu_items)->u.contents; | 3448 | first_item = XVECTOR (menu_items)->contents; |
| 3482 | if (EQ (first_item[0], Qt)) | 3449 | if (EQ (first_item[0], Qt)) |
| 3483 | pane_name = first_item[MENU_ITEMS_PANE_NAME]; | 3450 | pane_name = first_item[MENU_ITEMS_PANE_NAME]; |
| 3484 | else if (EQ (first_item[0], Qquote)) | 3451 | else if (EQ (first_item[0], Qquote)) |
| @@ -3585,8 +3552,8 @@ tty_menu_new_item_coords (struct frame *f, int which, int *x, int *y) | |||
| 3585 | } | 3552 | } |
| 3586 | 3553 | ||
| 3587 | Lisp_Object | 3554 | Lisp_Object |
| 3588 | tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | 3555 | tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, |
| 3589 | Lisp_Object title, int kbd_navigation, const char **error_name) | 3556 | Lisp_Object title, bool kbd_navigation, const char **error_name) |
| 3590 | { | 3557 | { |
| 3591 | tty_menu *menu; | 3558 | tty_menu *menu; |
| 3592 | int pane, selidx, lpane, status; | 3559 | int pane, selidx, lpane, status; |
| @@ -3709,9 +3676,8 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3709 | item_data = SSDATA (item_name); | 3676 | item_data = SSDATA (item_name); |
| 3710 | 3677 | ||
| 3711 | if (lpane == TTYM_FAILURE | 3678 | if (lpane == TTYM_FAILURE |
| 3712 | || (tty_menu_add_selection (menu, lpane, item_data, | 3679 | || (! tty_menu_add_selection (menu, lpane, item_data, |
| 3713 | !NILP (enable), help_string) | 3680 | !NILP (enable), help_string))) |
| 3714 | == TTYM_FAILURE)) | ||
| 3715 | { | 3681 | { |
| 3716 | tty_menu_destroy (menu); | 3682 | tty_menu_destroy (menu); |
| 3717 | *error_name = "Can't add selection to menu"; | 3683 | *error_name = "Can't add selection to menu"; |
| @@ -8049,7 +8049,7 @@ network_interface_get_info (Lisp_Object ifname) | |||
| 8049 | 8049 | ||
| 8050 | /* Hardware address and its family. */ | 8050 | /* Hardware address and its family. */ |
| 8051 | for (n = 0; n < adapter->AddressLength; n++) | 8051 | for (n = 0; n < adapter->AddressLength; n++) |
| 8052 | p->u.contents[n] = make_number ((int) adapter->Address[n]); | 8052 | p->contents[n] = make_number ((int) adapter->Address[n]); |
| 8053 | /* Windows does not support AF_LINK or AF_PACKET family | 8053 | /* Windows does not support AF_LINK or AF_PACKET family |
| 8054 | of addresses. Use an arbitrary family number that is | 8054 | of addresses. Use an arbitrary family number that is |
| 8055 | identical to what GNU/Linux returns. */ | 8055 | identical to what GNU/Linux returns. */ |
diff --git a/src/w32fns.c b/src/w32fns.c index 3e60d68023b..eb77980af79 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1664,7 +1664,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1664 | nlines = 0; | 1664 | nlines = 0; |
| 1665 | 1665 | ||
| 1666 | /* Make sure we redisplay all windows in this frame. */ | 1666 | /* Make sure we redisplay all windows in this frame. */ |
| 1667 | ++windows_or_buffers_changed; | 1667 | windows_or_buffers_changed = 23; |
| 1668 | 1668 | ||
| 1669 | delta = nlines - FRAME_TOOL_BAR_LINES (f); | 1669 | delta = nlines - FRAME_TOOL_BAR_LINES (f); |
| 1670 | 1670 | ||
| @@ -1740,7 +1740,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 1740 | /* If we're switching from explicit to implicit, we had better | 1740 | /* If we're switching from explicit to implicit, we had better |
| 1741 | update the mode lines and thereby update the title. */ | 1741 | update the mode lines and thereby update the title. */ |
| 1742 | if (f->explicit_name && NILP (name)) | 1742 | if (f->explicit_name && NILP (name)) |
| 1743 | update_mode_lines = 1; | 1743 | update_mode_lines = 25; |
| 1744 | 1744 | ||
| 1745 | f->explicit_name = ! NILP (name); | 1745 | f->explicit_name = ! NILP (name); |
| 1746 | } | 1746 | } |
| @@ -1808,7 +1808,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) | |||
| 1808 | if (EQ (name, f->title)) | 1808 | if (EQ (name, f->title)) |
| 1809 | return; | 1809 | return; |
| 1810 | 1810 | ||
| 1811 | update_mode_lines = 1; | 1811 | update_mode_lines = 26; |
| 1812 | 1812 | ||
| 1813 | fset_title (f, name); | 1813 | fset_title (f, name); |
| 1814 | 1814 | ||
diff --git a/src/w32font.c b/src/w32font.c index 845df68f09d..effedfc04e1 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -376,26 +376,28 @@ w32font_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 376 | return font_object; | 376 | return font_object; |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | /* w32 implementation of close for font_backend. | 379 | /* w32 implementation of close for font_backend. */ |
| 380 | Close FONT on frame F. */ | ||
| 381 | void | 380 | void |
| 382 | w32font_close (struct frame *f, struct font *font) | 381 | w32font_close (struct font *font) |
| 383 | { | 382 | { |
| 384 | int i; | ||
| 385 | struct w32font_info *w32_font = (struct w32font_info *) font; | 383 | struct w32font_info *w32_font = (struct w32font_info *) font; |
| 386 | 384 | ||
| 387 | /* Delete the GDI font object. */ | 385 | if (w32_font->hfont) |
| 388 | DeleteObject (w32_font->hfont); | ||
| 389 | |||
| 390 | /* Free all the cached metrics. */ | ||
| 391 | if (w32_font->cached_metrics) | ||
| 392 | { | 386 | { |
| 393 | for (i = 0; i < w32_font->n_cache_blocks; i++) | 387 | /* Delete the GDI font object. */ |
| 394 | { | 388 | DeleteObject (w32_font->hfont); |
| 395 | xfree (w32_font->cached_metrics[i]); | 389 | w32_font->hfont = NULL; |
| 396 | } | 390 | |
| 397 | xfree (w32_font->cached_metrics); | 391 | /* Free all the cached metrics. */ |
| 398 | w32_font->cached_metrics = NULL; | 392 | if (w32_font->cached_metrics) |
| 393 | { | ||
| 394 | int i; | ||
| 395 | |||
| 396 | for (i = 0; i < w32_font->n_cache_blocks; i++) | ||
| 397 | xfree (w32_font->cached_metrics[i]); | ||
| 398 | xfree (w32_font->cached_metrics); | ||
| 399 | w32_font->cached_metrics = NULL; | ||
| 400 | } | ||
| 399 | } | 401 | } |
| 400 | } | 402 | } |
| 401 | 403 | ||
diff --git a/src/w32font.h b/src/w32font.h index 56220860863..1991492628c 100644 --- a/src/w32font.h +++ b/src/w32font.h | |||
| @@ -72,7 +72,7 @@ Lisp_Object w32font_match_internal (struct frame *f, | |||
| 72 | int opentype_only); | 72 | int opentype_only); |
| 73 | int w32font_open_internal (struct frame *f, Lisp_Object font_entity, | 73 | int w32font_open_internal (struct frame *f, Lisp_Object font_entity, |
| 74 | int pixel_size, Lisp_Object font_object); | 74 | int pixel_size, Lisp_Object font_object); |
| 75 | void w32font_close (struct frame *f, struct font *font); | 75 | void w32font_close (struct font *font); |
| 76 | int w32font_has_char (Lisp_Object entity, int c); | 76 | int w32font_has_char (Lisp_Object entity, int c); |
| 77 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, | 77 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, |
| 78 | struct font_metrics *metrics); | 78 | struct font_metrics *metrics); |
diff --git a/src/w32inevt.c b/src/w32inevt.c index c5d3fa3ad7d..dc587de1183 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -518,7 +518,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, | |||
| 518 | help_echo_window, help_echo_object, | 518 | help_echo_window, help_echo_object, |
| 519 | help_echo_pos); | 519 | help_echo_pos); |
| 520 | } | 520 | } |
| 521 | /* We alread called kbd_buffer_store_event, so indicate the | 521 | /* We already called kbd_buffer_store_event, so indicate the |
| 522 | the caller it shouldn't. */ | 522 | the caller it shouldn't. */ |
| 523 | return 0; | 523 | return 0; |
| 524 | } | 524 | } |
diff --git a/src/w32menu.c b/src/w32menu.c index 6ac02d95a63..b25652017cd 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -326,7 +326,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 326 | 326 | ||
| 327 | /* Save the frame's previous menu bar contents data. */ | 327 | /* Save the frame's previous menu bar contents data. */ |
| 328 | if (previous_menu_items_used) | 328 | if (previous_menu_items_used) |
| 329 | memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, | 329 | memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, |
| 330 | previous_menu_items_used * word_size); | 330 | previous_menu_items_used * word_size); |
| 331 | 331 | ||
| 332 | /* Fill in menu_items with the current menu bar contents. | 332 | /* Fill in menu_items with the current menu bar contents. |
diff --git a/src/w32term.c b/src/w32term.c index 6c94090f3b7..0741761febe 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -656,7 +656,13 @@ x_update_window_end (struct window *w, bool cursor_on_p, | |||
| 656 | /* If a row with mouse-face was overwritten, arrange for | 656 | /* If a row with mouse-face was overwritten, arrange for |
| 657 | XTframe_up_to_date to redisplay the mouse highlight. */ | 657 | XTframe_up_to_date to redisplay the mouse highlight. */ |
| 658 | if (mouse_face_overwritten_p) | 658 | if (mouse_face_overwritten_p) |
| 659 | reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame))); | 659 | { |
| 660 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); | ||
| 661 | |||
| 662 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; | ||
| 663 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | ||
| 664 | hlinfo->mouse_face_window = Qnil; | ||
| 665 | } | ||
| 660 | 666 | ||
| 661 | /* Unhide the caret. This won't actually show the cursor, unless it | 667 | /* Unhide the caret. This won't actually show the cursor, unless it |
| 662 | was visible before the corresponding call to HideCaret in | 668 | was visible before the corresponding call to HideCaret in |
| @@ -1596,10 +1602,7 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, | |||
| 1596 | xgcv.foreground = default_pixel; | 1602 | xgcv.foreground = default_pixel; |
| 1597 | pixel = background; | 1603 | pixel = background; |
| 1598 | if (w32_alloc_lighter_color (f, &pixel, factor, delta)) | 1604 | if (w32_alloc_lighter_color (f, &pixel, factor, delta)) |
| 1599 | { | 1605 | xgcv.foreground = relief->pixel = pixel; |
| 1600 | relief->allocated_p = 1; | ||
| 1601 | xgcv.foreground = relief->pixel = pixel; | ||
| 1602 | } | ||
| 1603 | 1606 | ||
| 1604 | if (relief->gc == 0) | 1607 | if (relief->gc == 0) |
| 1605 | { | 1608 | { |
| @@ -6001,17 +6004,6 @@ x_free_frame_resources (struct frame *f) | |||
| 6001 | 6004 | ||
| 6002 | free_frame_menubar (f); | 6005 | free_frame_menubar (f); |
| 6003 | 6006 | ||
| 6004 | unload_color (f, FRAME_FOREGROUND_PIXEL (f)); | ||
| 6005 | unload_color (f, FRAME_BACKGROUND_PIXEL (f)); | ||
| 6006 | unload_color (f, f->output_data.w32->cursor_pixel); | ||
| 6007 | unload_color (f, f->output_data.w32->cursor_foreground_pixel); | ||
| 6008 | unload_color (f, f->output_data.w32->border_pixel); | ||
| 6009 | unload_color (f, f->output_data.w32->mouse_pixel); | ||
| 6010 | if (f->output_data.w32->white_relief.allocated_p) | ||
| 6011 | unload_color (f, f->output_data.w32->white_relief.pixel); | ||
| 6012 | if (f->output_data.w32->black_relief.allocated_p) | ||
| 6013 | unload_color (f, f->output_data.w32->black_relief.pixel); | ||
| 6014 | |||
| 6015 | if (FRAME_FACE_CACHE (f)) | 6007 | if (FRAME_FACE_CACHE (f)) |
| 6016 | free_frame_faces (f); | 6008 | free_frame_faces (f); |
| 6017 | 6009 | ||
diff --git a/src/w32term.h b/src/w32term.h index 956e03d336c..b3c0cf56c7b 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -376,7 +376,6 @@ struct w32_output | |||
| 376 | { | 376 | { |
| 377 | XGCValues *gc; | 377 | XGCValues *gc; |
| 378 | unsigned long pixel; | 378 | unsigned long pixel; |
| 379 | int allocated_p; | ||
| 380 | } | 379 | } |
| 381 | black_relief, white_relief; | 380 | black_relief, white_relief; |
| 382 | 381 | ||
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index b31baa0e65c..fb3fbd0d607 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c | |||
| @@ -135,7 +135,7 @@ uniscribe_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static void | 137 | static void |
| 138 | uniscribe_close (struct frame *f, struct font *font) | 138 | uniscribe_close (struct font *font) |
| 139 | { | 139 | { |
| 140 | struct uniscribe_font_info *uniscribe_font | 140 | struct uniscribe_font_info *uniscribe_font |
| 141 | = (struct uniscribe_font_info *) font; | 141 | = (struct uniscribe_font_info *) font; |
| @@ -143,7 +143,7 @@ uniscribe_close (struct frame *f, struct font *font) | |||
| 143 | if (uniscribe_font->cache) | 143 | if (uniscribe_font->cache) |
| 144 | ScriptFreeCache (&(uniscribe_font->cache)); | 144 | ScriptFreeCache (&(uniscribe_font->cache)); |
| 145 | 145 | ||
| 146 | w32font_close (f, font); | 146 | w32font_close (font); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* Return a list describing which scripts/languages FONT supports by | 149 | /* Return a list describing which scripts/languages FONT supports by |
diff --git a/src/window.c b/src/window.c index ecbe5fa5365..bc0adaf459f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -500,7 +500,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 500 | 500 | ||
| 501 | select_window_1 (window, inhibit_point_swap); | 501 | select_window_1 (window, inhibit_point_swap); |
| 502 | bset_last_selected_window (XBUFFER (w->contents), window); | 502 | bset_last_selected_window (XBUFFER (w->contents), window); |
| 503 | windows_or_buffers_changed++; | 503 | windows_or_buffers_changed = 24; |
| 504 | 504 | ||
| 505 | record_and_return: | 505 | record_and_return: |
| 506 | /* record_buffer can run QUIT, so make sure it is run only after we have | 506 | /* record_buffer can run QUIT, so make sure it is run only after we have |
| @@ -1553,7 +1553,7 @@ Return POS. */) | |||
| 1553 | set_marker_restricted (w->pointm, pos, w->contents); | 1553 | set_marker_restricted (w->pointm, pos, w->contents); |
| 1554 | /* We have to make sure that redisplay updates the window to show | 1554 | /* We have to make sure that redisplay updates the window to show |
| 1555 | the new value of point. */ | 1555 | the new value of point. */ |
| 1556 | ++windows_or_buffers_changed; | 1556 | windows_or_buffers_changed = 25; |
| 1557 | } | 1557 | } |
| 1558 | 1558 | ||
| 1559 | return pos; | 1559 | return pos; |
| @@ -1576,7 +1576,7 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1576 | w->update_mode_line = 1; | 1576 | w->update_mode_line = 1; |
| 1577 | if (w != XWINDOW (selected_window)) | 1577 | if (w != XWINDOW (selected_window)) |
| 1578 | /* Enforce full redisplay. FIXME: make it more selective. */ | 1578 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 1579 | windows_or_buffers_changed++; | 1579 | windows_or_buffers_changed = 26; |
| 1580 | 1580 | ||
| 1581 | return pos; | 1581 | return pos; |
| 1582 | } | 1582 | } |
| @@ -2639,7 +2639,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2639 | mark_window_display_accurate (window, 0); | 2639 | mark_window_display_accurate (window, 0); |
| 2640 | w->update_mode_line = 1; | 2640 | w->update_mode_line = 1; |
| 2641 | XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; | 2641 | XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; |
| 2642 | ++update_mode_lines; | 2642 | update_mode_lines = 27; |
| 2643 | best_window = window; | 2643 | best_window = window; |
| 2644 | } | 2644 | } |
| 2645 | break; | 2645 | break; |
| @@ -2837,7 +2837,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2837 | } | 2837 | } |
| 2838 | free_window_matrices (r); | 2838 | free_window_matrices (r); |
| 2839 | 2839 | ||
| 2840 | windows_or_buffers_changed++; | 2840 | windows_or_buffers_changed = 27; |
| 2841 | Vwindow_list = Qnil; | 2841 | Vwindow_list = Qnil; |
| 2842 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 2842 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 2843 | resize_failed = 0; | 2843 | resize_failed = 0; |
| @@ -3171,7 +3171,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3171 | } | 3171 | } |
| 3172 | /* Maybe we could move this into the `if' but it's not obviously safe and | 3172 | /* Maybe we could move this into the `if' but it's not obviously safe and |
| 3173 | I doubt it's worth the trouble. */ | 3173 | I doubt it's worth the trouble. */ |
| 3174 | windows_or_buffers_changed++; | 3174 | windows_or_buffers_changed = 28; |
| 3175 | 3175 | ||
| 3176 | /* We must select BUFFER for running the window-scroll-functions. */ | 3176 | /* We must select BUFFER for running the window-scroll-functions. */ |
| 3177 | /* We can't check ! NILP (Vwindow_scroll_functions) here | 3177 | /* We can't check ! NILP (Vwindow_scroll_functions) here |
| @@ -3278,8 +3278,8 @@ displaying that buffer. */) | |||
| 3278 | { | 3278 | { |
| 3279 | if (NILP (object)) | 3279 | if (NILP (object)) |
| 3280 | { | 3280 | { |
| 3281 | windows_or_buffers_changed++; | 3281 | windows_or_buffers_changed = 29; |
| 3282 | update_mode_lines++; | 3282 | update_mode_lines = 28; |
| 3283 | return Qt; | 3283 | return Qt; |
| 3284 | } | 3284 | } |
| 3285 | 3285 | ||
| @@ -3290,7 +3290,7 @@ displaying that buffer. */) | |||
| 3290 | w->update_mode_line = 1; | 3290 | w->update_mode_line = 1; |
| 3291 | if (BUFFERP (w->contents)) | 3291 | if (BUFFERP (w->contents)) |
| 3292 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 3292 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 3293 | ++update_mode_lines; | 3293 | update_mode_lines = 29; |
| 3294 | return Qt; | 3294 | return Qt; |
| 3295 | } | 3295 | } |
| 3296 | 3296 | ||
| @@ -3646,7 +3646,7 @@ be applied on the Elisp level. */) | |||
| 3646 | block_input (); | 3646 | block_input (); |
| 3647 | window_resize_apply (r, horflag); | 3647 | window_resize_apply (r, horflag); |
| 3648 | 3648 | ||
| 3649 | windows_or_buffers_changed++; | 3649 | windows_or_buffers_changed = 30; |
| 3650 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3650 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3651 | 3651 | ||
| 3652 | adjust_frame_glyphs (f); | 3652 | adjust_frame_glyphs (f); |
| @@ -3741,7 +3741,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag) | |||
| 3741 | } | 3741 | } |
| 3742 | } | 3742 | } |
| 3743 | 3743 | ||
| 3744 | windows_or_buffers_changed++; | 3744 | windows_or_buffers_changed = 31; |
| 3745 | } | 3745 | } |
| 3746 | 3746 | ||
| 3747 | 3747 | ||
| @@ -3862,7 +3862,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3862 | else | 3862 | else |
| 3863 | p = XWINDOW (o->parent); | 3863 | p = XWINDOW (o->parent); |
| 3864 | 3864 | ||
| 3865 | windows_or_buffers_changed++; | 3865 | windows_or_buffers_changed = 32; |
| 3866 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3866 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3867 | new = make_window (); | 3867 | new = make_window (); |
| 3868 | n = XWINDOW (new); | 3868 | n = XWINDOW (new); |
| @@ -4012,7 +4012,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4012 | hlinfo->mouse_face_window = Qnil; | 4012 | hlinfo->mouse_face_window = Qnil; |
| 4013 | } | 4013 | } |
| 4014 | 4014 | ||
| 4015 | windows_or_buffers_changed++; | 4015 | windows_or_buffers_changed = 33; |
| 4016 | Vwindow_list = Qnil; | 4016 | Vwindow_list = Qnil; |
| 4017 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4017 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 4018 | 4018 | ||
| @@ -4134,7 +4134,7 @@ grow_mini_window (struct window *w, int delta) | |||
| 4134 | w->top_line = r->top_line + r->total_lines; | 4134 | w->top_line = r->top_line + r->total_lines; |
| 4135 | w->total_lines -= XINT (value); | 4135 | w->total_lines -= XINT (value); |
| 4136 | /* Enforce full redisplay. FIXME: make it more selective. */ | 4136 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 4137 | windows_or_buffers_changed++; | 4137 | windows_or_buffers_changed = 34; |
| 4138 | adjust_frame_glyphs (f); | 4138 | adjust_frame_glyphs (f); |
| 4139 | unblock_input (); | 4139 | unblock_input (); |
| 4140 | } | 4140 | } |
| @@ -4168,7 +4168,7 @@ shrink_mini_window (struct window *w) | |||
| 4168 | w->top_line = r->top_line + r->total_lines; | 4168 | w->top_line = r->top_line + r->total_lines; |
| 4169 | w->total_lines = 1; | 4169 | w->total_lines = 1; |
| 4170 | /* Enforce full redisplay. FIXME: make it more selective. */ | 4170 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 4171 | windows_or_buffers_changed++; | 4171 | windows_or_buffers_changed = 35; |
| 4172 | adjust_frame_glyphs (f); | 4172 | adjust_frame_glyphs (f); |
| 4173 | unblock_input (); | 4173 | unblock_input (); |
| 4174 | } | 4174 | } |
| @@ -4208,7 +4208,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4208 | w->total_lines = XFASTINT (w->new_total); | 4208 | w->total_lines = XFASTINT (w->new_total); |
| 4209 | w->top_line = r->top_line + r->total_lines; | 4209 | w->top_line = r->top_line + r->total_lines; |
| 4210 | 4210 | ||
| 4211 | windows_or_buffers_changed++; | 4211 | windows_or_buffers_changed = 36; |
| 4212 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4212 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 4213 | adjust_frame_glyphs (f); | 4213 | adjust_frame_glyphs (f); |
| 4214 | unblock_input (); | 4214 | unblock_input (); |
| @@ -4830,7 +4830,7 @@ scroll_command (Lisp_Object n, int direction) | |||
| 4830 | Fset_buffer (XWINDOW (selected_window)->contents); | 4830 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 4831 | 4831 | ||
| 4832 | /* Make redisplay consider other windows than just selected_window. */ | 4832 | /* Make redisplay consider other windows than just selected_window. */ |
| 4833 | ++windows_or_buffers_changed; | 4833 | windows_or_buffers_changed = 37; |
| 4834 | } | 4834 | } |
| 4835 | 4835 | ||
| 4836 | if (NILP (n)) | 4836 | if (NILP (n)) |
| @@ -4940,7 +4940,7 @@ specifies the window to scroll. This takes precedence over | |||
| 4940 | 4940 | ||
| 4941 | /* Don't screw up if window_scroll gets an error. */ | 4941 | /* Don't screw up if window_scroll gets an error. */ |
| 4942 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4942 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 4943 | ++windows_or_buffers_changed; | 4943 | windows_or_buffers_changed = 38; |
| 4944 | 4944 | ||
| 4945 | Fset_buffer (w->contents); | 4945 | Fset_buffer (w->contents); |
| 4946 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); | 4946 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); |
| @@ -5405,7 +5405,7 @@ struct saved_window | |||
| 5405 | }; | 5405 | }; |
| 5406 | 5406 | ||
| 5407 | #define SAVED_WINDOW_N(swv,n) \ | 5407 | #define SAVED_WINDOW_N(swv,n) \ |
| 5408 | ((struct saved_window *) (XVECTOR ((swv)->u.contents[(n)]))) | 5408 | ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) |
| 5409 | 5409 | ||
| 5410 | DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, | 5410 | DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, |
| 5411 | doc: /* Return t if OBJECT is a window-configuration object. */) | 5411 | doc: /* Return t if OBJECT is a window-configuration object. */) |
| @@ -5575,7 +5575,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5575 | BUF_PT_BYTE (XBUFFER (w->contents))); | 5575 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5576 | } | 5576 | } |
| 5577 | 5577 | ||
| 5578 | windows_or_buffers_changed++; | 5578 | windows_or_buffers_changed = 39; |
| 5579 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 5579 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 5580 | 5580 | ||
| 5581 | /* Problem: Freeing all matrices and later allocating them again | 5581 | /* Problem: Freeing all matrices and later allocating them again |
| @@ -6103,7 +6103,7 @@ apply_window_adjustment (struct window *w) | |||
| 6103 | adjust_window_margins (w); | 6103 | adjust_window_margins (w); |
| 6104 | clear_glyph_matrix (w->current_matrix); | 6104 | clear_glyph_matrix (w->current_matrix); |
| 6105 | w->window_end_valid = 0; | 6105 | w->window_end_valid = 0; |
| 6106 | windows_or_buffers_changed++; | 6106 | windows_or_buffers_changed = 40; |
| 6107 | adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); | 6107 | adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); |
| 6108 | } | 6108 | } |
| 6109 | 6109 | ||
diff --git a/src/window.h b/src/window.h index cc4332ccf7f..f619b82e8a3 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -341,10 +341,6 @@ struct window | |||
| 341 | y-direction (smooth scrolling). */ | 341 | y-direction (smooth scrolling). */ |
| 342 | int vscroll; | 342 | int vscroll; |
| 343 | 343 | ||
| 344 | /* If we have highlighted the region (or any part of it), the mark | ||
| 345 | (region start) position; otherwise zero. */ | ||
| 346 | ptrdiff_t region_showing; | ||
| 347 | |||
| 348 | /* Z_BYTE - buffer position of the last glyph in the current matrix of W. | 344 | /* Z_BYTE - buffer position of the last glyph in the current matrix of W. |
| 349 | Should be nonnegative, and only valid if window_end_valid is nonzero. */ | 345 | Should be nonnegative, and only valid if window_end_valid is nonzero. */ |
| 350 | ptrdiff_t window_end_bytepos; | 346 | ptrdiff_t window_end_bytepos; |
diff --git a/src/xdisp.c b/src/xdisp.c index 395a74e4122..47855a1de3c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -737,7 +737,7 @@ ptrdiff_t help_echo_pos; | |||
| 737 | 737 | ||
| 738 | Lisp_Object previous_help_echo_string; | 738 | Lisp_Object previous_help_echo_string; |
| 739 | 739 | ||
| 740 | /* Platform-independent portion of hourglass implementation. */ | 740 | /* Platform-independent portion of hourglass implementation. */ |
| 741 | 741 | ||
| 742 | #ifdef HAVE_WINDOW_SYSTEM | 742 | #ifdef HAVE_WINDOW_SYSTEM |
| 743 | 743 | ||
| @@ -2601,24 +2601,6 @@ check_window_end (struct window *w) | |||
| 2601 | 2601 | ||
| 2602 | #endif /* GLYPH_DEBUG and ENABLE_CHECKING */ | 2602 | #endif /* GLYPH_DEBUG and ENABLE_CHECKING */ |
| 2603 | 2603 | ||
| 2604 | /* Return mark position if current buffer has the region of non-zero length, | ||
| 2605 | or -1 otherwise. */ | ||
| 2606 | |||
| 2607 | static ptrdiff_t | ||
| 2608 | markpos_of_region (void) | ||
| 2609 | { | ||
| 2610 | if (!NILP (Vtransient_mark_mode) | ||
| 2611 | && !NILP (BVAR (current_buffer, mark_active)) | ||
| 2612 | && XMARKER (BVAR (current_buffer, mark))->buffer != NULL) | ||
| 2613 | { | ||
| 2614 | ptrdiff_t markpos = XMARKER (BVAR (current_buffer, mark))->charpos; | ||
| 2615 | |||
| 2616 | if (markpos != PT) | ||
| 2617 | return markpos; | ||
| 2618 | } | ||
| 2619 | return -1; | ||
| 2620 | } | ||
| 2621 | |||
| 2622 | /*********************************************************************** | 2604 | /*********************************************************************** |
| 2623 | Iterator initialization | 2605 | Iterator initialization |
| 2624 | ***********************************************************************/ | 2606 | ***********************************************************************/ |
| @@ -2647,7 +2629,6 @@ init_iterator (struct it *it, struct window *w, | |||
| 2647 | ptrdiff_t charpos, ptrdiff_t bytepos, | 2629 | ptrdiff_t charpos, ptrdiff_t bytepos, |
| 2648 | struct glyph_row *row, enum face_id base_face_id) | 2630 | struct glyph_row *row, enum face_id base_face_id) |
| 2649 | { | 2631 | { |
| 2650 | ptrdiff_t markpos; | ||
| 2651 | enum face_id remapped_base_face_id = base_face_id; | 2632 | enum face_id remapped_base_face_id = base_face_id; |
| 2652 | 2633 | ||
| 2653 | /* Some precondition checks. */ | 2634 | /* Some precondition checks. */ |
| @@ -2751,28 +2732,6 @@ init_iterator (struct it *it, struct window *w, | |||
| 2751 | /* Are multibyte characters enabled in current_buffer? */ | 2732 | /* Are multibyte characters enabled in current_buffer? */ |
| 2752 | it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 2733 | it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 2753 | 2734 | ||
| 2754 | /* If visible region is of non-zero length, set IT->region_beg_charpos | ||
| 2755 | and IT->region_end_charpos to the start and end of a visible region | ||
| 2756 | in window IT->w. Set both to -1 to indicate no region. */ | ||
| 2757 | markpos = markpos_of_region (); | ||
| 2758 | if (markpos >= 0 | ||
| 2759 | /* Maybe highlight only in selected window. */ | ||
| 2760 | && (/* Either show region everywhere. */ | ||
| 2761 | highlight_nonselected_windows | ||
| 2762 | /* Or show region in the selected window. */ | ||
| 2763 | || w == XWINDOW (selected_window) | ||
| 2764 | /* Or show the region if we are in the mini-buffer and W is | ||
| 2765 | the window the mini-buffer refers to. */ | ||
| 2766 | || (MINI_WINDOW_P (XWINDOW (selected_window)) | ||
| 2767 | && WINDOWP (minibuf_selected_window) | ||
| 2768 | && w == XWINDOW (minibuf_selected_window)))) | ||
| 2769 | { | ||
| 2770 | it->region_beg_charpos = min (PT, markpos); | ||
| 2771 | it->region_end_charpos = max (PT, markpos); | ||
| 2772 | } | ||
| 2773 | else | ||
| 2774 | it->region_beg_charpos = it->region_end_charpos = -1; | ||
| 2775 | |||
| 2776 | /* Get the position at which the redisplay_end_trigger hook should | 2735 | /* Get the position at which the redisplay_end_trigger hook should |
| 2777 | be run, if it is to be run at all. */ | 2736 | be run, if it is to be run at all. */ |
| 2778 | if (MARKERP (w->redisplay_end_trigger) | 2737 | if (MARKERP (w->redisplay_end_trigger) |
| @@ -3406,16 +3365,6 @@ compute_stop_pos (struct it *it) | |||
| 3406 | if (pos < it->stop_charpos) | 3365 | if (pos < it->stop_charpos) |
| 3407 | it->stop_charpos = pos; | 3366 | it->stop_charpos = pos; |
| 3408 | 3367 | ||
| 3409 | /* If showing the region, we have to stop at the region | ||
| 3410 | start or end because the face might change there. */ | ||
| 3411 | if (it->region_beg_charpos > 0) | ||
| 3412 | { | ||
| 3413 | if (IT_CHARPOS (*it) < it->region_beg_charpos) | ||
| 3414 | it->stop_charpos = min (it->stop_charpos, it->region_beg_charpos); | ||
| 3415 | else if (IT_CHARPOS (*it) < it->region_end_charpos) | ||
| 3416 | it->stop_charpos = min (it->stop_charpos, it->region_end_charpos); | ||
| 3417 | } | ||
| 3418 | |||
| 3419 | /* Set up variables for computing the stop position from text | 3368 | /* Set up variables for computing the stop position from text |
| 3420 | property changes. */ | 3369 | property changes. */ |
| 3421 | XSETBUFFER (object, current_buffer); | 3370 | XSETBUFFER (object, current_buffer); |
| @@ -3799,8 +3748,6 @@ handle_face_prop (struct it *it) | |||
| 3799 | new_face_id | 3748 | new_face_id |
| 3800 | = face_at_buffer_position (it->w, | 3749 | = face_at_buffer_position (it->w, |
| 3801 | IT_CHARPOS (*it), | 3750 | IT_CHARPOS (*it), |
| 3802 | it->region_beg_charpos, | ||
| 3803 | it->region_end_charpos, | ||
| 3804 | &next_stop, | 3751 | &next_stop, |
| 3805 | (IT_CHARPOS (*it) | 3752 | (IT_CHARPOS (*it) |
| 3806 | + TEXT_PROP_DISTANCE_LIMIT), | 3753 | + TEXT_PROP_DISTANCE_LIMIT), |
| @@ -3877,8 +3824,6 @@ handle_face_prop (struct it *it) | |||
| 3877 | base_face_id | 3824 | base_face_id |
| 3878 | = face_for_overlay_string (it->w, | 3825 | = face_for_overlay_string (it->w, |
| 3879 | IT_CHARPOS (*it), | 3826 | IT_CHARPOS (*it), |
| 3880 | it->region_beg_charpos, | ||
| 3881 | it->region_end_charpos, | ||
| 3882 | &next_stop, | 3827 | &next_stop, |
| 3883 | (IT_CHARPOS (*it) | 3828 | (IT_CHARPOS (*it) |
| 3884 | + TEXT_PROP_DISTANCE_LIMIT), | 3829 | + TEXT_PROP_DISTANCE_LIMIT), |
| @@ -3907,8 +3852,6 @@ handle_face_prop (struct it *it) | |||
| 3907 | it->string, | 3852 | it->string, |
| 3908 | IT_STRING_CHARPOS (*it), | 3853 | IT_STRING_CHARPOS (*it), |
| 3909 | bufpos, | 3854 | bufpos, |
| 3910 | it->region_beg_charpos, | ||
| 3911 | it->region_end_charpos, | ||
| 3912 | &next_stop, | 3855 | &next_stop, |
| 3913 | base_face_id, 0); | 3856 | base_face_id, 0); |
| 3914 | 3857 | ||
| @@ -4051,8 +3994,6 @@ face_before_or_after_it_pos (struct it *it, int before_p) | |||
| 4051 | it->string, | 3994 | it->string, |
| 4052 | charpos, | 3995 | charpos, |
| 4053 | bufpos, | 3996 | bufpos, |
| 4054 | it->region_beg_charpos, | ||
| 4055 | it->region_end_charpos, | ||
| 4056 | &next_check_charpos, | 3997 | &next_check_charpos, |
| 4057 | base_face_id, 0); | 3998 | base_face_id, 0); |
| 4058 | 3999 | ||
| @@ -4142,8 +4083,6 @@ face_before_or_after_it_pos (struct it *it, int before_p) | |||
| 4142 | /* Determine face for CHARSET_ASCII, or unibyte. */ | 4083 | /* Determine face for CHARSET_ASCII, or unibyte. */ |
| 4143 | face_id = face_at_buffer_position (it->w, | 4084 | face_id = face_at_buffer_position (it->w, |
| 4144 | CHARPOS (pos), | 4085 | CHARPOS (pos), |
| 4145 | it->region_beg_charpos, | ||
| 4146 | it->region_end_charpos, | ||
| 4147 | &next_check_charpos, | 4086 | &next_check_charpos, |
| 4148 | limit, 0, -1); | 4087 | limit, 0, -1); |
| 4149 | 4088 | ||
| @@ -4473,8 +4412,8 @@ setup_for_ellipsis (struct it *it, int len) | |||
| 4473 | if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp))) | 4412 | if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp))) |
| 4474 | { | 4413 | { |
| 4475 | struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); | 4414 | struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); |
| 4476 | it->dpvec = v->u.contents; | 4415 | it->dpvec = v->contents; |
| 4477 | it->dpend = v->u.contents + v->header.size; | 4416 | it->dpend = v->contents + v->header.size; |
| 4478 | } | 4417 | } |
| 4479 | else | 4418 | else |
| 4480 | { | 4419 | { |
| @@ -6441,9 +6380,6 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6441 | ptrdiff_t charpos, ptrdiff_t precision, int field_width, | 6380 | ptrdiff_t charpos, ptrdiff_t precision, int field_width, |
| 6442 | int multibyte) | 6381 | int multibyte) |
| 6443 | { | 6382 | { |
| 6444 | /* No region in strings. */ | ||
| 6445 | it->region_beg_charpos = it->region_end_charpos = -1; | ||
| 6446 | |||
| 6447 | /* No text property checks performed by default, but see below. */ | 6383 | /* No text property checks performed by default, but see below. */ |
| 6448 | it->stop_charpos = -1; | 6384 | it->stop_charpos = -1; |
| 6449 | 6385 | ||
| @@ -6618,8 +6554,8 @@ lookup_glyphless_char_display (int c, struct it *it) | |||
| 6618 | if (c >= 0) | 6554 | if (c >= 0) |
| 6619 | { | 6555 | { |
| 6620 | glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c); | 6556 | glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c); |
| 6621 | if (CONSP (glyphless_method)) | 6557 | if (CONSP (glyphless_method)) |
| 6622 | glyphless_method = FRAME_WINDOW_P (it->f) | 6558 | glyphless_method = FRAME_WINDOW_P (it->f) |
| 6623 | ? XCAR (glyphless_method) | 6559 | ? XCAR (glyphless_method) |
| 6624 | : XCDR (glyphless_method); | 6560 | : XCDR (glyphless_method); |
| 6625 | } | 6561 | } |
| @@ -6778,8 +6714,8 @@ get_next_display_element (struct it *it) | |||
| 6778 | if (v->header.size) | 6714 | if (v->header.size) |
| 6779 | { | 6715 | { |
| 6780 | it->dpvec_char_len = it->len; | 6716 | it->dpvec_char_len = it->len; |
| 6781 | it->dpvec = v->u.contents; | 6717 | it->dpvec = v->contents; |
| 6782 | it->dpend = v->u.contents + v->header.size; | 6718 | it->dpend = v->contents + v->header.size; |
| 6783 | it->current.dpvec_index = 0; | 6719 | it->current.dpvec_index = 0; |
| 6784 | it->dpvec_face_id = -1; | 6720 | it->dpvec_face_id = -1; |
| 6785 | it->saved_face_id = it->face_id; | 6721 | it->saved_face_id = it->face_id; |
| @@ -6823,7 +6759,7 @@ get_next_display_element (struct it *it) | |||
| 6823 | 6759 | ||
| 6824 | Non-printable characters and raw-byte characters are also | 6760 | Non-printable characters and raw-byte characters are also |
| 6825 | translated to octal form. */ | 6761 | translated to octal form. */ |
| 6826 | if (((c < ' ' || c == 127) /* ASCII control chars */ | 6762 | if (((c < ' ' || c == 127) /* ASCII control chars. */ |
| 6827 | ? (it->area != TEXT_AREA | 6763 | ? (it->area != TEXT_AREA |
| 6828 | /* In mode line, treat \n, \t like other crl chars. */ | 6764 | /* In mode line, treat \n, \t like other crl chars. */ |
| 6829 | || (c != '\t' | 6765 | || (c != '\t' |
| @@ -7033,8 +6969,7 @@ get_next_display_element (struct it *it) | |||
| 7033 | INC_TEXT_POS (pos, it->multibyte_p); | 6969 | INC_TEXT_POS (pos, it->multibyte_p); |
| 7034 | 6970 | ||
| 7035 | next_face_id = face_at_buffer_position | 6971 | next_face_id = face_at_buffer_position |
| 7036 | (it->w, CHARPOS (pos), it->region_beg_charpos, | 6972 | (it->w, CHARPOS (pos), &ignore, |
| 7037 | it->region_end_charpos, &ignore, | ||
| 7038 | (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT), 0, | 6973 | (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT), 0, |
| 7039 | -1); | 6974 | -1); |
| 7040 | it->end_of_box_run_p | 6975 | it->end_of_box_run_p |
| @@ -9337,7 +9272,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) | |||
| 9337 | 9272 | ||
| 9338 | /* The commented-out optimization uses vmotion on terminals. This | 9273 | /* The commented-out optimization uses vmotion on terminals. This |
| 9339 | gives bad results, because elements like it->what, on which | 9274 | gives bad results, because elements like it->what, on which |
| 9340 | callers such as pos_visible_p rely, aren't updated. */ | 9275 | callers such as pos_visible_p rely, aren't updated. */ |
| 9341 | /* struct position pos; | 9276 | /* struct position pos; |
| 9342 | if (!FRAME_WINDOW_P (it->f)) | 9277 | if (!FRAME_WINDOW_P (it->f)) |
| 9343 | { | 9278 | { |
| @@ -9355,7 +9290,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) | |||
| 9355 | { | 9290 | { |
| 9356 | /* DVPOS == 0 means move to the start of the screen line. */ | 9291 | /* DVPOS == 0 means move to the start of the screen line. */ |
| 9357 | move_it_vertically_backward (it, 0); | 9292 | move_it_vertically_backward (it, 0); |
| 9358 | /* Let next call to line_bottom_y calculate real line height */ | 9293 | /* Let next call to line_bottom_y calculate real line height. */ |
| 9359 | last_height = 0; | 9294 | last_height = 0; |
| 9360 | } | 9295 | } |
| 9361 | else if (dvpos > 0) | 9296 | else if (dvpos > 0) |
| @@ -9553,6 +9488,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte) | |||
| 9553 | } | 9488 | } |
| 9554 | 9489 | ||
| 9555 | bset_undo_list (current_buffer, Qt); | 9490 | bset_undo_list (current_buffer, Qt); |
| 9491 | bset_cache_long_scans (current_buffer, Qnil); | ||
| 9556 | 9492 | ||
| 9557 | oldpoint = message_dolog_marker1; | 9493 | oldpoint = message_dolog_marker1; |
| 9558 | set_marker_restricted_both (oldpoint, Qnil, PT, PT_BYTE); | 9494 | set_marker_restricted_both (oldpoint, Qnil, PT, PT_BYTE); |
| @@ -9698,7 +9634,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte) | |||
| 9698 | shown in some window. So we must manually incrementing | 9634 | shown in some window. So we must manually incrementing |
| 9699 | windows_or_buffers_changed here to make up for that. */ | 9635 | windows_or_buffers_changed here to make up for that. */ |
| 9700 | if (shown) | 9636 | if (shown) |
| 9701 | windows_or_buffers_changed++; | 9637 | windows_or_buffers_changed = 41; |
| 9702 | else | 9638 | else |
| 9703 | windows_or_buffers_changed = old_windows_or_buffers_changed; | 9639 | windows_or_buffers_changed = old_windows_or_buffers_changed; |
| 9704 | message_log_need_newline = !nlflag; | 9640 | message_log_need_newline = !nlflag; |
| @@ -9793,7 +9729,11 @@ message3_nolog (Lisp_Object m) | |||
| 9793 | putc ('\n', stderr); | 9729 | putc ('\n', stderr); |
| 9794 | noninteractive_need_newline = 0; | 9730 | noninteractive_need_newline = 0; |
| 9795 | if (STRINGP (m)) | 9731 | if (STRINGP (m)) |
| 9796 | fwrite (SDATA (m), SBYTES (m), 1, stderr); | 9732 | { |
| 9733 | Lisp_Object s = ENCODE_SYSTEM (m); | ||
| 9734 | |||
| 9735 | fwrite (SDATA (s), SBYTES (s), 1, stderr); | ||
| 9736 | } | ||
| 9797 | if (cursor_in_echo_area == 0) | 9737 | if (cursor_in_echo_area == 0) |
| 9798 | fprintf (stderr, "\n"); | 9738 | fprintf (stderr, "\n"); |
| 9799 | fflush (stderr); | 9739 | fflush (stderr); |
| @@ -9868,13 +9808,19 @@ message_with_string (const char *m, Lisp_Object string, int log) | |||
| 9868 | { | 9808 | { |
| 9869 | if (m) | 9809 | if (m) |
| 9870 | { | 9810 | { |
| 9811 | /* ENCODE_SYSTEM below can GC and/or relocate the Lisp | ||
| 9812 | String whose data pointer might be passed to us in M. So | ||
| 9813 | we use a local copy. */ | ||
| 9814 | char *fmt = xstrdup (m); | ||
| 9815 | |||
| 9871 | if (noninteractive_need_newline) | 9816 | if (noninteractive_need_newline) |
| 9872 | putc ('\n', stderr); | 9817 | putc ('\n', stderr); |
| 9873 | noninteractive_need_newline = 0; | 9818 | noninteractive_need_newline = 0; |
| 9874 | fprintf (stderr, m, SDATA (string)); | 9819 | fprintf (stderr, fmt, SDATA (ENCODE_SYSTEM (string))); |
| 9875 | if (!cursor_in_echo_area) | 9820 | if (!cursor_in_echo_area) |
| 9876 | fprintf (stderr, "\n"); | 9821 | fprintf (stderr, "\n"); |
| 9877 | fflush (stderr); | 9822 | fflush (stderr); |
| 9823 | xfree (fmt); | ||
| 9878 | } | 9824 | } |
| 9879 | } | 9825 | } |
| 9880 | else if (INTERACTIVE) | 9826 | else if (INTERACTIVE) |
| @@ -10391,8 +10337,8 @@ resize_echo_area_exactly (void) | |||
| 10391 | (intptr_t) w, resize_exactly); | 10337 | (intptr_t) w, resize_exactly); |
| 10392 | if (resized_p) | 10338 | if (resized_p) |
| 10393 | { | 10339 | { |
| 10394 | ++windows_or_buffers_changed; | 10340 | windows_or_buffers_changed = 42; |
| 10395 | ++update_mode_lines; | 10341 | update_mode_lines = 30; |
| 10396 | redisplay_internal (); | 10342 | redisplay_internal (); |
| 10397 | } | 10343 | } |
| 10398 | } | 10344 | } |
| @@ -10788,7 +10734,7 @@ clear_garbaged_frames (void) | |||
| 10788 | 10734 | ||
| 10789 | frame_garbaged = 0; | 10735 | frame_garbaged = 0; |
| 10790 | if (changed_count) | 10736 | if (changed_count) |
| 10791 | ++windows_or_buffers_changed; | 10737 | windows_or_buffers_changed = 43; |
| 10792 | } | 10738 | } |
| 10793 | } | 10739 | } |
| 10794 | 10740 | ||
| @@ -10857,7 +10803,7 @@ echo_area_display (int update_frame_p) | |||
| 10857 | pending input. */ | 10803 | pending input. */ |
| 10858 | ptrdiff_t count = SPECPDL_INDEX (); | 10804 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10859 | specbind (Qredisplay_dont_pause, Qt); | 10805 | specbind (Qredisplay_dont_pause, Qt); |
| 10860 | windows_or_buffers_changed = 1; | 10806 | windows_or_buffers_changed = 44; |
| 10861 | redisplay_internal (); | 10807 | redisplay_internal (); |
| 10862 | unbind_to (count, Qnil); | 10808 | unbind_to (count, Qnil); |
| 10863 | } | 10809 | } |
| @@ -10876,11 +10822,11 @@ echo_area_display (int update_frame_p) | |||
| 10876 | redisplay displays the minibuffer, so that the cursor will | 10822 | redisplay displays the minibuffer, so that the cursor will |
| 10877 | be replaced with what the minibuffer wants. */ | 10823 | be replaced with what the minibuffer wants. */ |
| 10878 | if (cursor_in_echo_area) | 10824 | if (cursor_in_echo_area) |
| 10879 | ++windows_or_buffers_changed; | 10825 | windows_or_buffers_changed = 45; |
| 10880 | } | 10826 | } |
| 10881 | } | 10827 | } |
| 10882 | else if (!EQ (mini_window, selected_window)) | 10828 | else if (!EQ (mini_window, selected_window)) |
| 10883 | windows_or_buffers_changed++; | 10829 | windows_or_buffers_changed = 46; |
| 10884 | 10830 | ||
| 10885 | /* Last displayed message is now the current message. */ | 10831 | /* Last displayed message is now the current message. */ |
| 10886 | echo_area_buffer[1] = echo_area_buffer[0]; | 10832 | echo_area_buffer[1] = echo_area_buffer[0]; |
| @@ -10906,8 +10852,7 @@ buffer_shared_and_changed (void) | |||
| 10906 | && UNCHANGED_MODIFIED < MODIFF); | 10852 | && UNCHANGED_MODIFIED < MODIFF); |
| 10907 | } | 10853 | } |
| 10908 | 10854 | ||
| 10909 | /* Nonzero if W's buffer was changed but not saved or Transient Mark mode | 10855 | /* Nonzero if W's buffer was changed but not saved. */ |
| 10910 | is enabled and mark of W's buffer was changed since last W's update. */ | ||
| 10911 | 10856 | ||
| 10912 | static int | 10857 | static int |
| 10913 | window_buffer_changed (struct window *w) | 10858 | window_buffer_changed (struct window *w) |
| @@ -10916,9 +10861,7 @@ window_buffer_changed (struct window *w) | |||
| 10916 | 10861 | ||
| 10917 | eassert (BUFFER_LIVE_P (b)); | 10862 | eassert (BUFFER_LIVE_P (b)); |
| 10918 | 10863 | ||
| 10919 | return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star) | 10864 | return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)); |
| 10920 | || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active))) | ||
| 10921 | != (w->region_showing != 0))); | ||
| 10922 | } | 10865 | } |
| 10923 | 10866 | ||
| 10924 | /* Nonzero if W has %c in its mode line and mode line should be updated. */ | 10867 | /* Nonzero if W has %c in its mode line and mode line should be updated. */ |
| @@ -11225,7 +11168,7 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 11225 | /* Prepare for redisplay by updating menu-bar item lists when | 11168 | /* Prepare for redisplay by updating menu-bar item lists when |
| 11226 | appropriate. This can call eval. */ | 11169 | appropriate. This can call eval. */ |
| 11227 | 11170 | ||
| 11228 | void | 11171 | static void |
| 11229 | prepare_menu_bars (void) | 11172 | prepare_menu_bars (void) |
| 11230 | { | 11173 | { |
| 11231 | int all_windows; | 11174 | int all_windows; |
| @@ -11273,6 +11216,10 @@ prepare_menu_bars (void) | |||
| 11273 | all_windows = (update_mode_lines | 11216 | all_windows = (update_mode_lines |
| 11274 | || buffer_shared_and_changed () | 11217 | || buffer_shared_and_changed () |
| 11275 | || windows_or_buffers_changed); | 11218 | || windows_or_buffers_changed); |
| 11219 | |||
| 11220 | if (FUNCTIONP (Vpre_redisplay_function)) | ||
| 11221 | safe_call1 (Vpre_redisplay_function, all_windows ? Qt : Qnil); | ||
| 11222 | |||
| 11276 | if (all_windows) | 11223 | if (all_windows) |
| 11277 | { | 11224 | { |
| 11278 | Lisp_Object tail, frame; | 11225 | Lisp_Object tail, frame; |
| @@ -12940,12 +12887,12 @@ redisplay_internal (void) | |||
| 12940 | int polling_stopped_here = 0; | 12887 | int polling_stopped_here = 0; |
| 12941 | Lisp_Object tail, frame; | 12888 | Lisp_Object tail, frame; |
| 12942 | 12889 | ||
| 12943 | /* Non-zero means redisplay has to consider all windows on all | 12890 | /* True means redisplay has to consider all windows on all |
| 12944 | frames. Zero means, only selected_window is considered. */ | 12891 | frames. False, only selected_window is considered. */ |
| 12945 | int consider_all_windows_p; | 12892 | bool consider_all_windows_p; |
| 12946 | 12893 | ||
| 12947 | /* Non-zero means redisplay has to redisplay the miniwindow. */ | 12894 | /* True means redisplay has to redisplay the miniwindow. */ |
| 12948 | int update_miniwindow_p = 0; | 12895 | bool update_miniwindow_p = false; |
| 12949 | 12896 | ||
| 12950 | TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p)); | 12897 | TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p)); |
| 12951 | 12898 | ||
| @@ -13001,7 +12948,7 @@ redisplay_internal (void) | |||
| 13001 | realized faces, which includes the faces referenced from current | 12948 | realized faces, which includes the faces referenced from current |
| 13002 | matrices. So, we can't reuse current matrices in this case. */ | 12949 | matrices. So, we can't reuse current matrices in this case. */ |
| 13003 | if (face_change_count) | 12950 | if (face_change_count) |
| 13004 | ++windows_or_buffers_changed; | 12951 | windows_or_buffers_changed = 47; |
| 13005 | 12952 | ||
| 13006 | if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) | 12953 | if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) |
| 13007 | && FRAME_TTY (sf)->previous_frame != sf) | 12954 | && FRAME_TTY (sf)->previous_frame != sf) |
| @@ -13009,7 +12956,7 @@ redisplay_internal (void) | |||
| 13009 | /* Since frames on a single ASCII terminal share the same | 12956 | /* Since frames on a single ASCII terminal share the same |
| 13010 | display area, displaying a different frame means redisplay | 12957 | display area, displaying a different frame means redisplay |
| 13011 | the whole thing. */ | 12958 | the whole thing. */ |
| 13012 | windows_or_buffers_changed++; | 12959 | windows_or_buffers_changed = 48; |
| 13013 | SET_FRAME_GARBAGED (sf); | 12960 | SET_FRAME_GARBAGED (sf); |
| 13014 | #ifndef DOS_NT | 12961 | #ifndef DOS_NT |
| 13015 | set_tty_color_mode (FRAME_TTY (sf), sf); | 12962 | set_tty_color_mode (FRAME_TTY (sf), sf); |
| @@ -13038,7 +12985,7 @@ redisplay_internal (void) | |||
| 13038 | /* If cursor type has been changed on the frame | 12985 | /* If cursor type has been changed on the frame |
| 13039 | other than selected, consider all frames. */ | 12986 | other than selected, consider all frames. */ |
| 13040 | if (f != sf && f->cursor_type_changed) | 12987 | if (f != sf && f->cursor_type_changed) |
| 13041 | update_mode_lines++; | 12988 | update_mode_lines = 31; |
| 13042 | } | 12989 | } |
| 13043 | clear_desired_matrices (f); | 12990 | clear_desired_matrices (f); |
| 13044 | } | 12991 | } |
| @@ -13058,8 +13005,8 @@ redisplay_internal (void) | |||
| 13058 | if (NILP (Vmemory_full)) | 13005 | if (NILP (Vmemory_full)) |
| 13059 | prepare_menu_bars (); | 13006 | prepare_menu_bars (); |
| 13060 | 13007 | ||
| 13061 | if (windows_or_buffers_changed) | 13008 | if (windows_or_buffers_changed && !update_mode_lines) |
| 13062 | update_mode_lines++; | 13009 | update_mode_lines = 32; |
| 13063 | 13010 | ||
| 13064 | reconsider_clip_changes (w); | 13011 | reconsider_clip_changes (w); |
| 13065 | 13012 | ||
| @@ -13072,7 +13019,7 @@ redisplay_internal (void) | |||
| 13072 | { | 13019 | { |
| 13073 | w->update_mode_line = 1; | 13020 | w->update_mode_line = 1; |
| 13074 | if (buffer_shared_and_changed ()) | 13021 | if (buffer_shared_and_changed ()) |
| 13075 | update_mode_lines++; | 13022 | update_mode_lines = 33; |
| 13076 | } | 13023 | } |
| 13077 | 13024 | ||
| 13078 | if (mode_line_update_needed (w)) | 13025 | if (mode_line_update_needed (w)) |
| @@ -13085,7 +13032,10 @@ redisplay_internal (void) | |||
| 13085 | /* If specs for an arrow have changed, do thorough redisplay | 13032 | /* If specs for an arrow have changed, do thorough redisplay |
| 13086 | to ensure we remove any arrow that should no longer exist. */ | 13033 | to ensure we remove any arrow that should no longer exist. */ |
| 13087 | if (overlay_arrows_changed_p ()) | 13034 | if (overlay_arrows_changed_p ()) |
| 13088 | consider_all_windows_p = windows_or_buffers_changed = 1; | 13035 | { |
| 13036 | consider_all_windows_p = true; | ||
| 13037 | windows_or_buffers_changed = 49; | ||
| 13038 | } | ||
| 13089 | 13039 | ||
| 13090 | /* Normally the message* functions will have already displayed and | 13040 | /* Normally the message* functions will have already displayed and |
| 13091 | updated the echo area, but the frame may have been trashed, or | 13041 | updated the echo area, but the frame may have been trashed, or |
| @@ -13103,7 +13053,7 @@ redisplay_internal (void) | |||
| 13103 | int window_height_changed_p = echo_area_display (0); | 13053 | int window_height_changed_p = echo_area_display (0); |
| 13104 | 13054 | ||
| 13105 | if (message_cleared_p) | 13055 | if (message_cleared_p) |
| 13106 | update_miniwindow_p = 1; | 13056 | update_miniwindow_p = true; |
| 13107 | 13057 | ||
| 13108 | must_finish = 1; | 13058 | must_finish = 1; |
| 13109 | 13059 | ||
| @@ -13116,9 +13066,9 @@ redisplay_internal (void) | |||
| 13116 | 13066 | ||
| 13117 | if (window_height_changed_p) | 13067 | if (window_height_changed_p) |
| 13118 | { | 13068 | { |
| 13119 | consider_all_windows_p = 1; | 13069 | consider_all_windows_p = true; |
| 13120 | ++update_mode_lines; | 13070 | update_mode_lines = 34; |
| 13121 | ++windows_or_buffers_changed; | 13071 | windows_or_buffers_changed = 50; |
| 13122 | 13072 | ||
| 13123 | /* If window configuration was changed, frames may have been | 13073 | /* If window configuration was changed, frames may have been |
| 13124 | marked garbaged. Clear them or we will experience | 13074 | marked garbaged. Clear them or we will experience |
| @@ -13137,9 +13087,9 @@ redisplay_internal (void) | |||
| 13137 | since only the current frame needs to be considered. This function | 13087 | since only the current frame needs to be considered. This function |
| 13138 | needs to be rewritten with two variables, consider_all_windows and | 13088 | needs to be rewritten with two variables, consider_all_windows and |
| 13139 | consider_all_frames. */ | 13089 | consider_all_frames. */ |
| 13140 | consider_all_windows_p = 1; | 13090 | consider_all_windows_p = true; |
| 13141 | ++windows_or_buffers_changed; | 13091 | windows_or_buffers_changed = 51; |
| 13142 | ++update_mode_lines; | 13092 | update_mode_lines = 35; |
| 13143 | 13093 | ||
| 13144 | /* If window configuration was changed, frames may have been | 13094 | /* If window configuration was changed, frames may have been |
| 13145 | marked garbaged. Clear them or we will experience | 13095 | marked garbaged. Clear them or we will experience |
| @@ -13147,16 +13097,23 @@ redisplay_internal (void) | |||
| 13147 | clear_garbaged_frames (); | 13097 | clear_garbaged_frames (); |
| 13148 | } | 13098 | } |
| 13149 | 13099 | ||
| 13150 | /* If showing the region, and mark has changed, we must redisplay | 13100 | if (VECTORP (Vredisplay__all_windows_cause) |
| 13151 | the whole window. The assignment to this_line_start_pos prevents | 13101 | && windows_or_buffers_changed >= 0 |
| 13152 | the optimization directly below this if-statement. */ | 13102 | && windows_or_buffers_changed < ASIZE (Vredisplay__all_windows_cause) |
| 13153 | if (((!NILP (Vtransient_mark_mode) | 13103 | && INTEGERP (AREF (Vredisplay__all_windows_cause, |
| 13154 | && !NILP (BVAR (XBUFFER (w->contents), mark_active))) | 13104 | windows_or_buffers_changed))) |
| 13155 | != (w->region_showing > 0)) | 13105 | ASET (Vredisplay__all_windows_cause, windows_or_buffers_changed, |
| 13156 | || (w->region_showing | 13106 | make_number (1 + XINT (AREF (Vredisplay__all_windows_cause, |
| 13157 | && w->region_showing | 13107 | windows_or_buffers_changed)))); |
| 13158 | != XINT (Fmarker_position (BVAR (XBUFFER (w->contents), mark))))) | 13108 | |
| 13159 | CHARPOS (this_line_start_pos) = 0; | 13109 | if (VECTORP (Vredisplay__mode_lines_cause) |
| 13110 | && update_mode_lines >= 0 | ||
| 13111 | && update_mode_lines < ASIZE (Vredisplay__mode_lines_cause) | ||
| 13112 | && INTEGERP (AREF (Vredisplay__mode_lines_cause, | ||
| 13113 | update_mode_lines))) | ||
| 13114 | ASET (Vredisplay__mode_lines_cause, update_mode_lines, | ||
| 13115 | make_number (1 + XINT (AREF (Vredisplay__mode_lines_cause, | ||
| 13116 | update_mode_lines)))); | ||
| 13160 | 13117 | ||
| 13161 | /* Optimize the case that only the line containing the cursor in the | 13118 | /* Optimize the case that only the line containing the cursor in the |
| 13162 | selected window has changed. Variables starting with this_ are | 13119 | selected window has changed. Variables starting with this_ are |
| @@ -13317,13 +13274,7 @@ redisplay_internal (void) | |||
| 13317 | } | 13274 | } |
| 13318 | /* If highlighting the region, or if the cursor is in the echo area, | 13275 | /* If highlighting the region, or if the cursor is in the echo area, |
| 13319 | then we can't just move the cursor. */ | 13276 | then we can't just move the cursor. */ |
| 13320 | else if (! (!NILP (Vtransient_mark_mode) | 13277 | else if (NILP (Vshow_trailing_whitespace) |
| 13321 | && !NILP (BVAR (current_buffer, mark_active))) | ||
| 13322 | && (EQ (selected_window, | ||
| 13323 | BVAR (current_buffer, last_selected_window)) | ||
| 13324 | || highlight_nonselected_windows) | ||
| 13325 | && !w->region_showing | ||
| 13326 | && NILP (Vshow_trailing_whitespace) | ||
| 13327 | && !cursor_in_echo_area) | 13278 | && !cursor_in_echo_area) |
| 13328 | { | 13279 | { |
| 13329 | struct it it; | 13280 | struct it it; |
| @@ -13365,7 +13316,6 @@ redisplay_internal (void) | |||
| 13365 | } | 13316 | } |
| 13366 | 13317 | ||
| 13367 | CHARPOS (this_line_start_pos) = 0; | 13318 | CHARPOS (this_line_start_pos) = 0; |
| 13368 | consider_all_windows_p |= buffer_shared_and_changed (); | ||
| 13369 | ++clear_face_cache_count; | 13319 | ++clear_face_cache_count; |
| 13370 | #ifdef HAVE_WINDOW_SYSTEM | 13320 | #ifdef HAVE_WINDOW_SYSTEM |
| 13371 | ++clear_image_cache_count; | 13321 | ++clear_image_cache_count; |
| @@ -13544,7 +13494,7 @@ redisplay_internal (void) | |||
| 13544 | matrices of some windows are not valid. */ | 13494 | matrices of some windows are not valid. */ |
| 13545 | if (!WINDOW_FULL_WIDTH_P (w) | 13495 | if (!WINDOW_FULL_WIDTH_P (w) |
| 13546 | && !FRAME_WINDOW_P (XFRAME (w->frame))) | 13496 | && !FRAME_WINDOW_P (XFRAME (w->frame))) |
| 13547 | update_mode_lines = 1; | 13497 | update_mode_lines = 36; |
| 13548 | } | 13498 | } |
| 13549 | else | 13499 | else |
| 13550 | { | 13500 | { |
| @@ -13595,7 +13545,7 @@ redisplay_internal (void) | |||
| 13595 | } | 13545 | } |
| 13596 | 13546 | ||
| 13597 | if (new_count != number_of_visible_frames) | 13547 | if (new_count != number_of_visible_frames) |
| 13598 | windows_or_buffers_changed++; | 13548 | windows_or_buffers_changed = 52; |
| 13599 | } | 13549 | } |
| 13600 | 13550 | ||
| 13601 | /* Change frame size now if a change is pending. */ | 13551 | /* Change frame size now if a change is pending. */ |
| @@ -15003,11 +14953,6 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 15003 | && !update_mode_lines | 14953 | && !update_mode_lines |
| 15004 | && !windows_or_buffers_changed | 14954 | && !windows_or_buffers_changed |
| 15005 | && !f->cursor_type_changed | 14955 | && !f->cursor_type_changed |
| 15006 | /* Can't use this case if highlighting a region. When a | ||
| 15007 | region exists, cursor movement has to do more than just | ||
| 15008 | set the cursor. */ | ||
| 15009 | && markpos_of_region () < 0 | ||
| 15010 | && !w->region_showing | ||
| 15011 | && NILP (Vshow_trailing_whitespace) | 14956 | && NILP (Vshow_trailing_whitespace) |
| 15012 | /* This code is not used for mini-buffer for the sake of the case | 14957 | /* This code is not used for mini-buffer for the sake of the case |
| 15013 | of redisplaying to replace an echo area message; since in | 14958 | of redisplaying to replace an echo area message; since in |
| @@ -15413,7 +15358,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15413 | } | 15358 | } |
| 15414 | else if ((w != XWINDOW (minibuf_window) | 15359 | else if ((w != XWINDOW (minibuf_window) |
| 15415 | || minibuf_level == 0) | 15360 | || minibuf_level == 0) |
| 15416 | /* When buffer is nonempty, redisplay window normally. */ | 15361 | /* When buffer is nonempty, redisplay window normally. */ |
| 15417 | && BUF_Z (XBUFFER (w->contents)) == BUF_BEG (XBUFFER (w->contents)) | 15362 | && BUF_Z (XBUFFER (w->contents)) == BUF_BEG (XBUFFER (w->contents)) |
| 15418 | /* Quail displays non-mini buffers in minibuffer window. | 15363 | /* Quail displays non-mini buffers in minibuffer window. |
| 15419 | In that case, redisplay the window normally. */ | 15364 | In that case, redisplay the window normally. */ |
| @@ -15622,7 +15567,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15622 | Move it back to a fully-visible line. */ | 15567 | Move it back to a fully-visible line. */ |
| 15623 | new_vpos = window_box_height (w); | 15568 | new_vpos = window_box_height (w); |
| 15624 | } | 15569 | } |
| 15625 | else if (w->cursor.vpos >=0) | 15570 | else if (w->cursor.vpos >= 0) |
| 15626 | { | 15571 | { |
| 15627 | /* Some people insist on not letting point enter the scroll | 15572 | /* Some people insist on not letting point enter the scroll |
| 15628 | margin, even though this part handles windows that didn't | 15573 | margin, even though this part handles windows that didn't |
| @@ -15680,12 +15625,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15680 | 15625 | ||
| 15681 | /* If we are highlighting the region, then we just changed | 15626 | /* If we are highlighting the region, then we just changed |
| 15682 | the region, so redisplay to show it. */ | 15627 | the region, so redisplay to show it. */ |
| 15683 | if (markpos_of_region () >= 0) | 15628 | /* FIXME: We need to (re)run pre-redisplay-function! */ |
| 15629 | /* if (markpos_of_region () >= 0) | ||
| 15684 | { | 15630 | { |
| 15685 | clear_glyph_matrix (w->desired_matrix); | 15631 | clear_glyph_matrix (w->desired_matrix); |
| 15686 | if (!try_window (window, startp, 0)) | 15632 | if (!try_window (window, startp, 0)) |
| 15687 | goto need_larger_matrices; | 15633 | goto need_larger_matrices; |
| 15688 | } | 15634 | } |
| 15635 | */ | ||
| 15689 | } | 15636 | } |
| 15690 | 15637 | ||
| 15691 | #ifdef GLYPH_DEBUG | 15638 | #ifdef GLYPH_DEBUG |
| @@ -16380,10 +16327,8 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16380 | || f->cursor_type_changed) | 16327 | || f->cursor_type_changed) |
| 16381 | return 0; | 16328 | return 0; |
| 16382 | 16329 | ||
| 16383 | /* Can't do this if region may have changed. */ | 16330 | /* Can't do this if showing trailing whitespace. */ |
| 16384 | if (markpos_of_region () >= 0 | 16331 | if (!NILP (Vshow_trailing_whitespace)) |
| 16385 | || w->region_showing | ||
| 16386 | || !NILP (Vshow_trailing_whitespace)) | ||
| 16387 | return 0; | 16332 | return 0; |
| 16388 | 16333 | ||
| 16389 | /* If top-line visibility has changed, give up. */ | 16334 | /* If top-line visibility has changed, give up. */ |
| @@ -17181,19 +17126,10 @@ try_window_id (struct window *w) | |||
| 17181 | if (!w->window_end_valid) | 17126 | if (!w->window_end_valid) |
| 17182 | GIVE_UP (8); | 17127 | GIVE_UP (8); |
| 17183 | 17128 | ||
| 17184 | /* Can't use this if highlighting a region because a cursor movement | ||
| 17185 | will do more than just set the cursor. */ | ||
| 17186 | if (markpos_of_region () >= 0) | ||
| 17187 | GIVE_UP (9); | ||
| 17188 | |||
| 17189 | /* Likewise if highlighting trailing whitespace. */ | 17129 | /* Likewise if highlighting trailing whitespace. */ |
| 17190 | if (!NILP (Vshow_trailing_whitespace)) | 17130 | if (!NILP (Vshow_trailing_whitespace)) |
| 17191 | GIVE_UP (11); | 17131 | GIVE_UP (11); |
| 17192 | 17132 | ||
| 17193 | /* Likewise if showing a region. */ | ||
| 17194 | if (w->region_showing) | ||
| 17195 | GIVE_UP (10); | ||
| 17196 | |||
| 17197 | /* Can't use this if overlay arrow position and/or string have | 17133 | /* Can't use this if overlay arrow position and/or string have |
| 17198 | changed. */ | 17134 | changed. */ |
| 17199 | if (overlay_arrows_changed_p ()) | 17135 | if (overlay_arrows_changed_p ()) |
| @@ -18537,7 +18473,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 18537 | it->len = 1; | 18473 | it->len = 1; |
| 18538 | 18474 | ||
| 18539 | /* If the default face was remapped, be sure to use the | 18475 | /* If the default face was remapped, be sure to use the |
| 18540 | remapped face for the appended newline. */ | 18476 | remapped face for the appended newline. */ |
| 18541 | if (default_face_p) | 18477 | if (default_face_p) |
| 18542 | it->face_id = lookup_basic_face (it->f, DEFAULT_FACE_ID); | 18478 | it->face_id = lookup_basic_face (it->f, DEFAULT_FACE_ID); |
| 18543 | else if (it->face_before_selective_p) | 18479 | else if (it->face_before_selective_p) |
| @@ -18615,7 +18551,9 @@ extend_face_to_end_of_line (struct it *it) | |||
| 18615 | && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row) | 18551 | && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row) |
| 18616 | && face->box == FACE_NO_BOX | 18552 | && face->box == FACE_NO_BOX |
| 18617 | && face->background == FRAME_BACKGROUND_PIXEL (f) | 18553 | && face->background == FRAME_BACKGROUND_PIXEL (f) |
| 18554 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 18618 | && !face->stipple | 18555 | && !face->stipple |
| 18556 | #endif | ||
| 18619 | && !it->glyph_row->reversed_p) | 18557 | && !it->glyph_row->reversed_p) |
| 18620 | return; | 18558 | return; |
| 18621 | 18559 | ||
| @@ -19275,9 +19213,6 @@ display_line (struct it *it) | |||
| 19275 | return 0; | 19213 | return 0; |
| 19276 | } | 19214 | } |
| 19277 | 19215 | ||
| 19278 | /* Is IT->w showing the region? */ | ||
| 19279 | it->w->region_showing = it->region_beg_charpos > 0 ? it->region_beg_charpos : 0; | ||
| 19280 | |||
| 19281 | /* Clear the result glyph row and enable it. */ | 19216 | /* Clear the result glyph row and enable it. */ |
| 19282 | prepare_desired_row (row); | 19217 | prepare_desired_row (row); |
| 19283 | 19218 | ||
| @@ -22411,9 +22346,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st | |||
| 22411 | 22346 | ||
| 22412 | it->face_id | 22347 | it->face_id |
| 22413 | = face_at_string_position (it->w, face_string, face_string_pos, | 22348 | = face_at_string_position (it->w, face_string, face_string_pos, |
| 22414 | 0, it->region_beg_charpos, | 22349 | 0, &endptr, it->base_face_id, 0); |
| 22415 | it->region_end_charpos, | ||
| 22416 | &endptr, it->base_face_id, 0); | ||
| 22417 | face = FACE_FROM_ID (it->f, it->face_id); | 22350 | face = FACE_FROM_ID (it->f, it->face_id); |
| 22418 | it->face_box_p = face->box != FACE_NO_BOX; | 22351 | it->face_box_p = face->box != FACE_NO_BOX; |
| 22419 | } | 22352 | } |
| @@ -25140,7 +25073,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 25140 | lower_yoff = descent - 2 - metrics_lower.descent; | 25073 | lower_yoff = descent - 2 - metrics_lower.descent; |
| 25141 | upper_yoff = (lower_yoff - metrics_lower.ascent - 1 | 25074 | upper_yoff = (lower_yoff - metrics_lower.ascent - 1 |
| 25142 | - metrics_upper.descent); | 25075 | - metrics_upper.descent); |
| 25143 | /* Don't make the height shorter than the base height. */ | 25076 | /* Don't make the height shorter than the base height. */ |
| 25144 | if (height > base_height) | 25077 | if (height > base_height) |
| 25145 | { | 25078 | { |
| 25146 | it->ascent = ascent; | 25079 | it->ascent = ascent; |
| @@ -25177,16 +25110,16 @@ x_produce_glyphs (struct it *it) | |||
| 25177 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 25110 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| 25178 | struct font *font = face->font; | 25111 | struct font *font = face->font; |
| 25179 | struct font_metrics *pcm = NULL; | 25112 | struct font_metrics *pcm = NULL; |
| 25180 | int boff; /* baseline offset */ | 25113 | int boff; /* Baseline offset. */ |
| 25181 | 25114 | ||
| 25182 | if (font == NULL) | 25115 | if (font == NULL) |
| 25183 | { | 25116 | { |
| 25184 | /* When no suitable font is found, display this character by | 25117 | /* When no suitable font is found, display this character by |
| 25185 | the method specified in the first extra slot of | 25118 | the method specified in the first extra slot of |
| 25186 | Vglyphless_char_display. */ | 25119 | Vglyphless_char_display. */ |
| 25187 | Lisp_Object acronym = lookup_glyphless_char_display (-1, it); | 25120 | Lisp_Object acronym = lookup_glyphless_char_display (-1, it); |
| 25188 | 25121 | ||
| 25189 | eassert (it->what == IT_GLYPHLESS); | 25122 | eassert (it->what == IT_GLYPHLESS); |
| 25190 | produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil); | 25123 | produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil); |
| 25191 | goto done; | 25124 | goto done; |
| 25192 | } | 25125 | } |
| @@ -25324,7 +25257,7 @@ x_produce_glyphs (struct it *it) | |||
| 25324 | { | 25257 | { |
| 25325 | /* A newline has no width, but we need the height of the | 25258 | /* A newline has no width, but we need the height of the |
| 25326 | line. But if previous part of the line sets a height, | 25259 | line. But if previous part of the line sets a height, |
| 25327 | don't increase that height */ | 25260 | don't increase that height. */ |
| 25328 | 25261 | ||
| 25329 | Lisp_Object height; | 25262 | Lisp_Object height; |
| 25330 | Lisp_Object total_height = Qnil; | 25263 | Lisp_Object total_height = Qnil; |
| @@ -25334,7 +25267,7 @@ x_produce_glyphs (struct it *it) | |||
| 25334 | it->nglyphs = 0; | 25267 | it->nglyphs = 0; |
| 25335 | 25268 | ||
| 25336 | height = get_it_property (it, Qline_height); | 25269 | height = get_it_property (it, Qline_height); |
| 25337 | /* Split (line-height total-height) list */ | 25270 | /* Split (line-height total-height) list. */ |
| 25338 | if (CONSP (height) | 25271 | if (CONSP (height) |
| 25339 | && CONSP (XCDR (height)) | 25272 | && CONSP (XCDR (height)) |
| 25340 | && NILP (XCDR (XCDR (height)))) | 25273 | && NILP (XCDR (XCDR (height)))) |
| @@ -26412,7 +26345,7 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row, | |||
| 26412 | 26345 | ||
| 26413 | /* Erase the image of a cursor of window W from the screen. */ | 26346 | /* Erase the image of a cursor of window W from the screen. */ |
| 26414 | 26347 | ||
| 26415 | #ifndef WINDOWSNT | 26348 | #ifndef HAVE_NTGUI |
| 26416 | static | 26349 | static |
| 26417 | #endif | 26350 | #endif |
| 26418 | void | 26351 | void |
| @@ -27417,7 +27350,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 27417 | 27350 | ||
| 27418 | hlinfo->mouse_face_window = window; | 27351 | hlinfo->mouse_face_window = window; |
| 27419 | hlinfo->mouse_face_face_id | 27352 | hlinfo->mouse_face_face_id |
| 27420 | = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, | 27353 | = face_at_buffer_position (w, mouse_charpos, &ignore, |
| 27421 | mouse_charpos + 1, | 27354 | mouse_charpos + 1, |
| 27422 | !hlinfo->mouse_face_hidden, -1); | 27355 | !hlinfo->mouse_face_hidden, -1); |
| 27423 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 27356 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| @@ -27683,7 +27616,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y) | |||
| 27683 | if (VECTORP (XCDR (hot_spot))) | 27616 | if (VECTORP (XCDR (hot_spot))) |
| 27684 | { | 27617 | { |
| 27685 | struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); | 27618 | struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); |
| 27686 | Lisp_Object *poly = v->u.contents; | 27619 | Lisp_Object *poly = v->contents; |
| 27687 | ptrdiff_t n = v->header.size; | 27620 | ptrdiff_t n = v->header.size; |
| 27688 | ptrdiff_t i; | 27621 | ptrdiff_t i; |
| 27689 | int inside = 0; | 27622 | int inside = 0; |
| @@ -28098,8 +28031,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 28098 | 28031 | ||
| 28099 | hlinfo->mouse_face_face_id = face_at_string_position (w, string, | 28032 | hlinfo->mouse_face_face_id = face_at_string_position (w, string, |
| 28100 | charpos, | 28033 | charpos, |
| 28101 | 0, 0, 0, | 28034 | 0, &ignore, |
| 28102 | &ignore, | ||
| 28103 | glyph->face_id, | 28035 | glyph->face_id, |
| 28104 | 1); | 28036 | 1); |
| 28105 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 28037 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| @@ -28400,7 +28332,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28400 | hlinfo->mouse_face_past_end = 0; | 28332 | hlinfo->mouse_face_past_end = 0; |
| 28401 | hlinfo->mouse_face_window = window; | 28333 | hlinfo->mouse_face_window = window; |
| 28402 | hlinfo->mouse_face_face_id | 28334 | hlinfo->mouse_face_face_id |
| 28403 | = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, | 28335 | = face_at_string_position (w, object, pos, 0, &ignore, |
| 28404 | glyph->face_id, 1); | 28336 | glyph->face_id, 1); |
| 28405 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 28337 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| 28406 | cursor = No_Cursor; | 28338 | cursor = No_Cursor; |
| @@ -28447,13 +28379,14 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28447 | the first row visible in a window does not | 28379 | the first row visible in a window does not |
| 28448 | necessarily display the character whose position | 28380 | necessarily display the character whose position |
| 28449 | is the smallest. */ | 28381 | is the smallest. */ |
| 28450 | Lisp_Object lim1 = | 28382 | Lisp_Object lim1 |
| 28451 | NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) | 28383 | = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) |
| 28452 | ? Fmarker_position (w->start) | 28384 | ? Fmarker_position (w->start) |
| 28453 | : Qnil; | 28385 | : Qnil; |
| 28454 | Lisp_Object lim2 = | 28386 | Lisp_Object lim2 |
| 28455 | NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) | 28387 | = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) |
| 28456 | ? make_number (BUF_Z (XBUFFER (buffer)) - w->window_end_pos) | 28388 | ? make_number (BUF_Z (XBUFFER (buffer)) |
| 28389 | - w->window_end_pos) | ||
| 28457 | : Qnil; | 28390 | : Qnil; |
| 28458 | 28391 | ||
| 28459 | if (NILP (overlay)) | 28392 | if (NILP (overlay)) |
| @@ -29786,6 +29719,13 @@ cursor shapes. */); | |||
| 29786 | DEFSYM (Qthin_space, "thin-space"); | 29719 | DEFSYM (Qthin_space, "thin-space"); |
| 29787 | DEFSYM (Qzero_width, "zero-width"); | 29720 | DEFSYM (Qzero_width, "zero-width"); |
| 29788 | 29721 | ||
| 29722 | DEFVAR_LISP ("pre-redisplay-function", Vpre_redisplay_function, | ||
| 29723 | doc: /* Function run just before redisplay. | ||
| 29724 | It is called with one argument, which is the set of windows that are to | ||
| 29725 | be redisplayed. This set can be nil (meaning, only the selected window), | ||
| 29726 | or t (meaning all windows). */); | ||
| 29727 | Vpre_redisplay_function = intern ("ignore"); | ||
| 29728 | |||
| 29789 | DEFSYM (Qglyphless_char_display, "glyphless-char-display"); | 29729 | DEFSYM (Qglyphless_char_display, "glyphless-char-display"); |
| 29790 | Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1)); | 29730 | Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1)); |
| 29791 | 29731 | ||
| @@ -29804,7 +29744,11 @@ GRAPHICAL and TEXT should each have one of the values listed above. | |||
| 29804 | The char-table has one extra slot to control the display of a character for | 29744 | The char-table has one extra slot to control the display of a character for |
| 29805 | which no font is found. This slot only takes effect on graphical terminals. | 29745 | which no font is found. This slot only takes effect on graphical terminals. |
| 29806 | Its value should be an ASCII acronym string, `hex-code', `empty-box', or | 29746 | Its value should be an ASCII acronym string, `hex-code', `empty-box', or |
| 29807 | `thin-space'. The default is `empty-box'. */); | 29747 | `thin-space'. The default is `empty-box'. |
| 29748 | |||
| 29749 | If a character has a non-nil entry in an active display table, the | ||
| 29750 | display table takes effect; in this case, Emacs does not consult | ||
| 29751 | `glyphless-char-display' at all. */); | ||
| 29808 | Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); | 29752 | Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); |
| 29809 | Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), | 29753 | Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), |
| 29810 | Qempty_box); | 29754 | Qempty_box); |
| @@ -29812,6 +29756,16 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or | |||
| 29812 | DEFVAR_LISP ("debug-on-message", Vdebug_on_message, | 29756 | DEFVAR_LISP ("debug-on-message", Vdebug_on_message, |
| 29813 | doc: /* If non-nil, debug if a message matching this regexp is displayed. */); | 29757 | doc: /* If non-nil, debug if a message matching this regexp is displayed. */); |
| 29814 | Vdebug_on_message = Qnil; | 29758 | Vdebug_on_message = Qnil; |
| 29759 | |||
| 29760 | DEFVAR_LISP ("redisplay--all-windows-cause", Vredisplay__all_windows_cause, | ||
| 29761 | doc: /* */); | ||
| 29762 | Vredisplay__all_windows_cause | ||
| 29763 | = Fmake_vector (make_number (100), make_number (0)); | ||
| 29764 | |||
| 29765 | DEFVAR_LISP ("redisplay--mode-lines-cause", Vredisplay__mode_lines_cause, | ||
| 29766 | doc: /* */); | ||
| 29767 | Vredisplay__mode_lines_cause | ||
| 29768 | = Fmake_vector (make_number (100), make_number (0)); | ||
| 29815 | } | 29769 | } |
| 29816 | 29770 | ||
| 29817 | 29771 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 363d3bb0784..b9ddddfd9e2 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -292,7 +292,7 @@ Lisp_Object QCwidth; | |||
| 292 | static Lisp_Object QCfont, QCbold, QCitalic; | 292 | static Lisp_Object QCfont, QCbold, QCitalic; |
| 293 | static Lisp_Object QCreverse_video; | 293 | static Lisp_Object QCreverse_video; |
| 294 | static Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; | 294 | static Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; |
| 295 | static Lisp_Object QCfontset; | 295 | static Lisp_Object QCfontset, QCdistant_foreground; |
| 296 | 296 | ||
| 297 | /* Symbols used for attribute values. */ | 297 | /* Symbols used for attribute values. */ |
| 298 | 298 | ||
| @@ -440,6 +440,7 @@ static struct face_cache *make_face_cache (struct frame *); | |||
| 440 | static void free_face_cache (struct face_cache *); | 440 | static void free_face_cache (struct face_cache *); |
| 441 | static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, | 441 | static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, |
| 442 | int, struct named_merge_point *); | 442 | int, struct named_merge_point *); |
| 443 | static int color_distance (XColor *x, XColor *y); | ||
| 443 | 444 | ||
| 444 | #ifdef HAVE_WINDOW_SYSTEM | 445 | #ifdef HAVE_WINDOW_SYSTEM |
| 445 | static void set_font_frame_param (Lisp_Object, Lisp_Object); | 446 | static void set_font_frame_param (Lisp_Object, Lisp_Object); |
| @@ -535,7 +536,7 @@ DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0, | |||
| 535 | is called. */ | 536 | is called. */ |
| 536 | 537 | ||
| 537 | void | 538 | void |
| 538 | x_free_colors (struct frame *f, long unsigned int *pixels, int npixels) | 539 | x_free_colors (struct frame *f, unsigned long *pixels, int npixels) |
| 539 | { | 540 | { |
| 540 | int class = FRAME_DISPLAY_INFO (f)->visual->class; | 541 | int class = FRAME_DISPLAY_INFO (f)->visual->class; |
| 541 | 542 | ||
| @@ -560,7 +561,7 @@ x_free_colors (struct frame *f, long unsigned int *pixels, int npixels) | |||
| 560 | 561 | ||
| 561 | void | 562 | void |
| 562 | x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, | 563 | x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, |
| 563 | long unsigned int *pixels, int npixels) | 564 | unsigned long *pixels, int npixels) |
| 564 | { | 565 | { |
| 565 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); | 566 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); |
| 566 | int class = dpyinfo->visual->class; | 567 | int class = dpyinfo->visual->class; |
| @@ -581,7 +582,7 @@ x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, | |||
| 581 | are given by XGCV and MASK. */ | 582 | are given by XGCV and MASK. */ |
| 582 | 583 | ||
| 583 | static GC | 584 | static GC |
| 584 | x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) | 585 | x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) |
| 585 | { | 586 | { |
| 586 | GC gc; | 587 | GC gc; |
| 587 | block_input (); | 588 | block_input (); |
| @@ -787,7 +788,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too. */) | |||
| 787 | { | 788 | { |
| 788 | clear_face_cache (!NILP (thoroughly)); | 789 | clear_face_cache (!NILP (thoroughly)); |
| 789 | ++face_change_count; | 790 | ++face_change_count; |
| 790 | ++windows_or_buffers_changed; | 791 | windows_or_buffers_changed = 53; |
| 791 | return Qnil; | 792 | return Qnil; |
| 792 | } | 793 | } |
| 793 | 794 | ||
| @@ -853,12 +854,10 @@ the pixmap. Bits are stored row by row, each row occupies | |||
| 853 | pixmap spec) for use on frame F. Value is the bitmap_id (see | 854 | pixmap spec) for use on frame F. Value is the bitmap_id (see |
| 854 | xfns.c). If NAME is nil, return with a bitmap id of zero. If | 855 | xfns.c). If NAME is nil, return with a bitmap id of zero. If |
| 855 | bitmap cannot be loaded, display a message saying so, and return | 856 | bitmap cannot be loaded, display a message saying so, and return |
| 856 | zero. Store the bitmap width in *W_PTR and its height in *H_PTR, | 857 | zero. */ |
| 857 | if these pointers are not null. */ | ||
| 858 | 858 | ||
| 859 | static ptrdiff_t | 859 | static ptrdiff_t |
| 860 | load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr, | 860 | load_pixmap (struct frame *f, Lisp_Object name) |
| 861 | unsigned int *h_ptr) | ||
| 862 | { | 861 | { |
| 863 | ptrdiff_t bitmap_id; | 862 | ptrdiff_t bitmap_id; |
| 864 | 863 | ||
| @@ -893,22 +892,12 @@ load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr, | |||
| 893 | { | 892 | { |
| 894 | add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil); | 893 | add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil); |
| 895 | bitmap_id = 0; | 894 | bitmap_id = 0; |
| 896 | |||
| 897 | if (w_ptr) | ||
| 898 | *w_ptr = 0; | ||
| 899 | if (h_ptr) | ||
| 900 | *h_ptr = 0; | ||
| 901 | } | 895 | } |
| 902 | else | 896 | else |
| 903 | { | 897 | { |
| 904 | #ifdef GLYPH_DEBUG | 898 | #ifdef GLYPH_DEBUG |
| 905 | ++npixmaps_allocated; | 899 | ++npixmaps_allocated; |
| 906 | #endif | 900 | #endif |
| 907 | if (w_ptr) | ||
| 908 | *w_ptr = x_bitmap_width (f, bitmap_id); | ||
| 909 | |||
| 910 | if (h_ptr) | ||
| 911 | *h_ptr = x_bitmap_height (f, bitmap_id); | ||
| 912 | } | 901 | } |
| 913 | 902 | ||
| 914 | return bitmap_id; | 903 | return bitmap_id; |
| @@ -922,6 +911,8 @@ load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr, | |||
| 922 | X Colors | 911 | X Colors |
| 923 | ***********************************************************************/ | 912 | ***********************************************************************/ |
| 924 | 913 | ||
| 914 | #define NEAR_SAME_COLOR_THRESHOLD 30000 | ||
| 915 | |||
| 925 | /* Parse RGB_LIST, and fill in the RGB fields of COLOR. | 916 | /* Parse RGB_LIST, and fill in the RGB fields of COLOR. |
| 926 | RGB_LIST should contain (at least) 3 lisp integers. | 917 | RGB_LIST should contain (at least) 3 lisp integers. |
| 927 | Return 0 if there's a problem with RGB_LIST, otherwise return 1. */ | 918 | Return 0 if there's a problem with RGB_LIST, otherwise return 1. */ |
| @@ -1188,24 +1179,10 @@ COLOR must be a valid color name. */) | |||
| 1188 | } | 1179 | } |
| 1189 | 1180 | ||
| 1190 | 1181 | ||
| 1191 | /* Load color with name NAME for use by face FACE on frame F. | 1182 | static unsigned long |
| 1192 | TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX, | 1183 | load_color2 (struct frame *f, struct face *face, Lisp_Object name, |
| 1193 | LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX, | 1184 | enum lface_attribute_index target_index, XColor *color) |
| 1194 | LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the | ||
| 1195 | pixel color. If color cannot be loaded, display a message, and | ||
| 1196 | return the foreground, background or underline color of F, but | ||
| 1197 | record that fact in flags of the face so that we don't try to free | ||
| 1198 | these colors. */ | ||
| 1199 | |||
| 1200 | #ifndef MSDOS | ||
| 1201 | static | ||
| 1202 | #endif | ||
| 1203 | unsigned long | ||
| 1204 | load_color (struct frame *f, struct face *face, Lisp_Object name, | ||
| 1205 | enum lface_attribute_index target_index) | ||
| 1206 | { | 1185 | { |
| 1207 | XColor color; | ||
| 1208 | |||
| 1209 | eassert (STRINGP (name)); | 1186 | eassert (STRINGP (name)); |
| 1210 | eassert (target_index == LFACE_FOREGROUND_INDEX | 1187 | eassert (target_index == LFACE_FOREGROUND_INDEX |
| 1211 | || target_index == LFACE_BACKGROUND_INDEX | 1188 | || target_index == LFACE_BACKGROUND_INDEX |
| @@ -1216,7 +1193,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, | |||
| 1216 | 1193 | ||
| 1217 | /* if the color map is full, defined_color will return a best match | 1194 | /* if the color map is full, defined_color will return a best match |
| 1218 | to the values in an existing cell. */ | 1195 | to the values in an existing cell. */ |
| 1219 | if (!defined_color (f, SSDATA (name), &color, 1)) | 1196 | if (!defined_color (f, SSDATA (name), color, 1)) |
| 1220 | { | 1197 | { |
| 1221 | add_to_log ("Unable to load color \"%s\"", name, Qnil); | 1198 | add_to_log ("Unable to load color \"%s\"", name, Qnil); |
| 1222 | 1199 | ||
| @@ -1224,32 +1201,32 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, | |||
| 1224 | { | 1201 | { |
| 1225 | case LFACE_FOREGROUND_INDEX: | 1202 | case LFACE_FOREGROUND_INDEX: |
| 1226 | face->foreground_defaulted_p = 1; | 1203 | face->foreground_defaulted_p = 1; |
| 1227 | color.pixel = FRAME_FOREGROUND_PIXEL (f); | 1204 | color->pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1228 | break; | 1205 | break; |
| 1229 | 1206 | ||
| 1230 | case LFACE_BACKGROUND_INDEX: | 1207 | case LFACE_BACKGROUND_INDEX: |
| 1231 | face->background_defaulted_p = 1; | 1208 | face->background_defaulted_p = 1; |
| 1232 | color.pixel = FRAME_BACKGROUND_PIXEL (f); | 1209 | color->pixel = FRAME_BACKGROUND_PIXEL (f); |
| 1233 | break; | 1210 | break; |
| 1234 | 1211 | ||
| 1235 | case LFACE_UNDERLINE_INDEX: | 1212 | case LFACE_UNDERLINE_INDEX: |
| 1236 | face->underline_defaulted_p = 1; | 1213 | face->underline_defaulted_p = 1; |
| 1237 | color.pixel = FRAME_FOREGROUND_PIXEL (f); | 1214 | color->pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1238 | break; | 1215 | break; |
| 1239 | 1216 | ||
| 1240 | case LFACE_OVERLINE_INDEX: | 1217 | case LFACE_OVERLINE_INDEX: |
| 1241 | face->overline_color_defaulted_p = 1; | 1218 | face->overline_color_defaulted_p = 1; |
| 1242 | color.pixel = FRAME_FOREGROUND_PIXEL (f); | 1219 | color->pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1243 | break; | 1220 | break; |
| 1244 | 1221 | ||
| 1245 | case LFACE_STRIKE_THROUGH_INDEX: | 1222 | case LFACE_STRIKE_THROUGH_INDEX: |
| 1246 | face->strike_through_color_defaulted_p = 1; | 1223 | face->strike_through_color_defaulted_p = 1; |
| 1247 | color.pixel = FRAME_FOREGROUND_PIXEL (f); | 1224 | color->pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1248 | break; | 1225 | break; |
| 1249 | 1226 | ||
| 1250 | case LFACE_BOX_INDEX: | 1227 | case LFACE_BOX_INDEX: |
| 1251 | face->box_color_defaulted_p = 1; | 1228 | face->box_color_defaulted_p = 1; |
| 1252 | color.pixel = FRAME_FOREGROUND_PIXEL (f); | 1229 | color->pixel = FRAME_FOREGROUND_PIXEL (f); |
| 1253 | break; | 1230 | break; |
| 1254 | 1231 | ||
| 1255 | default: | 1232 | default: |
| @@ -1261,7 +1238,27 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, | |||
| 1261 | ++ncolors_allocated; | 1238 | ++ncolors_allocated; |
| 1262 | #endif | 1239 | #endif |
| 1263 | 1240 | ||
| 1264 | return color.pixel; | 1241 | return color->pixel; |
| 1242 | } | ||
| 1243 | |||
| 1244 | /* Load color with name NAME for use by face FACE on frame F. | ||
| 1245 | TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX, | ||
| 1246 | LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX, | ||
| 1247 | LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the | ||
| 1248 | pixel color. If color cannot be loaded, display a message, and | ||
| 1249 | return the foreground, background or underline color of F, but | ||
| 1250 | record that fact in flags of the face so that we don't try to free | ||
| 1251 | these colors. */ | ||
| 1252 | |||
| 1253 | #ifndef MSDOS | ||
| 1254 | static | ||
| 1255 | #endif | ||
| 1256 | unsigned long | ||
| 1257 | load_color (struct frame *f, struct face *face, Lisp_Object name, | ||
| 1258 | enum lface_attribute_index target_index) | ||
| 1259 | { | ||
| 1260 | XColor color; | ||
| 1261 | return load_color2 (f, face, name, target_index, &color); | ||
| 1265 | } | 1262 | } |
| 1266 | 1263 | ||
| 1267 | 1264 | ||
| @@ -1276,7 +1273,8 @@ static void | |||
| 1276 | load_face_colors (struct frame *f, struct face *face, | 1273 | load_face_colors (struct frame *f, struct face *face, |
| 1277 | Lisp_Object attrs[LFACE_VECTOR_SIZE]) | 1274 | Lisp_Object attrs[LFACE_VECTOR_SIZE]) |
| 1278 | { | 1275 | { |
| 1279 | Lisp_Object fg, bg; | 1276 | Lisp_Object fg, bg, dfg; |
| 1277 | XColor xfg, xbg; | ||
| 1280 | 1278 | ||
| 1281 | bg = attrs[LFACE_BACKGROUND_INDEX]; | 1279 | bg = attrs[LFACE_BACKGROUND_INDEX]; |
| 1282 | fg = attrs[LFACE_FOREGROUND_INDEX]; | 1280 | fg = attrs[LFACE_FOREGROUND_INDEX]; |
| @@ -1298,38 +1296,45 @@ load_face_colors (struct frame *f, struct face *face, | |||
| 1298 | && !NILP (Fbitmap_spec_p (Vface_default_stipple))) | 1296 | && !NILP (Fbitmap_spec_p (Vface_default_stipple))) |
| 1299 | { | 1297 | { |
| 1300 | x_destroy_bitmap (f, face->stipple); | 1298 | x_destroy_bitmap (f, face->stipple); |
| 1301 | face->stipple = load_pixmap (f, Vface_default_stipple, | 1299 | face->stipple = load_pixmap (f, Vface_default_stipple); |
| 1302 | &face->pixmap_w, &face->pixmap_h); | ||
| 1303 | } | 1300 | } |
| 1304 | 1301 | ||
| 1305 | face->background = load_color (f, face, bg, LFACE_BACKGROUND_INDEX); | 1302 | face->background = load_color2 (f, face, bg, LFACE_BACKGROUND_INDEX, &xbg); |
| 1306 | face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX); | 1303 | face->foreground = load_color2 (f, face, fg, LFACE_FOREGROUND_INDEX, &xfg); |
| 1304 | |||
| 1305 | dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX]; | ||
| 1306 | if (!NILP (dfg) && !UNSPECIFIEDP (dfg) | ||
| 1307 | && color_distance (&xbg, &xfg) < NEAR_SAME_COLOR_THRESHOLD) | ||
| 1308 | { | ||
| 1309 | if (EQ (attrs[LFACE_INVERSE_INDEX], Qt)) | ||
| 1310 | face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX); | ||
| 1311 | else | ||
| 1312 | face->foreground = load_color (f, face, dfg, LFACE_FOREGROUND_INDEX); | ||
| 1313 | } | ||
| 1307 | } | 1314 | } |
| 1308 | 1315 | ||
| 1316 | #ifdef HAVE_X_WINDOWS | ||
| 1309 | 1317 | ||
| 1310 | /* Free color PIXEL on frame F. */ | 1318 | /* Free color PIXEL on frame F. */ |
| 1311 | 1319 | ||
| 1312 | void | 1320 | void |
| 1313 | unload_color (struct frame *f, long unsigned int pixel) | 1321 | unload_color (struct frame *f, unsigned long pixel) |
| 1314 | { | 1322 | { |
| 1315 | #ifdef HAVE_X_WINDOWS | ||
| 1316 | if (pixel != -1) | 1323 | if (pixel != -1) |
| 1317 | { | 1324 | { |
| 1318 | block_input (); | 1325 | block_input (); |
| 1319 | x_free_colors (f, &pixel, 1); | 1326 | x_free_colors (f, &pixel, 1); |
| 1320 | unblock_input (); | 1327 | unblock_input (); |
| 1321 | } | 1328 | } |
| 1322 | #endif | ||
| 1323 | } | 1329 | } |
| 1324 | 1330 | ||
| 1325 | |||
| 1326 | /* Free colors allocated for FACE. */ | 1331 | /* Free colors allocated for FACE. */ |
| 1327 | 1332 | ||
| 1328 | static void | 1333 | static void |
| 1329 | free_face_colors (struct frame *f, struct face *face) | 1334 | free_face_colors (struct frame *f, struct face *face) |
| 1330 | { | 1335 | { |
| 1331 | /* PENDING(NS): need to do something here? */ | 1336 | /* PENDING(NS): need to do something here? */ |
| 1332 | #ifdef HAVE_X_WINDOWS | 1337 | |
| 1333 | if (face->colors_copied_bitwise_p) | 1338 | if (face->colors_copied_bitwise_p) |
| 1334 | return; | 1339 | return; |
| 1335 | 1340 | ||
| @@ -1376,9 +1381,10 @@ free_face_colors (struct frame *f, struct face *face) | |||
| 1376 | } | 1381 | } |
| 1377 | 1382 | ||
| 1378 | unblock_input (); | 1383 | unblock_input (); |
| 1379 | #endif /* HAVE_X_WINDOWS */ | ||
| 1380 | } | 1384 | } |
| 1381 | 1385 | ||
| 1386 | #endif /* HAVE_X_WINDOWS */ | ||
| 1387 | |||
| 1382 | #endif /* HAVE_WINDOW_SYSTEM */ | 1388 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1383 | 1389 | ||
| 1384 | 1390 | ||
| @@ -1563,7 +1569,7 @@ the face font sort order. */) | |||
| 1563 | vec = Fvconcat (ndrivers, drivers); | 1569 | vec = Fvconcat (ndrivers, drivers); |
| 1564 | nfonts = ASIZE (vec); | 1570 | nfonts = ASIZE (vec); |
| 1565 | 1571 | ||
| 1566 | qsort (XVECTOR (vec)->u.contents, nfonts, word_size, | 1572 | qsort (XVECTOR (vec)->contents, nfonts, word_size, |
| 1567 | compare_fonts_by_sort_order); | 1573 | compare_fonts_by_sort_order); |
| 1568 | 1574 | ||
| 1569 | result = Qnil; | 1575 | result = Qnil; |
| @@ -1735,6 +1741,8 @@ the WIDTH times as wide as FACE on FRAME. */) | |||
| 1735 | #define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) | 1741 | #define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) |
| 1736 | #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) | 1742 | #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) |
| 1737 | #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) | 1743 | #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) |
| 1744 | #define LFACE_DISTANT_FOREGROUND(LFACE) \ | ||
| 1745 | AREF ((LFACE), LFACE_DISTANT_FOREGROUND_INDEX) | ||
| 1738 | 1746 | ||
| 1739 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size | 1747 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size |
| 1740 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ | 1748 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ |
| @@ -1797,6 +1805,9 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE]) | |||
| 1797 | eassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) | 1805 | eassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) |
| 1798 | || IGNORE_DEFFACE_P (attrs[LFACE_FOREGROUND_INDEX]) | 1806 | || IGNORE_DEFFACE_P (attrs[LFACE_FOREGROUND_INDEX]) |
| 1799 | || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); | 1807 | || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); |
| 1808 | eassert (UNSPECIFIEDP (attrs[LFACE_DISTANT_FOREGROUND_INDEX]) | ||
| 1809 | || IGNORE_DEFFACE_P (attrs[LFACE_DISTANT_FOREGROUND_INDEX]) | ||
| 1810 | || STRINGP (attrs[LFACE_DISTANT_FOREGROUND_INDEX])); | ||
| 1800 | eassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) | 1811 | eassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) |
| 1801 | || IGNORE_DEFFACE_P (attrs[LFACE_BACKGROUND_INDEX]) | 1812 | || IGNORE_DEFFACE_P (attrs[LFACE_BACKGROUND_INDEX]) |
| 1802 | || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); | 1813 | || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); |
| @@ -1828,7 +1839,7 @@ check_lface (Lisp_Object lface) | |||
| 1828 | if (!NILP (lface)) | 1839 | if (!NILP (lface)) |
| 1829 | { | 1840 | { |
| 1830 | eassert (LFACEP (lface)); | 1841 | eassert (LFACEP (lface)); |
| 1831 | check_lface_attrs (XVECTOR (lface)->u.contents); | 1842 | check_lface_attrs (XVECTOR (lface)->contents); |
| 1832 | } | 1843 | } |
| 1833 | } | 1844 | } |
| 1834 | 1845 | ||
| @@ -2005,7 +2016,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, | |||
| 2005 | lface = lface_from_face_name_no_resolve (f, face_name, signal_p); | 2016 | lface = lface_from_face_name_no_resolve (f, face_name, signal_p); |
| 2006 | 2017 | ||
| 2007 | if (! NILP (lface)) | 2018 | if (! NILP (lface)) |
| 2008 | memcpy (attrs, XVECTOR (lface)->u.contents, | 2019 | memcpy (attrs, XVECTOR (lface)->contents, |
| 2009 | LFACE_VECTOR_SIZE * sizeof *attrs); | 2020 | LFACE_VECTOR_SIZE * sizeof *attrs); |
| 2010 | 2021 | ||
| 2011 | return !NILP (lface); | 2022 | return !NILP (lface); |
| @@ -2062,7 +2073,8 @@ lface_fully_specified_p (Lisp_Object attrs[LFACE_VECTOR_SIZE]) | |||
| 2062 | int i; | 2073 | int i; |
| 2063 | 2074 | ||
| 2064 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | 2075 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
| 2065 | if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX) | 2076 | if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX |
| 2077 | && i != LFACE_DISTANT_FOREGROUND_INDEX) | ||
| 2066 | if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i]))) | 2078 | if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i]))) |
| 2067 | break; | 2079 | break; |
| 2068 | 2080 | ||
| @@ -2463,6 +2475,13 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, | |||
| 2463 | else | 2475 | else |
| 2464 | err = 1; | 2476 | err = 1; |
| 2465 | } | 2477 | } |
| 2478 | else if (EQ (keyword, QCdistant_foreground)) | ||
| 2479 | { | ||
| 2480 | if (STRINGP (value)) | ||
| 2481 | to[LFACE_DISTANT_FOREGROUND_INDEX] = value; | ||
| 2482 | else | ||
| 2483 | err = 1; | ||
| 2484 | } | ||
| 2466 | else if (EQ (keyword, QCbackground)) | 2485 | else if (EQ (keyword, QCbackground)) |
| 2467 | { | 2486 | { |
| 2468 | if (STRINGP (value)) | 2487 | if (STRINGP (value)) |
| @@ -2619,7 +2638,7 @@ Value is a vector of face attributes. */) | |||
| 2619 | if (NILP (Fget (face, Qface_no_inherit))) | 2638 | if (NILP (Fget (face, Qface_no_inherit))) |
| 2620 | { | 2639 | { |
| 2621 | ++face_change_count; | 2640 | ++face_change_count; |
| 2622 | ++windows_or_buffers_changed; | 2641 | windows_or_buffers_changed = 54; |
| 2623 | } | 2642 | } |
| 2624 | 2643 | ||
| 2625 | eassert (LFACEP (lface)); | 2644 | eassert (LFACEP (lface)); |
| @@ -2688,7 +2707,7 @@ The value is TO. */) | |||
| 2688 | copy = Finternal_make_lisp_face (to, new_frame); | 2707 | copy = Finternal_make_lisp_face (to, new_frame); |
| 2689 | } | 2708 | } |
| 2690 | 2709 | ||
| 2691 | vcopy (copy, 0, XVECTOR (lface)->u.contents, LFACE_VECTOR_SIZE); | 2710 | vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE); |
| 2692 | 2711 | ||
| 2693 | /* Changing a named face means that all realized faces depending on | 2712 | /* Changing a named face means that all realized faces depending on |
| 2694 | that face are invalid. Since we cannot tell which realized faces | 2713 | that face are invalid. Since we cannot tell which realized faces |
| @@ -2698,7 +2717,7 @@ The value is TO. */) | |||
| 2698 | if (NILP (Fget (to, Qface_no_inherit))) | 2717 | if (NILP (Fget (to, Qface_no_inherit))) |
| 2699 | { | 2718 | { |
| 2700 | ++face_change_count; | 2719 | ++face_change_count; |
| 2701 | ++windows_or_buffers_changed; | 2720 | windows_or_buffers_changed = 55; |
| 2702 | } | 2721 | } |
| 2703 | 2722 | ||
| 2704 | return to; | 2723 | return to; |
| @@ -3019,6 +3038,23 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 3019 | old_value = LFACE_FOREGROUND (lface); | 3038 | old_value = LFACE_FOREGROUND (lface); |
| 3020 | ASET (lface, LFACE_FOREGROUND_INDEX, value); | 3039 | ASET (lface, LFACE_FOREGROUND_INDEX, value); |
| 3021 | } | 3040 | } |
| 3041 | else if (EQ (attr, QCdistant_foreground)) | ||
| 3042 | { | ||
| 3043 | /* Compatibility with 20.x. */ | ||
| 3044 | if (NILP (value)) | ||
| 3045 | value = Qunspecified; | ||
| 3046 | if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)) | ||
| 3047 | { | ||
| 3048 | /* Don't check for valid color names here because it depends | ||
| 3049 | on the frame (display) whether the color will be valid | ||
| 3050 | when the face is realized. */ | ||
| 3051 | CHECK_STRING (value); | ||
| 3052 | if (SCHARS (value) == 0) | ||
| 3053 | signal_error ("Empty distant-foreground color value", value); | ||
| 3054 | } | ||
| 3055 | old_value = LFACE_DISTANT_FOREGROUND (lface); | ||
| 3056 | ASET (lface, LFACE_DISTANT_FOREGROUND_INDEX, value); | ||
| 3057 | } | ||
| 3022 | else if (EQ (attr, QCbackground)) | 3058 | else if (EQ (attr, QCbackground)) |
| 3023 | { | 3059 | { |
| 3024 | /* Compatibility with 20.x. */ | 3060 | /* Compatibility with 20.x. */ |
| @@ -3091,7 +3127,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 3091 | f = XFRAME (frame); | 3127 | f = XFRAME (frame); |
| 3092 | if (! FONT_OBJECT_P (value)) | 3128 | if (! FONT_OBJECT_P (value)) |
| 3093 | { | 3129 | { |
| 3094 | Lisp_Object *attrs = XVECTOR (lface)->u.contents; | 3130 | Lisp_Object *attrs = XVECTOR (lface)->contents; |
| 3095 | Lisp_Object font_object; | 3131 | Lisp_Object font_object; |
| 3096 | 3132 | ||
| 3097 | font_object = font_load_for_lface (f, attrs, value); | 3133 | font_object = font_load_for_lface (f, attrs, value); |
| @@ -3159,7 +3195,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 3159 | the font to nil so that the font selector doesn't think that | 3195 | the font to nil so that the font selector doesn't think that |
| 3160 | the attribute is mandatory. Also, clear the average | 3196 | the attribute is mandatory. Also, clear the average |
| 3161 | width. */ | 3197 | width. */ |
| 3162 | font_clear_prop (XVECTOR (lface)->u.contents, prop_index); | 3198 | font_clear_prop (XVECTOR (lface)->contents, prop_index); |
| 3163 | } | 3199 | } |
| 3164 | 3200 | ||
| 3165 | /* Changing a named face means that all realized faces depending on | 3201 | /* Changing a named face means that all realized faces depending on |
| @@ -3172,7 +3208,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 3172 | && NILP (Fequal (old_value, value))) | 3208 | && NILP (Fequal (old_value, value))) |
| 3173 | { | 3209 | { |
| 3174 | ++face_change_count; | 3210 | ++face_change_count; |
| 3175 | ++windows_or_buffers_changed; | 3211 | windows_or_buffers_changed = 56; |
| 3176 | } | 3212 | } |
| 3177 | 3213 | ||
| 3178 | if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) | 3214 | if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) |
| @@ -3186,10 +3222,10 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 3186 | { | 3222 | { |
| 3187 | #ifdef HAVE_WINDOW_SYSTEM | 3223 | #ifdef HAVE_WINDOW_SYSTEM |
| 3188 | /* Changed font-related attributes of the `default' face are | 3224 | /* Changed font-related attributes of the `default' face are |
| 3189 | reflected in changed `font' frame parameters. */ | 3225 | reflected in changed `font' frame parameters. */ |
| 3190 | if (FRAMEP (frame) | 3226 | if (FRAMEP (frame) |
| 3191 | && (prop_index || EQ (attr, QCfont)) | 3227 | && (prop_index || EQ (attr, QCfont)) |
| 3192 | && lface_fully_specified_p (XVECTOR (lface)->u.contents)) | 3228 | && lface_fully_specified_p (XVECTOR (lface)->contents)) |
| 3193 | set_font_frame_param (frame, lface); | 3229 | set_font_frame_param (frame, lface); |
| 3194 | else | 3230 | else |
| 3195 | #endif /* HAVE_WINDOW_SYSTEM */ | 3231 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -3345,7 +3381,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, | |||
| 3345 | && NILP (Fget (face, Qface_no_inherit))) | 3381 | && NILP (Fget (face, Qface_no_inherit))) |
| 3346 | { | 3382 | { |
| 3347 | ++face_change_count; | 3383 | ++face_change_count; |
| 3348 | ++windows_or_buffers_changed; | 3384 | windows_or_buffers_changed = 57; |
| 3349 | } | 3385 | } |
| 3350 | } | 3386 | } |
| 3351 | 3387 | ||
| @@ -3369,7 +3405,7 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface) | |||
| 3369 | { | 3405 | { |
| 3370 | if (FONT_SPEC_P (font)) | 3406 | if (FONT_SPEC_P (font)) |
| 3371 | { | 3407 | { |
| 3372 | font = font_load_for_lface (f, XVECTOR (lface)->u.contents, font); | 3408 | font = font_load_for_lface (f, XVECTOR (lface)->contents, font); |
| 3373 | if (NILP (font)) | 3409 | if (NILP (font)) |
| 3374 | return; | 3410 | return; |
| 3375 | ASET (lface, LFACE_FONT_INDEX, font); | 3411 | ASET (lface, LFACE_FONT_INDEX, font); |
| @@ -3663,6 +3699,8 @@ frames). If FRAME is omitted or nil, use the selected frame. */) | |||
| 3663 | value = LFACE_INVERSE (lface); | 3699 | value = LFACE_INVERSE (lface); |
| 3664 | else if (EQ (keyword, QCforeground)) | 3700 | else if (EQ (keyword, QCforeground)) |
| 3665 | value = LFACE_FOREGROUND (lface); | 3701 | value = LFACE_FOREGROUND (lface); |
| 3702 | else if (EQ (keyword, QCdistant_foreground)) | ||
| 3703 | value = LFACE_DISTANT_FOREGROUND (lface); | ||
| 3666 | else if (EQ (keyword, QCbackground)) | 3704 | else if (EQ (keyword, QCbackground)) |
| 3667 | value = LFACE_BACKGROUND (lface); | 3705 | value = LFACE_BACKGROUND (lface); |
| 3668 | else if (EQ (keyword, QCstipple)) | 3706 | else if (EQ (keyword, QCstipple)) |
| @@ -3726,8 +3764,8 @@ Default face attributes override any local face attributes. */) | |||
| 3726 | the local frame is defined from default specs in `face-defface-spec' | 3764 | the local frame is defined from default specs in `face-defface-spec' |
| 3727 | and those should be overridden by global settings. Hence the strange | 3765 | and those should be overridden by global settings. Hence the strange |
| 3728 | "global before local" priority. */ | 3766 | "global before local" priority. */ |
| 3729 | lvec = XVECTOR (local_lface)->u.contents; | 3767 | lvec = XVECTOR (local_lface)->contents; |
| 3730 | gvec = XVECTOR (global_lface)->u.contents; | 3768 | gvec = XVECTOR (global_lface)->contents; |
| 3731 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | 3769 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
| 3732 | if (IGNORE_DEFFACE_P (gvec[i])) | 3770 | if (IGNORE_DEFFACE_P (gvec[i])) |
| 3733 | ASET (local_lface, i, Qunspecified); | 3771 | ASET (local_lface, i, Qunspecified); |
| @@ -3911,8 +3949,8 @@ If FRAME is omitted or nil, use the selected frame. */) | |||
| 3911 | 3949 | ||
| 3912 | lface1 = lface_from_face_name (f, face1, 1); | 3950 | lface1 = lface_from_face_name (f, face1, 1); |
| 3913 | lface2 = lface_from_face_name (f, face2, 1); | 3951 | lface2 = lface_from_face_name (f, face2, 1); |
| 3914 | equal_p = lface_equal_p (XVECTOR (lface1)->u.contents, | 3952 | equal_p = lface_equal_p (XVECTOR (lface1)->contents, |
| 3915 | XVECTOR (lface2)->u.contents); | 3953 | XVECTOR (lface2)->contents); |
| 3916 | return equal_p ? Qt : Qnil; | 3954 | return equal_p ? Qt : Qnil; |
| 3917 | } | 3955 | } |
| 3918 | 3956 | ||
| @@ -4018,9 +4056,13 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2) | |||
| 4018 | static struct face * | 4056 | static struct face * |
| 4019 | make_realized_face (Lisp_Object *attr) | 4057 | make_realized_face (Lisp_Object *attr) |
| 4020 | { | 4058 | { |
| 4021 | struct face *face = xzalloc (sizeof *face); | 4059 | enum { off = offsetof (struct face, id) }; |
| 4022 | face->ascii_face = face; | 4060 | struct face *face = xmalloc (sizeof *face); |
| 4061 | |||
| 4023 | memcpy (face->lface, attr, sizeof face->lface); | 4062 | memcpy (face->lface, attr, sizeof face->lface); |
| 4063 | memset (&face->id, 0, sizeof *face - off); | ||
| 4064 | face->ascii_face = face; | ||
| 4065 | |||
| 4024 | return face; | 4066 | return face; |
| 4025 | } | 4067 | } |
| 4026 | 4068 | ||
| @@ -4048,8 +4090,9 @@ free_realized_face (struct frame *f, struct face *face) | |||
| 4048 | face->gc = 0; | 4090 | face->gc = 0; |
| 4049 | unblock_input (); | 4091 | unblock_input (); |
| 4050 | } | 4092 | } |
| 4051 | 4093 | #ifdef HAVE_X_WINDOWS | |
| 4052 | free_face_colors (f, face); | 4094 | free_face_colors (f, face); |
| 4095 | #endif /* HAVE_X_WINDOWS */ | ||
| 4053 | x_destroy_bitmap (f, face->stipple); | 4096 | x_destroy_bitmap (f, face->stipple); |
| 4054 | } | 4097 | } |
| 4055 | #endif /* HAVE_WINDOW_SYSTEM */ | 4098 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -4231,7 +4274,7 @@ free_realized_faces (struct face_cache *c) | |||
| 4231 | if (WINDOWP (f->root_window)) | 4274 | if (WINDOWP (f->root_window)) |
| 4232 | { | 4275 | { |
| 4233 | clear_current_matrices (f); | 4276 | clear_current_matrices (f); |
| 4234 | ++windows_or_buffers_changed; | 4277 | windows_or_buffers_changed = 58; |
| 4235 | } | 4278 | } |
| 4236 | 4279 | ||
| 4237 | unblock_input (); | 4280 | unblock_input (); |
| @@ -4649,7 +4692,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, | |||
| 4649 | Lisp_Object lface; | 4692 | Lisp_Object lface; |
| 4650 | lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), | 4693 | lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), |
| 4651 | Qunspecified); | 4694 | Qunspecified); |
| 4652 | merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->u.contents, | 4695 | merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents, |
| 4653 | 1, 0); | 4696 | 1, 0); |
| 4654 | return lface; | 4697 | return lface; |
| 4655 | } | 4698 | } |
| @@ -4669,7 +4712,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, | |||
| 4669 | 4712 | ||
| 4670 | #ifdef HAVE_WINDOW_SYSTEM | 4713 | #ifdef HAVE_WINDOW_SYSTEM |
| 4671 | 4714 | ||
| 4672 | /* Return non-zero if all the face attributes in ATTRS are supported | 4715 | /* Return true if all the face attributes in ATTRS are supported |
| 4673 | on the window-system frame F. | 4716 | on the window-system frame F. |
| 4674 | 4717 | ||
| 4675 | The definition of `supported' is somewhat heuristic, but basically means | 4718 | The definition of `supported' is somewhat heuristic, but basically means |
| @@ -4679,7 +4722,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, | |||
| 4679 | \(1) different in appearance than the default face, and | 4722 | \(1) different in appearance than the default face, and |
| 4680 | \(2) `close in spirit' to what the attributes specify, if not exact. */ | 4723 | \(2) `close in spirit' to what the attributes specify, if not exact. */ |
| 4681 | 4724 | ||
| 4682 | static int | 4725 | static bool |
| 4683 | x_supports_face_attributes_p (struct frame *f, | 4726 | x_supports_face_attributes_p (struct frame *f, |
| 4684 | Lisp_Object attrs[LFACE_VECTOR_SIZE], | 4727 | Lisp_Object attrs[LFACE_VECTOR_SIZE], |
| 4685 | struct face *def_face) | 4728 | struct face *def_face) |
| @@ -4697,6 +4740,9 @@ x_supports_face_attributes_p (struct frame *f, | |||
| 4697 | || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) | 4740 | || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) |
| 4698 | && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX], | 4741 | && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX], |
| 4699 | def_attrs[LFACE_FOREGROUND_INDEX])) | 4742 | def_attrs[LFACE_FOREGROUND_INDEX])) |
| 4743 | || (!UNSPECIFIEDP (attrs[LFACE_DISTANT_FOREGROUND_INDEX]) | ||
| 4744 | && face_attr_equal_p (attrs[LFACE_DISTANT_FOREGROUND_INDEX], | ||
| 4745 | def_attrs[LFACE_DISTANT_FOREGROUND_INDEX])) | ||
| 4700 | || (!UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) | 4746 | || (!UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) |
| 4701 | && face_attr_equal_p (attrs[LFACE_BACKGROUND_INDEX], | 4747 | && face_attr_equal_p (attrs[LFACE_BACKGROUND_INDEX], |
| 4702 | def_attrs[LFACE_BACKGROUND_INDEX])) | 4748 | def_attrs[LFACE_BACKGROUND_INDEX])) |
| @@ -4766,7 +4812,7 @@ x_supports_face_attributes_p (struct frame *f, | |||
| 4766 | 4812 | ||
| 4767 | #endif /* HAVE_WINDOW_SYSTEM */ | 4813 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4768 | 4814 | ||
| 4769 | /* Return non-zero if all the face attributes in ATTRS are supported | 4815 | /* Return true if all the face attributes in ATTRS are supported |
| 4770 | on the tty frame F. | 4816 | on the tty frame F. |
| 4771 | 4817 | ||
| 4772 | The definition of `supported' is somewhat heuristic, but basically means | 4818 | The definition of `supported' is somewhat heuristic, but basically means |
| @@ -4782,7 +4828,7 @@ x_supports_face_attributes_p (struct frame *f, | |||
| 4782 | will _not_ be satisfied by the tty display code's automatic | 4828 | will _not_ be satisfied by the tty display code's automatic |
| 4783 | substitution of a `dim' face for italic. */ | 4829 | substitution of a `dim' face for italic. */ |
| 4784 | 4830 | ||
| 4785 | static int | 4831 | static bool |
| 4786 | tty_supports_face_attributes_p (struct frame *f, | 4832 | tty_supports_face_attributes_p (struct frame *f, |
| 4787 | Lisp_Object attrs[LFACE_VECTOR_SIZE], | 4833 | Lisp_Object attrs[LFACE_VECTOR_SIZE], |
| 4788 | struct face *def_face) | 4834 | struct face *def_face) |
| @@ -4876,12 +4922,6 @@ tty_supports_face_attributes_p (struct frame *f, | |||
| 4876 | 4922 | ||
| 4877 | /* Color testing. */ | 4923 | /* Color testing. */ |
| 4878 | 4924 | ||
| 4879 | /* Default the color indices in FG_TTY_COLOR and BG_TTY_COLOR, since | ||
| 4880 | we use them when calling `tty_capable_p' below, even if the face | ||
| 4881 | specifies no colors. */ | ||
| 4882 | fg_tty_color.pixel = FACE_TTY_DEFAULT_FG_COLOR; | ||
| 4883 | bg_tty_color.pixel = FACE_TTY_DEFAULT_BG_COLOR; | ||
| 4884 | |||
| 4885 | /* Check if foreground color is close enough. */ | 4925 | /* Check if foreground color is close enough. */ |
| 4886 | fg = attrs[LFACE_FOREGROUND_INDEX]; | 4926 | fg = attrs[LFACE_FOREGROUND_INDEX]; |
| 4887 | if (STRINGP (fg)) | 4927 | if (STRINGP (fg)) |
| @@ -4947,14 +4987,7 @@ tty_supports_face_attributes_p (struct frame *f, | |||
| 4947 | 4987 | ||
| 4948 | /* See if the capabilities we selected above are supported, with the | 4988 | /* See if the capabilities we selected above are supported, with the |
| 4949 | given colors. */ | 4989 | given colors. */ |
| 4950 | if (test_caps != 0 && | 4990 | return tty_capable_p (FRAME_TTY (f), test_caps); |
| 4951 | ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel, | ||
| 4952 | bg_tty_color.pixel)) | ||
| 4953 | return 0; | ||
| 4954 | |||
| 4955 | |||
| 4956 | /* Hmmm, everything checks out, this terminal must support this face. */ | ||
| 4957 | return 1; | ||
| 4958 | } | 4991 | } |
| 4959 | 4992 | ||
| 4960 | 4993 | ||
| @@ -4979,7 +5012,8 @@ satisfied by the tty display code's automatic substitution of a `dim' | |||
| 4979 | face for italic. */) | 5012 | face for italic. */) |
| 4980 | (Lisp_Object attributes, Lisp_Object display) | 5013 | (Lisp_Object attributes, Lisp_Object display) |
| 4981 | { | 5014 | { |
| 4982 | int supports = 0, i; | 5015 | bool supports = 0; |
| 5016 | int i; | ||
| 4983 | Lisp_Object frame; | 5017 | Lisp_Object frame; |
| 4984 | struct frame *f; | 5018 | struct frame *f; |
| 4985 | struct face *def_face; | 5019 | struct face *def_face; |
| @@ -5329,9 +5363,9 @@ realize_default_face (struct frame *f) | |||
| 5329 | ASET (lface, LFACE_STIPPLE_INDEX, Qnil); | 5363 | ASET (lface, LFACE_STIPPLE_INDEX, Qnil); |
| 5330 | 5364 | ||
| 5331 | /* Realize the face; it must be fully-specified now. */ | 5365 | /* Realize the face; it must be fully-specified now. */ |
| 5332 | eassert (lface_fully_specified_p (XVECTOR (lface)->u.contents)); | 5366 | eassert (lface_fully_specified_p (XVECTOR (lface)->contents)); |
| 5333 | check_lface (lface); | 5367 | check_lface (lface); |
| 5334 | memcpy (attrs, XVECTOR (lface)->u.contents, sizeof attrs); | 5368 | memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs); |
| 5335 | face = realize_face (c, attrs, DEFAULT_FACE_ID); | 5369 | face = realize_face (c, attrs, DEFAULT_FACE_ID); |
| 5336 | 5370 | ||
| 5337 | #ifdef HAVE_WINDOW_SYSTEM | 5371 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -5716,7 +5750,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]) | |||
| 5716 | 5750 | ||
| 5717 | stipple = attrs[LFACE_STIPPLE_INDEX]; | 5751 | stipple = attrs[LFACE_STIPPLE_INDEX]; |
| 5718 | if (!NILP (stipple)) | 5752 | if (!NILP (stipple)) |
| 5719 | face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h); | 5753 | face->stipple = load_pixmap (f, stipple); |
| 5720 | #endif /* HAVE_WINDOW_SYSTEM */ | 5754 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 5721 | 5755 | ||
| 5722 | return face; | 5756 | return face; |
| @@ -5925,7 +5959,6 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) | |||
| 5925 | 5959 | ||
| 5926 | int | 5960 | int |
| 5927 | face_at_buffer_position (struct window *w, ptrdiff_t pos, | 5961 | face_at_buffer_position (struct window *w, ptrdiff_t pos, |
| 5928 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 5929 | ptrdiff_t *endptr, ptrdiff_t limit, | 5962 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 5930 | int mouse, int base_face_id) | 5963 | int mouse, int base_face_id) |
| 5931 | { | 5964 | { |
| @@ -5946,8 +5979,6 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 5946 | XSETFASTINT (position, pos); | 5979 | XSETFASTINT (position, pos); |
| 5947 | 5980 | ||
| 5948 | endpos = ZV; | 5981 | endpos = ZV; |
| 5949 | if (pos < region_beg && region_beg < endpos) | ||
| 5950 | endpos = region_beg; | ||
| 5951 | 5982 | ||
| 5952 | /* Get the `face' or `mouse_face' text property at POS, and | 5983 | /* Get the `face' or `mouse_face' text property at POS, and |
| 5953 | determine the next position at which the property changes. */ | 5984 | determine the next position at which the property changes. */ |
| @@ -5983,8 +6014,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 5983 | 6014 | ||
| 5984 | /* Optimize common cases where we can use the default face. */ | 6015 | /* Optimize common cases where we can use the default face. */ |
| 5985 | if (noverlays == 0 | 6016 | if (noverlays == 0 |
| 5986 | && NILP (prop) | 6017 | && NILP (prop)) |
| 5987 | && !(pos >= region_beg && pos < region_end)) | ||
| 5988 | return default_face->id; | 6018 | return default_face->id; |
| 5989 | 6019 | ||
| 5990 | /* Begin with attributes from the default face. */ | 6020 | /* Begin with attributes from the default face. */ |
| @@ -6011,15 +6041,6 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6011 | endpos = oendpos; | 6041 | endpos = oendpos; |
| 6012 | } | 6042 | } |
| 6013 | 6043 | ||
| 6014 | /* If in the region, merge in the region face. */ | ||
| 6015 | if (pos >= region_beg && pos < region_end) | ||
| 6016 | { | ||
| 6017 | merge_named_face (f, Qregion, attrs, 0); | ||
| 6018 | |||
| 6019 | if (region_end < endpos) | ||
| 6020 | endpos = region_end; | ||
| 6021 | } | ||
| 6022 | |||
| 6023 | *endptr = endpos; | 6044 | *endptr = endpos; |
| 6024 | 6045 | ||
| 6025 | /* Look up a realized face with the given face attributes, | 6046 | /* Look up a realized face with the given face attributes, |
| @@ -6035,7 +6056,6 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6035 | 6056 | ||
| 6036 | int | 6057 | int |
| 6037 | face_for_overlay_string (struct window *w, ptrdiff_t pos, | 6058 | face_for_overlay_string (struct window *w, ptrdiff_t pos, |
| 6038 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 6039 | ptrdiff_t *endptr, ptrdiff_t limit, | 6059 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 6040 | int mouse, Lisp_Object overlay) | 6060 | int mouse, Lisp_Object overlay) |
| 6041 | { | 6061 | { |
| @@ -6054,8 +6074,6 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6054 | XSETFASTINT (position, pos); | 6074 | XSETFASTINT (position, pos); |
| 6055 | 6075 | ||
| 6056 | endpos = ZV; | 6076 | endpos = ZV; |
| 6057 | if (pos < region_beg && region_beg < endpos) | ||
| 6058 | endpos = region_beg; | ||
| 6059 | 6077 | ||
| 6060 | /* Get the `face' or `mouse_face' text property at POS, and | 6078 | /* Get the `face' or `mouse_face' text property at POS, and |
| 6061 | determine the next position at which the property changes. */ | 6079 | determine the next position at which the property changes. */ |
| @@ -6069,7 +6087,6 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6069 | 6087 | ||
| 6070 | /* Optimize common case where we can use the default face. */ | 6088 | /* Optimize common case where we can use the default face. */ |
| 6071 | if (NILP (prop) | 6089 | if (NILP (prop) |
| 6072 | && !(pos >= region_beg && pos < region_end) | ||
| 6073 | && NILP (Vface_remapping_alist)) | 6090 | && NILP (Vface_remapping_alist)) |
| 6074 | return DEFAULT_FACE_ID; | 6091 | return DEFAULT_FACE_ID; |
| 6075 | 6092 | ||
| @@ -6081,15 +6098,6 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6081 | if (!NILP (prop)) | 6098 | if (!NILP (prop)) |
| 6082 | merge_face_ref (f, prop, attrs, 1, 0); | 6099 | merge_face_ref (f, prop, attrs, 1, 0); |
| 6083 | 6100 | ||
| 6084 | /* If in the region, merge in the region face. */ | ||
| 6085 | if (pos >= region_beg && pos < region_end) | ||
| 6086 | { | ||
| 6087 | merge_named_face (f, Qregion, attrs, 0); | ||
| 6088 | |||
| 6089 | if (region_end < endpos) | ||
| 6090 | endpos = region_end; | ||
| 6091 | } | ||
| 6092 | |||
| 6093 | *endptr = endpos; | 6101 | *endptr = endpos; |
| 6094 | 6102 | ||
| 6095 | /* Look up a realized face with the given face attributes, | 6103 | /* Look up a realized face with the given face attributes, |
| @@ -6122,7 +6130,6 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6122 | int | 6130 | int |
| 6123 | face_at_string_position (struct window *w, Lisp_Object string, | 6131 | face_at_string_position (struct window *w, Lisp_Object string, |
| 6124 | ptrdiff_t pos, ptrdiff_t bufpos, | 6132 | ptrdiff_t pos, ptrdiff_t bufpos, |
| 6125 | ptrdiff_t region_beg, ptrdiff_t region_end, | ||
| 6126 | ptrdiff_t *endptr, enum face_id base_face_id, | 6133 | ptrdiff_t *endptr, enum face_id base_face_id, |
| 6127 | int mouse_p) | 6134 | int mouse_p) |
| 6128 | { | 6135 | { |
| @@ -6154,15 +6161,8 @@ face_at_string_position (struct window *w, Lisp_Object string, | |||
| 6154 | base_face = FACE_FROM_ID (f, base_face_id); | 6161 | base_face = FACE_FROM_ID (f, base_face_id); |
| 6155 | eassert (base_face); | 6162 | eassert (base_face); |
| 6156 | 6163 | ||
| 6157 | /* Optimize the default case that there is no face property and we | 6164 | /* Optimize the default case that there is no face property. */ |
| 6158 | are not in the region. */ | ||
| 6159 | if (NILP (prop) | 6165 | if (NILP (prop) |
| 6160 | && (base_face_id != DEFAULT_FACE_ID | ||
| 6161 | /* BUFPOS <= 0 means STRING is not an overlay string, so | ||
| 6162 | that the region doesn't have to be taken into account. */ | ||
| 6163 | || bufpos <= 0 | ||
| 6164 | || bufpos < region_beg | ||
| 6165 | || bufpos >= region_end) | ||
| 6166 | && (multibyte_p | 6166 | && (multibyte_p |
| 6167 | /* We can't realize faces for different charsets differently | 6167 | /* We can't realize faces for different charsets differently |
| 6168 | if we don't have fonts, so we can stop here if not working | 6168 | if we don't have fonts, so we can stop here if not working |
| @@ -6178,12 +6178,6 @@ face_at_string_position (struct window *w, Lisp_Object string, | |||
| 6178 | if (!NILP (prop)) | 6178 | if (!NILP (prop)) |
| 6179 | merge_face_ref (f, prop, attrs, 1, 0); | 6179 | merge_face_ref (f, prop, attrs, 1, 0); |
| 6180 | 6180 | ||
| 6181 | /* If in the region, merge in the region face. */ | ||
| 6182 | if (bufpos | ||
| 6183 | && bufpos >= region_beg | ||
| 6184 | && bufpos < region_end) | ||
| 6185 | merge_named_face (f, Qregion, attrs, 0); | ||
| 6186 | |||
| 6187 | /* Look up a realized face with the given face attributes, | 6181 | /* Look up a realized face with the given face attributes, |
| 6188 | or realize a new one for ASCII characters. */ | 6182 | or realize a new one for ASCII characters. */ |
| 6189 | return lookup_face (f, attrs); | 6183 | return lookup_face (f, attrs); |
| @@ -6410,6 +6404,7 @@ syms_of_xfaces (void) | |||
| 6410 | DEFSYM (QCwidth, ":width"); | 6404 | DEFSYM (QCwidth, ":width"); |
| 6411 | DEFSYM (QCfont, ":font"); | 6405 | DEFSYM (QCfont, ":font"); |
| 6412 | DEFSYM (QCfontset, ":fontset"); | 6406 | DEFSYM (QCfontset, ":fontset"); |
| 6407 | DEFSYM (QCdistant_foreground, ":distant-foreground"); | ||
| 6413 | DEFSYM (QCbold, ":bold"); | 6408 | DEFSYM (QCbold, ":bold"); |
| 6414 | DEFSYM (QCitalic, ":italic"); | 6409 | DEFSYM (QCitalic, ":italic"); |
| 6415 | DEFSYM (QCoverline, ":overline"); | 6410 | DEFSYM (QCoverline, ":overline"); |
diff --git a/src/xfns.c b/src/xfns.c index 9cd7d3e6627..46f377042f6 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -959,7 +959,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 959 | nlines = 0; | 959 | nlines = 0; |
| 960 | 960 | ||
| 961 | /* Make sure we redisplay all windows in this frame. */ | 961 | /* Make sure we redisplay all windows in this frame. */ |
| 962 | windows_or_buffers_changed++; | 962 | windows_or_buffers_changed = 59; |
| 963 | 963 | ||
| 964 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 964 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 965 | FRAME_MENU_BAR_LINES (f) = 0; | 965 | FRAME_MENU_BAR_LINES (f) = 0; |
| @@ -1068,8 +1068,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1068 | 1068 | ||
| 1069 | #else /* !USE_GTK */ | 1069 | #else /* !USE_GTK */ |
| 1070 | 1070 | ||
| 1071 | /* Make sure we redisplay all windows in this frame. */ | 1071 | /* Make sure we redisplay all windows in this frame. */ |
| 1072 | ++windows_or_buffers_changed; | 1072 | windows_or_buffers_changed = 60; |
| 1073 | 1073 | ||
| 1074 | delta = nlines - FRAME_TOOL_BAR_LINES (f); | 1074 | delta = nlines - FRAME_TOOL_BAR_LINES (f); |
| 1075 | 1075 | ||
| @@ -1383,7 +1383,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 1383 | /* If we're switching from explicit to implicit, we had better | 1383 | /* If we're switching from explicit to implicit, we had better |
| 1384 | update the mode lines and thereby update the title. */ | 1384 | update the mode lines and thereby update the title. */ |
| 1385 | if (f->explicit_name && NILP (name)) | 1385 | if (f->explicit_name && NILP (name)) |
| 1386 | update_mode_lines = 1; | 1386 | update_mode_lines = 37; |
| 1387 | 1387 | ||
| 1388 | f->explicit_name = ! NILP (name); | 1388 | f->explicit_name = ! NILP (name); |
| 1389 | } | 1389 | } |
| @@ -1445,7 +1445,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) | |||
| 1445 | if (EQ (name, f->title)) | 1445 | if (EQ (name, f->title)) |
| 1446 | return; | 1446 | return; |
| 1447 | 1447 | ||
| 1448 | update_mode_lines = 1; | 1448 | update_mode_lines = 38; |
| 1449 | 1449 | ||
| 1450 | fset_title (f, name); | 1450 | fset_title (f, name); |
| 1451 | 1451 | ||
| @@ -1750,7 +1750,7 @@ xic_create_fontsetname (const char *base_fontname, int motif) | |||
| 1750 | } | 1750 | } |
| 1751 | } | 1751 | } |
| 1752 | if (motif) | 1752 | if (motif) |
| 1753 | strcat (fontsetname, ":"); | 1753 | return strcat (fontsetname, ":"); |
| 1754 | return fontsetname; | 1754 | return fontsetname; |
| 1755 | } | 1755 | } |
| 1756 | #endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */ | 1756 | #endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */ |
| @@ -2880,6 +2880,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2880 | f->output_data.x->scroll_bar_top_shadow_pixel = -1; | 2880 | f->output_data.x->scroll_bar_top_shadow_pixel = -1; |
| 2881 | f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; | 2881 | f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; |
| 2882 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 2882 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 2883 | f->output_data.x->white_relief.pixel = -1; | ||
| 2884 | f->output_data.x->black_relief.pixel = -1; | ||
| 2883 | 2885 | ||
| 2884 | fset_icon_name (f, | 2886 | fset_icon_name (f, |
| 2885 | x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", | 2887 | x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", |
| @@ -4824,6 +4826,9 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4824 | f->output_data.x->scroll_bar_top_shadow_pixel = -1; | 4826 | f->output_data.x->scroll_bar_top_shadow_pixel = -1; |
| 4825 | f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; | 4827 | f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; |
| 4826 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 4828 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 4829 | f->output_data.x->white_relief.pixel = -1; | ||
| 4830 | f->output_data.x->black_relief.pixel = -1; | ||
| 4831 | |||
| 4827 | fset_icon_name (f, Qnil); | 4832 | fset_icon_name (f, Qnil); |
| 4828 | FRAME_DISPLAY_INFO (f) = dpyinfo; | 4833 | FRAME_DISPLAY_INFO (f) = dpyinfo; |
| 4829 | f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; | 4834 | f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; |
diff --git a/src/xfont.c b/src/xfont.c index c5b8db3830c..d4d6ee7c10f 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -119,7 +119,7 @@ static Lisp_Object xfont_list (struct frame *, Lisp_Object); | |||
| 119 | static Lisp_Object xfont_match (struct frame *, Lisp_Object); | 119 | static Lisp_Object xfont_match (struct frame *, Lisp_Object); |
| 120 | static Lisp_Object xfont_list_family (struct frame *); | 120 | static Lisp_Object xfont_list_family (struct frame *); |
| 121 | static Lisp_Object xfont_open (struct frame *, Lisp_Object, int); | 121 | static Lisp_Object xfont_open (struct frame *, Lisp_Object, int); |
| 122 | static void xfont_close (struct frame *, struct font *); | 122 | static void xfont_close (struct font *); |
| 123 | static int xfont_prepare_face (struct frame *, struct face *); | 123 | static int xfont_prepare_face (struct frame *, struct face *); |
| 124 | static int xfont_has_char (Lisp_Object, int); | 124 | static int xfont_has_char (Lisp_Object, int); |
| 125 | static unsigned xfont_encode_char (struct font *, int); | 125 | static unsigned xfont_encode_char (struct font *, int); |
| @@ -384,7 +384,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 384 | if (num_fonts > 0) | 384 | if (num_fonts > 0) |
| 385 | { | 385 | { |
| 386 | char **indices = alloca (sizeof (char *) * num_fonts); | 386 | char **indices = alloca (sizeof (char *) * num_fonts); |
| 387 | Lisp_Object *props = XVECTOR (xfont_scratch_props)->u.contents; | 387 | Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents; |
| 388 | Lisp_Object scripts = Qnil; | 388 | Lisp_Object scripts = Qnil; |
| 389 | 389 | ||
| 390 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) | 390 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) |
| @@ -890,11 +890,17 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 890 | } | 890 | } |
| 891 | 891 | ||
| 892 | static void | 892 | static void |
| 893 | xfont_close (struct frame *f, struct font *font) | 893 | xfont_close (struct font *font) |
| 894 | { | 894 | { |
| 895 | block_input (); | 895 | struct xfont_info *xfi = (struct xfont_info *) font; |
| 896 | XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); | 896 | |
| 897 | unblock_input (); | 897 | if (xfi->xfont) |
| 898 | { | ||
| 899 | block_input (); | ||
| 900 | XFreeFont (xfi->display, xfi->xfont); | ||
| 901 | unblock_input (); | ||
| 902 | xfi->xfont = NULL; | ||
| 903 | } | ||
| 898 | } | 904 | } |
| 899 | 905 | ||
| 900 | static int | 906 | static int |
diff --git a/src/xftfont.c b/src/xftfont.c index f2b4c2abe2b..37b33b3ead8 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -58,7 +58,6 @@ struct xftfont_info | |||
| 58 | int index; | 58 | int index; |
| 59 | FT_Matrix matrix; | 59 | FT_Matrix matrix; |
| 60 | Display *display; | 60 | Display *display; |
| 61 | int screen; | ||
| 62 | XftFont *xftfont; | 61 | XftFont *xftfont; |
| 63 | }; | 62 | }; |
| 64 | 63 | ||
| @@ -70,11 +69,6 @@ struct xftface_info | |||
| 70 | XftColor xft_bg; /* color for face->background */ | 69 | XftColor xft_bg; /* color for face->background */ |
| 71 | }; | 70 | }; |
| 72 | 71 | ||
| 73 | static void xftfont_get_colors (struct frame *, struct face *, GC gc, | ||
| 74 | struct xftface_info *, | ||
| 75 | XftColor *fg, XftColor *bg); | ||
| 76 | |||
| 77 | |||
| 78 | /* Setup foreground and background colors of GC into FG and BG. If | 72 | /* Setup foreground and background colors of GC into FG and BG. If |
| 79 | XFTFACE_INFO is not NULL, reuse the colors in it if possible. BG | 73 | XFTFACE_INFO is not NULL, reuse the colors in it if possible. BG |
| 80 | may be NULL. */ | 74 | may be NULL. */ |
| @@ -377,7 +371,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 377 | 371 | ||
| 378 | xftfont_info = (struct xftfont_info *) font; | 372 | xftfont_info = (struct xftfont_info *) font; |
| 379 | xftfont_info->display = display; | 373 | xftfont_info->display = display; |
| 380 | xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f); | ||
| 381 | xftfont_info->xftfont = xftfont; | 374 | xftfont_info->xftfont = xftfont; |
| 382 | /* This means that there's no need of transformation. */ | 375 | /* This means that there's no need of transformation. */ |
| 383 | xftfont_info->matrix.xx = 0; | 376 | xftfont_info->matrix.xx = 0; |
| @@ -486,18 +479,26 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 486 | } | 479 | } |
| 487 | 480 | ||
| 488 | static void | 481 | static void |
| 489 | xftfont_close (struct frame *f, struct font *font) | 482 | xftfont_close (struct font *font) |
| 490 | { | 483 | { |
| 491 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | 484 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; |
| 492 | 485 | ||
| 493 | #ifdef HAVE_LIBOTF | 486 | #ifdef HAVE_LIBOTF |
| 494 | if (xftfont_info->otf) | 487 | if (xftfont_info->otf) |
| 495 | OTF_close (xftfont_info->otf); | 488 | { |
| 489 | OTF_close (xftfont_info->otf); | ||
| 490 | xftfont_info->otf = NULL; | ||
| 491 | } | ||
| 496 | #endif | 492 | #endif |
| 497 | block_input (); | 493 | |
| 498 | XftUnlockFace (xftfont_info->xftfont); | 494 | if (xftfont_info->xftfont) |
| 499 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); | 495 | { |
| 500 | unblock_input (); | 496 | block_input (); |
| 497 | XftUnlockFace (xftfont_info->xftfont); | ||
| 498 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); | ||
| 499 | unblock_input (); | ||
| 500 | xftfont_info->xftfont = NULL; | ||
| 501 | } | ||
| 501 | } | 502 | } |
| 502 | 503 | ||
| 503 | static int | 504 | static int |
diff --git a/src/xmenu.c b/src/xmenu.c index d910100f77f..b2c7fb5f073 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -847,7 +847,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 847 | 847 | ||
| 848 | /* Save the frame's previous menu bar contents data. */ | 848 | /* Save the frame's previous menu bar contents data. */ |
| 849 | if (previous_menu_items_used) | 849 | if (previous_menu_items_used) |
| 850 | memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, | 850 | memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, |
| 851 | previous_menu_items_used * word_size); | 851 | previous_menu_items_used * word_size); |
| 852 | 852 | ||
| 853 | /* Fill in menu_items with the current menu bar contents. | 853 | /* Fill in menu_items with the current menu bar contents. |
| @@ -2086,7 +2086,7 @@ menu_help_callback (char const *help_string, int pane, int item) | |||
| 2086 | Lisp_Object pane_name; | 2086 | Lisp_Object pane_name; |
| 2087 | Lisp_Object menu_object; | 2087 | Lisp_Object menu_object; |
| 2088 | 2088 | ||
| 2089 | first_item = XVECTOR (menu_items)->u.contents; | 2089 | first_item = XVECTOR (menu_items)->contents; |
| 2090 | if (EQ (first_item[0], Qt)) | 2090 | if (EQ (first_item[0], Qt)) |
| 2091 | pane_name = first_item[MENU_ITEMS_PANE_NAME]; | 2091 | pane_name = first_item[MENU_ITEMS_PANE_NAME]; |
| 2092 | else if (EQ (first_item[0], Qquote)) | 2092 | else if (EQ (first_item[0], Qquote)) |
diff --git a/src/xrdb.c b/src/xrdb.c index 52988f0818a..ea823b2b313 100644 --- a/src/xrdb.c +++ b/src/xrdb.c | |||
| @@ -234,9 +234,7 @@ gethomedir (void) | |||
| 234 | 234 | ||
| 235 | copy = xmalloc (strlen (ptr) + 2); | 235 | copy = xmalloc (strlen (ptr) + 2); |
| 236 | strcpy (copy, ptr); | 236 | strcpy (copy, ptr); |
| 237 | strcat (copy, "/"); | 237 | return strcat (copy, "/"); |
| 238 | |||
| 239 | return copy; | ||
| 240 | } | 238 | } |
| 241 | 239 | ||
| 242 | 240 | ||
diff --git a/src/xselect.c b/src/xselect.c index b4f4f9d43b6..6dbeb539f77 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -972,7 +972,6 @@ x_handle_selection_clear (struct input_event *event) | |||
| 972 | Frun_hook_with_args (2, args); | 972 | Frun_hook_with_args (2, args); |
| 973 | } | 973 | } |
| 974 | 974 | ||
| 975 | prepare_menu_bars (); | ||
| 976 | redisplay_preserve_echo_area (20); | 975 | redisplay_preserve_echo_area (20); |
| 977 | } | 976 | } |
| 978 | 977 | ||
| @@ -2365,7 +2364,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) | |||
| 2365 | 2364 | ||
| 2366 | Lisp_Object | 2365 | Lisp_Object |
| 2367 | x_property_data_to_lisp (struct frame *f, const unsigned char *data, | 2366 | x_property_data_to_lisp (struct frame *f, const unsigned char *data, |
| 2368 | Atom type, int format, long unsigned int size) | 2367 | Atom type, int format, unsigned long size) |
| 2369 | { | 2368 | { |
| 2370 | ptrdiff_t format_bytes = format >> 3; | 2369 | ptrdiff_t format_bytes = format >> 3; |
| 2371 | if (PTRDIFF_MAX / format_bytes < size) | 2370 | if (PTRDIFF_MAX / format_bytes < size) |
diff --git a/src/xsettings.c b/src/xsettings.c index e5a66c4cf0a..cff0c99548d 100644 --- a/src/xsettings.c +++ b/src/xsettings.c | |||
| @@ -393,7 +393,7 @@ get_prop_window (struct x_display_info *dpyinfo) | |||
| 393 | 393 | ||
| 394 | static int | 394 | static int |
| 395 | parse_settings (unsigned char *prop, | 395 | parse_settings (unsigned char *prop, |
| 396 | long unsigned int bytes, | 396 | unsigned long bytes, |
| 397 | struct xsettings *settings) | 397 | struct xsettings *settings) |
| 398 | { | 398 | { |
| 399 | Lisp_Object byteorder = Fbyteorder (); | 399 | Lisp_Object byteorder = Fbyteorder (); |
diff --git a/src/xterm.c b/src/xterm.c index 26ad5267625..446b2cf1e45 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1643,7 +1643,7 @@ x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color) | |||
| 1643 | get color reference counts right. */ | 1643 | get color reference counts right. */ |
| 1644 | 1644 | ||
| 1645 | unsigned long | 1645 | unsigned long |
| 1646 | x_copy_color (struct frame *f, long unsigned int pixel) | 1646 | x_copy_color (struct frame *f, unsigned long pixel) |
| 1647 | { | 1647 | { |
| 1648 | XColor color; | 1648 | XColor color; |
| 1649 | 1649 | ||
| @@ -1681,7 +1681,8 @@ x_copy_color (struct frame *f, long unsigned int pixel) | |||
| 1681 | Value is non-zero if successful. */ | 1681 | Value is non-zero if successful. */ |
| 1682 | 1682 | ||
| 1683 | static bool | 1683 | static bool |
| 1684 | x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta) | 1684 | x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, |
| 1685 | unsigned long *pixel, double factor, int delta) | ||
| 1685 | { | 1686 | { |
| 1686 | XColor color, new; | 1687 | XColor color, new; |
| 1687 | long bright; | 1688 | long bright; |
| @@ -1757,7 +1758,8 @@ x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long un | |||
| 1757 | be allocated, use DEFAULT_PIXEL, instead. */ | 1758 | be allocated, use DEFAULT_PIXEL, instead. */ |
| 1758 | 1759 | ||
| 1759 | static void | 1760 | static void |
| 1760 | x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, long unsigned int default_pixel) | 1761 | x_setup_relief_color (struct frame *f, struct relief *relief, double factor, |
| 1762 | int delta, unsigned long default_pixel) | ||
| 1761 | { | 1763 | { |
| 1762 | XGCValues xgcv; | 1764 | XGCValues xgcv; |
| 1763 | struct x_output *di = f->output_data.x; | 1765 | struct x_output *di = f->output_data.x; |
| @@ -1774,11 +1776,10 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int | |||
| 1774 | /* Free previously allocated color. The color cell will be reused | 1776 | /* Free previously allocated color. The color cell will be reused |
| 1775 | when it has been freed as many times as it was allocated, so this | 1777 | when it has been freed as many times as it was allocated, so this |
| 1776 | doesn't affect faces using the same colors. */ | 1778 | doesn't affect faces using the same colors. */ |
| 1777 | if (relief->gc | 1779 | if (relief->gc && relief->pixel != -1) |
| 1778 | && relief->allocated_p) | ||
| 1779 | { | 1780 | { |
| 1780 | x_free_colors (f, &relief->pixel, 1); | 1781 | x_free_colors (f, &relief->pixel, 1); |
| 1781 | relief->allocated_p = 0; | 1782 | relief->pixel = -1; |
| 1782 | } | 1783 | } |
| 1783 | 1784 | ||
| 1784 | /* Allocate new color. */ | 1785 | /* Allocate new color. */ |
| @@ -1786,10 +1787,7 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int | |||
| 1786 | pixel = background; | 1787 | pixel = background; |
| 1787 | if (dpyinfo->n_planes != 1 | 1788 | if (dpyinfo->n_planes != 1 |
| 1788 | && x_alloc_lighter_color (f, dpy, cmap, &pixel, factor, delta)) | 1789 | && x_alloc_lighter_color (f, dpy, cmap, &pixel, factor, delta)) |
| 1789 | { | 1790 | xgcv.foreground = relief->pixel = pixel; |
| 1790 | relief->allocated_p = 1; | ||
| 1791 | xgcv.foreground = relief->pixel = pixel; | ||
| 1792 | } | ||
| 1793 | 1791 | ||
| 1794 | if (relief->gc == 0) | 1792 | if (relief->gc == 0) |
| 1795 | { | 1793 | { |
| @@ -9338,9 +9336,9 @@ x_free_frame_resources (struct frame *f) | |||
| 9338 | if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) | 9336 | if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) |
| 9339 | unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); | 9337 | unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); |
| 9340 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 9338 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 9341 | if (f->output_data.x->white_relief.allocated_p) | 9339 | if (f->output_data.x->white_relief.pixel != -1) |
| 9342 | unload_color (f, f->output_data.x->white_relief.pixel); | 9340 | unload_color (f, f->output_data.x->white_relief.pixel); |
| 9343 | if (f->output_data.x->black_relief.allocated_p) | 9341 | if (f->output_data.x->black_relief.pixel != -1) |
| 9344 | unload_color (f, f->output_data.x->black_relief.pixel); | 9342 | unload_color (f, f->output_data.x->black_relief.pixel); |
| 9345 | 9343 | ||
| 9346 | x_free_gcs (f); | 9344 | x_free_gcs (f); |
| @@ -9690,7 +9688,7 @@ same_x_server (const char *name1, const char *name2) | |||
| 9690 | get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET | 9688 | get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET |
| 9691 | to 5. */ | 9689 | to 5. */ |
| 9692 | static void | 9690 | static void |
| 9693 | get_bits_and_offset (long unsigned int mask, int *bits, int *offset) | 9691 | get_bits_and_offset (unsigned long mask, int *bits, int *offset) |
| 9694 | { | 9692 | { |
| 9695 | int nr = 0; | 9693 | int nr = 0; |
| 9696 | int off = 0; | 9694 | int off = 0; |
| @@ -10589,14 +10587,14 @@ With MS Windows or Nextstep, the value is t. */); | |||
| 10589 | Vx_toolkit_scroll_bars = Qnil; | 10587 | Vx_toolkit_scroll_bars = Qnil; |
| 10590 | #endif | 10588 | #endif |
| 10591 | 10589 | ||
| 10592 | Qmodifier_value = intern_c_string ("modifier-value"); | 10590 | DEFSYM (Qmodifier_value, "modifier-value"); |
| 10593 | Qalt = intern_c_string ("alt"); | 10591 | DEFSYM (Qalt, "alt"); |
| 10594 | Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); | 10592 | Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); |
| 10595 | Qhyper = intern_c_string ("hyper"); | 10593 | DEFSYM (Qhyper, "hyper"); |
| 10596 | Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); | 10594 | Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); |
| 10597 | Qmeta = intern_c_string ("meta"); | 10595 | DEFSYM (Qmeta, "meta"); |
| 10598 | Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); | 10596 | Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); |
| 10599 | Qsuper = intern_c_string ("super"); | 10597 | DEFSYM (Qsuper, "super"); |
| 10600 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); | 10598 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
| 10601 | 10599 | ||
| 10602 | DEFVAR_LISP ("x-alt-keysym", Vx_alt_keysym, | 10600 | DEFVAR_LISP ("x-alt-keysym", Vx_alt_keysym, |
diff --git a/src/xterm.h b/src/xterm.h index 06c0d4882b8..753debff1bb 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -605,7 +605,6 @@ struct x_output | |||
| 605 | { | 605 | { |
| 606 | GC gc; | 606 | GC gc; |
| 607 | unsigned long pixel; | 607 | unsigned long pixel; |
| 608 | int allocated_p; | ||
| 609 | } | 608 | } |
| 610 | black_relief, white_relief; | 609 | black_relief, white_relief; |
| 611 | 610 | ||