aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2012-11-26 13:36:10 +0100
committerJoakim Verona2012-11-26 13:36:10 +0100
commite1abb9a1e78c6e3a55f39e041b9b8d4998b6ff54 (patch)
tree2850b2dd32a760ff2ed76445472305f9ed561841 /src
parent01537ffb98320064484ed4898ad66318b18a8e46 (diff)
parent551aaa664fcc94c80a7cb4f34bdc12c7dfe18fb2 (diff)
downloademacs-e1abb9a1e78c6e3a55f39e041b9b8d4998b6ff54.tar.gz
emacs-e1abb9a1e78c6e3a55f39e041b9b8d4998b6ff54.zip
upstream
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit1273
-rw-r--r--src/ChangeLog132
-rw-r--r--src/alloc.c8
-rw-r--r--src/dired.c205
-rw-r--r--src/emacs.c2
-rw-r--r--src/fileio.c48
-rw-r--r--src/frame.c8
-rw-r--r--src/frame.h18
-rw-r--r--src/indent.c8
-rw-r--r--src/keyboard.c32
-rw-r--r--src/lisp.h4
-rw-r--r--src/makefile.w32-in10
-rw-r--r--src/msdos.c15
-rw-r--r--src/ndir.h41
-rw-r--r--src/nsterm.h3
-rw-r--r--src/nsterm.m25
-rw-r--r--src/sysdep.c104
-rw-r--r--src/w32.c35
-rw-r--r--src/w32.h2
-rw-r--r--src/w32menu.c13
-rw-r--r--src/w32term.c17
-rw-r--r--src/w32term.h18
-rw-r--r--src/xdisp.c107
-rw-r--r--src/xftfont.c4
-rw-r--r--src/xterm.c18
-rw-r--r--src/xterm.h14
26 files changed, 1669 insertions, 495 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
new file mode 100644
index 00000000000..e1ee81e66b5
--- /dev/null
+++ b/src/.gdbinit
@@ -0,0 +1,1273 @@
1# Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
2#
3# This file is part of GNU Emacs.
4#
5# GNU Emacs is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3, or (at your option)
8# any later version.
9#
10# GNU Emacs is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with GNU Emacs; see the file COPYING. If not, write to the
17# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18# Boston, MA 02110-1301, USA.
19
20# Force loading of symbols, enough to give us VALBITS etc.
21set $dummy = main + 8
22# With some compilers, we need this to give us struct Lisp_Symbol etc.:
23set $dummy = Fmake_symbol + 8
24
25# Find lwlib source files too.
26dir ../lwlib
27#dir /gd/gnu/lesstif-0.89.9/lib/Xm
28
29# Don't enter GDB when user types C-g to quit.
30# This has one unfortunate effect: you can't type C-c
31# at the GDB to stop Emacs, when using X.
32# However, C-z works just as well in that case.
33handle 2 noprint pass
34
35# Make it work like SIGINT normally does.
36handle SIGTSTP nopass
37
38# Pass on user signals
39handle SIGUSR1 noprint pass
40handle SIGUSR2 noprint pass
41
42# Don't pass SIGALRM to Emacs. This makes problems when
43# debugging.
44handle SIGALRM ignore
45
46# Use $bugfix so that the value isn't a constant.
47# Using a constant runs into GDB bugs sometimes.
48define xgetptr
49 if (CHECK_LISP_OBJECT_TYPE)
50 set $bugfix = $arg0.i
51 else
52 set $bugfix = $arg0
53 end
54 set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS
55end
56
57define xgetint
58 if (CHECK_LISP_OBJECT_TYPE)
59 set $bugfix = $arg0.i
60 else
61 set $bugfix = $arg0
62 end
63 set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
64end
65
66define xgettype
67 if (CHECK_LISP_OBJECT_TYPE)
68 set $bugfix = $arg0.i
69 else
70 set $bugfix = $arg0
71 end
72 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS)
73end
74
75# Set up something to print out s-expressions.
76# We save and restore print_output_debug_flag to prevent the w32 port
77# from calling OutputDebugString, which causes GDB to display each
78# character twice (yuk!).
79define pr
80 pp $
81end
82document pr
83Print the emacs s-expression which is $.
84Works only when an inferior emacs is executing.
85end
86
87# Print out s-expressions
88define pp
89 set $tmp = $arg0
90 set $output_debug = print_output_debug_flag
91 set print_output_debug_flag = 0
92 call safe_debug_print ($tmp)
93 set print_output_debug_flag = $output_debug
94end
95document pp
96Print the argument as an emacs s-expression
97Works only when an inferior emacs is executing.
98end
99
100# Print value of lisp variable
101define pv
102 set $tmp = "$arg0"
103 set $output_debug = print_output_debug_flag
104 set print_output_debug_flag = 0
105 call safe_debug_print (find_symbol_value (intern ($tmp)))
106 set print_output_debug_flag = $output_debug
107end
108document pv
109Print the value of the lisp variable given as argument.
110Works only when an inferior emacs is executing.
111end
112
113# Print out current buffer point and boundaries
114define ppt
115 set $b = current_buffer
116 set $t = $b->text
117 printf "BUF PT: %d", $b->pt
118 if ($b->pt != $b->pt_byte)
119 printf "[%d]", $b->pt_byte
120 end
121 printf " of 1..%d", $t->z
122 if ($t->z != $t->z_byte)
123 printf "[%d]", $t->z_byte
124 end
125 if ($b->begv != 1 || $b->zv != $t->z)
126 printf " NARROW=%d..%d", $b->begv, $b->zv
127 if ($b->begv != $b->begv_byte || $b->zv != $b->zv_byte)
128 printf " [%d..%d]", $b->begv_byte, $b->zv_byte
129 end
130 end
131 printf " GAP: %d", $t->gpt
132 if ($t->gpt != $t->gpt_byte)
133 printf "[%d]", $t->gpt_byte
134 end
135 printf " SZ=%d\n", $t->gap_size
136end
137document ppt
138Print current buffer's point and boundaries.
139Prints values of point, beg, end, narrow, and gap for current buffer.
140end
141
142define pitmethod
143 set $itmethod = $arg0
144 # output $itmethod
145 if ($itmethod == 0)
146 printf "GET_FROM_BUFFER"
147 end
148 if ($itmethod == 1)
149 printf "GET_FROM_DISPLAY_VECTOR"
150 end
151 if ($itmethod == 2)
152 printf "GET_FROM_STRING"
153 end
154 if ($itmethod == 3)
155 printf "GET_FROM_C_STRING"
156 end
157 if ($itmethod == 4)
158 printf "GET_FROM_IMAGE"
159 end
160 if ($itmethod == 5)
161 printf "GET_FROM_STRETCH"
162 end
163 if ($itmethod < 0 || $itmethod > 5)
164 output $itmethod
165 end
166end
167document pitmethod
168Pretty print it->method given as first arg
169end
170
171# Print out iterator given as first arg
172define pitx
173 set $it = $arg0
174 printf "cur=%d", $it->current.pos.charpos
175 if ($it->current.pos.charpos != $it->current.pos.bytepos)
176 printf "[%d]", $it->current.pos.bytepos
177 end
178 printf " pos=%d", $it->position.charpos
179 if ($it->position.charpos != $it->position.bytepos)
180 printf "[%d]", $it->position.bytepos
181 end
182 printf " start=%d", $it->start.pos.charpos
183 if ($it->start.pos.charpos != $it->start.pos.bytepos)
184 printf "[%d]", $it->start.pos.bytepos
185 end
186 printf " end=%d", $it->end_charpos
187 printf " stop=%d", $it->stop_charpos
188 printf " face=%d", $it->face_id
189 if ($it->multibyte_p)
190 printf " MB"
191 end
192 if ($it->header_line_p)
193 printf " HL"
194 end
195 if ($it->n_overlay_strings > 0)
196 printf " nov=%d", $it->n_overlay_strings
197 end
198 if ($it->sp != 0)
199 printf " sp=%d", $it->sp
200 end
201 # IT_CHARACTER
202 if ($it->what == 0)
203 if ($it->len == 1 && $it->c >= ' ' && it->c < 255)
204 printf " ch='%c'", $it->c
205 else
206 printf " ch=[%d,%d]", $it->c, $it->len
207 end
208 else
209 printf " "
210 # output $it->what
211 if ($it->what == 0)
212 printf "IT_CHARACTER"
213 end
214 if ($it->what == 1)
215 printf "IT_COMPOSITION"
216 end
217 if ($it->what == 2)
218 printf "IT_IMAGE"
219 end
220 if ($it->what == 3)
221 printf "IT_STRETCH"
222 end
223 if ($it->what == 4)
224 printf "IT_EOB"
225 end
226 if ($it->what == 5)
227 printf "IT_TRUNCATION"
228 end
229 if ($it->what == 6)
230 printf "IT_CONTINUATION"
231 end
232 if ($it->what < 0 || $it->what > 6)
233 output $it->what
234 end
235 end
236 if ($it->method != 0)
237 # !GET_FROM_BUFFER
238 printf " next="
239 pitmethod $it->method
240 if ($it->method == 2)
241 # GET_FROM_STRING
242 printf "[%d]", $it->current.string_pos.charpos
243 end
244 if ($it->method == 4)
245 # GET_FROM_IMAGE
246 printf "[%d]", $it->image_id
247 end
248 end
249 printf "\n"
250 if ($it->bidi_p)
251 printf "BIDI: base_stop=%d prev_stop=%d level=%d\n", $it->base_level_stop, $it->prev_stop, $it->bidi_it.resolved_level
252 end
253 if ($it->region_beg_charpos >= 0)
254 printf "reg=%d-%d ", $it->region_beg_charpos, $it->region_end_charpos
255 end
256 printf "vpos=%d hpos=%d", $it->vpos, $it->hpos,
257 printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y
258 printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x
259 printf " w=%d", $it->pixel_width
260 printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent
261 printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent
262 printf "\n"
263 set $i = 0
264 while ($i < $it->sp && $i < 4)
265 set $e = $it->stack[$i]
266 printf "stack[%d]: ", $i
267 pitmethod $e.method
268 printf "[%d]", $e.position.charpos
269 printf "\n"
270 set $i = $i + 1
271 end
272end
273document pitx
274Pretty print a display iterator.
275Take one arg, an iterator object or pointer.
276end
277
278define pit
279 pitx it
280end
281document pit
282Pretty print the display iterator it.
283end
284
285define prowx
286 set $row = $arg0
287 printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width
288 printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height
289 printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height
290 printf " vis=%d\n", $row->visible_height
291 printf "used=(LMargin=%d,Text=%d,RMargin=%d) Hash=%d\n", $row->used[0], $row->used[1], $row->used[2], $row->hash
292 printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos
293 if ($row->enabled_p)
294 printf " ENA"
295 end
296 if ($row->displays_text_p)
297 printf " DISP"
298 end
299 if ($row->mode_line_p)
300 printf " MODEL"
301 end
302 if ($row->continued_p)
303 printf " CONT"
304 end
305 if ($row-> truncated_on_left_p)
306 printf " TRUNC:L"
307 end
308 if ($row-> truncated_on_right_p)
309 printf " TRUNC:R"
310 end
311 if ($row->starts_in_middle_of_char_p)
312 printf " STARTMID"
313 end
314 if ($row->ends_in_middle_of_char_p)
315 printf " ENDMID"
316 end
317 if ($row->ends_in_newline_from_string_p)
318 printf " ENDNLFS"
319 end
320 if ($row->ends_at_zv_p)
321 printf " ENDZV"
322 end
323 if ($row->overlapped_p)
324 printf " OLAPD"
325 end
326 if ($row->overlapping_p)
327 printf " OLAPNG"
328 end
329 printf "\n"
330end
331document prowx
332Pretty print information about glyph_row.
333Takes one argument, a row object or pointer.
334end
335
336define prow
337 prowx row
338end
339document prow
340Pretty print information about glyph_row in row.
341end
342
343
344define pcursorx
345 set $cp = $arg0
346 printf "y=%d x=%d vpos=%d hpos=%d", $cp->y, $cp->x, $cp->vpos, $cp->hpos
347end
348document pcursorx
349Pretty print a window cursor.
350end
351
352define pcursor
353 printf "output: "
354 pcursorx output_cursor
355 printf "\n"
356end
357document pcursor
358Pretty print the output_cursor.
359end
360
361define pwinx
362 set $w = $arg0
363 xgetint $w->sequence_number
364 if ($w->mini_p != Qnil)
365 printf "Mini "
366 end
367 printf "Window %d ", $int
368 xgetptr $w->buffer
369 set $tem = (struct buffer *) $ptr
370 xgetptr $tem->name_
371 printf "%s", ((struct Lisp_String *) $ptr)->data
372 printf "\n"
373 xgetptr $w->start
374 set $tem = (struct Lisp_Marker *) $ptr
375 printf "start=%d end:", $tem->charpos
376 if ($w->window_end_valid != Qnil)
377 xgetint $w->window_end_pos
378 printf "pos=%d", $int
379 xgetint $w->window_end_vpos
380 printf " vpos=%d", $int
381 else
382 printf "invalid"
383 end
384 printf " vscroll=%d", $w->vscroll
385 if ($w->force_start != Qnil)
386 printf " FORCE_START"
387 end
388 if ($w->must_be_updated_p)
389 printf " MUST_UPD"
390 end
391 printf "\n"
392 printf "cursor: "
393 pcursorx $w->cursor
394 printf " phys: "
395 pcursorx $w->phys_cursor
396 if ($w->phys_cursor_on_p)
397 printf " ON"
398 else
399 printf " OFF"
400 end
401 printf " blk="
402 if ($w->last_cursor_off_p != $w->cursor_off_p)
403 if ($w->last_cursor_off_p)
404 printf "ON->"
405 else
406 printf "OFF->"
407 end
408 end
409 if ($w->cursor_off_p)
410 printf "ON"
411 else
412 printf "OFF"
413 end
414 printf "\n"
415end
416document pwinx
417Pretty print a window structure.
418Takes one argument, a pointer to a window structure.
419end
420
421define pwin
422 pwinx w
423end
424document pwin
425Pretty print window structure w.
426end
427
428define pbiditype
429 if ($arg0 == 0)
430 printf "UNDEF"
431 end
432 if ($arg0 == 1)
433 printf "L"
434 end
435 if ($arg0 == 2)
436 printf "R"
437 end
438 if ($arg0 == 3)
439 printf "EN"
440 end
441 if ($arg0 == 4)
442 printf "AN"
443 end
444 if ($arg0 == 5)
445 printf "BN"
446 end
447 if ($arg0 == 6)
448 printf "B"
449 end
450 if ($arg0 < 0 || $arg0 > 6)
451 printf "%d??", $arg0
452 end
453end
454document pbiditype
455Print textual description of bidi type given as first argument.
456end
457
458define pgx
459 set $g = $arg0
460 # CHAR_GLYPH
461 if ($g.type == 0)
462 if ($g.u.ch >= ' ' && $g.u.ch < 127)
463 printf "CHAR[%c]", $g.u.ch
464 else
465 printf "CHAR[0x%x]", $g.u.ch
466 end
467 end
468 # COMPOSITE_GLYPH
469 if ($g.type == 1)
470 printf "COMP[%d (%d..%d)]", $g.u.cmp.id, $g.slice.cmp.from, $g.slice.cmp.to
471 end
472 # GLYPHLESS_GLYPH
473 if ($g.type == 2)
474 printf "GLYPHLESS["
475 if ($g.u.glyphless.method == 0)
476 printf "THIN]"
477 end
478 if ($g.u.glyphless.method == 1)
479 printf "EMPTY]"
480 end
481 if ($g.u.glyphless.method == 2)
482 printf "ACRO]"
483 end
484 if ($g.u.glyphless.method == 3)
485 printf "HEX]"
486 end
487 end
488 # IMAGE_GLYPH
489 if ($g.type == 3)
490 printf "IMAGE[%d]", $g.u.img_id
491 end
492 # STRETCH_GLYPH
493 if ($g.type == 4)
494 printf "STRETCH[%d+%d]", $g.u.stretch.height, $g.u.stretch.ascent
495 end
496 xgettype ($g.object)
497 if ($type == Lisp_String)
498 xgetptr $g.object
499 printf " str=0x%x[%d]", ((struct Lisp_String *)$ptr)->data, $g.charpos
500 else
501 printf " pos=%d", $g.charpos
502 end
503 # For characters, print their resolved level and bidi type
504 if ($g.type == 0)
505 printf " blev=%d,btyp=", $g.resolved_level
506 pbiditype $g.bidi_type
507 end
508 printf " w=%d a+d=%d+%d", $g.pixel_width, $g.ascent, $g.descent
509 # If not DEFAULT_FACE_ID
510 if ($g.face_id != 0)
511 printf " face=%d", $g.face_id
512 end
513 if ($g.voffset)
514 printf " vof=%d", $g.voffset
515 end
516 if ($g.multibyte_p)
517 printf " MB"
518 end
519 if ($g.padding_p)
520 printf " PAD"
521 end
522 if ($g.glyph_not_available_p)
523 printf " N/A"
524 end
525 if ($g.overlaps_vertically_p)
526 printf " OVL"
527 end
528 if ($g.avoid_cursor_p)
529 printf " AVOID"
530 end
531 if ($g.left_box_line_p)
532 printf " ["
533 end
534 if ($g.right_box_line_p)
535 printf " ]"
536 end
537 if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width || $g.slice.img.height)
538 printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y, $g.slice.img.width, $g.slice.img.height
539 end
540 printf "\n"
541end
542document pgx
543Pretty print a glyph structure.
544Takes one argument, a pointer to a glyph structure.
545end
546
547define pg
548 set $pgidx = 0
549 pgx glyph
550end
551document pg
552Pretty print glyph structure glyph.
553end
554
555define pgi
556 set $pgidx = $arg0
557 pgx (&glyph[$pgidx])
558end
559document pgi
560Pretty print glyph structure glyph[I].
561Takes one argument, a integer I.
562end
563
564define pgn
565 set $pgidx = $pgidx + 1
566 pgx (&glyph[$pgidx])
567end
568document pgn
569Pretty print next glyph structure.
570end
571
572define pgrowx
573 set $row = $arg0
574 set $area = 0
575 set $xofs = $row->x
576 while ($area < 3)
577 set $used = $row->used[$area]
578 if ($used > 0)
579 set $gl0 = $row->glyphs[$area]
580 set $pgidx = 0
581 printf "%s: %d glyphs\n", ($area == 0 ? "LEFT" : $area == 2 ? "RIGHT" : "TEXT"), $used
582 while ($pgidx < $used)
583 printf "%3d %4d: ", $pgidx, $xofs
584 pgx $gl0[$pgidx]
585 set $xofs = $xofs + $gl0[$pgidx]->pixel_width
586 set $pgidx = $pgidx + 1
587 end
588 end
589 set $area = $area + 1
590 end
591end
592document pgrowx
593Pretty print all glyphs in a row structure.
594Takes one argument, a pointer to a row structure.
595end
596
597define pgrow
598 pgrowx row
599end
600document pgrow
601Pretty print all glyphs in row structure row.
602end
603
604define pgrowit
605 pgrowx it->glyph_row
606end
607document pgrowit
608Pretty print all glyphs in it->glyph_row.
609end
610
611define prowlims
612 printf "edges=(%d,%d),r2l=%d,cont=%d,trunc=(%d,%d),at_zv=%d\n", $arg0->minpos.charpos, $arg0->maxpos.charpos, $arg0->reversed_p, $arg0->continued_p, $arg0->truncated_on_left_p, $arg0->truncated_on_right_p, $arg0->ends_at_zv_p
613end
614document prowlims
615Print important attributes of a glyph_row structure.
616Takes one argument, a pointer to a glyph_row structure.
617end
618
619define pmtxrows
620 set $mtx = $arg0
621 set $gl = $mtx->rows
622 set $glend = $mtx->rows + $mtx->nrows - 1
623 set $i = 0
624 while ($gl < $glend)
625 printf "%d: ", $i
626 prowlims $gl
627 set $gl = $gl + 1
628 set $i = $i + 1
629 end
630end
631document pmtxrows
632Print data about glyph rows in a glyph matrix.
633Takes one argument, a pointer to a glyph_matrix structure.
634end
635
636define xtype
637 xgettype $
638 output $type
639 echo \n
640 if $type == Lisp_Misc
641 xmisctype
642 else
643 if $type == Lisp_Vectorlike
644 xvectype
645 end
646 end
647end
648document xtype
649Print the type of $, assuming it is an Emacs Lisp value.
650If the first type printed is Lisp_Vector or Lisp_Misc,
651a second line gives the more precise type.
652end
653
654define pvectype
655 set $size = ((struct Lisp_Vector *) $arg0)->header.size
656 if ($size & PSEUDOVECTOR_FLAG)
657 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
658 else
659 output PVEC_NORMAL_VECTOR
660 end
661 echo \n
662end
663document pvectype
664Print the subtype of vectorlike object.
665Takes one argument, a pointer to an object.
666end
667
668define xvectype
669 xgetptr $
670 pvectype $ptr
671end
672document xvectype
673Print the subtype of vectorlike object.
674This command assumes that $ is a Lisp_Object.
675end
676
677define pvecsize
678 set $size = ((struct Lisp_Vector *) $arg0)->header.size
679 if ($size & PSEUDOVECTOR_FLAG)
680 output ($size & PSEUDOVECTOR_SIZE_MASK)
681 echo \n
682 output (($size & PSEUDOVECTOR_REST_MASK) >> PSEUDOVECTOR_SIZE_BITS)
683 else
684 output ($size & ~ARRAY_MARK_FLAG)
685 end
686 echo \n
687end
688document pvecsize
689Print the size of vectorlike object.
690Takes one argument, a pointer to an object.
691end
692
693define xvecsize
694 xgetptr $
695 pvecsize $ptr
696end
697document xvecsize
698Print the size of $
699This command assumes that $ is a Lisp_Object.
700end
701
702define xmisctype
703 xgetptr $
704 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
705 echo \n
706end
707document xmisctype
708Assume that $ is some misc type and print its specific type.
709end
710
711define xint
712 xgetint $
713 print $int
714end
715document xint
716Print $ as an Emacs Lisp integer. This gets the sign right.
717end
718
719define xptr
720 xgetptr $
721 print (void *) $ptr
722end
723document xptr
724Print the pointer portion of an Emacs Lisp value in $.
725end
726
727define xmarker
728 xgetptr $
729 print (struct Lisp_Marker *) $ptr
730end
731document xmarker
732Print $ as a marker pointer.
733This command assumes that $ is an Emacs Lisp marker value.
734end
735
736define xoverlay
737 xgetptr $
738 print (struct Lisp_Overlay *) $ptr
739end
740document xoverlay
741Print $ as a overlay pointer.
742This command assumes that $ is an Emacs Lisp overlay value.
743end
744
745define xmiscfree
746 xgetptr $
747 print (struct Lisp_Free *) $ptr
748end
749document xmiscfree
750Print $ as a misc free-cell pointer.
751This command assumes that $ is an Emacs Lisp Misc value.
752end
753
754define xsymbol
755 set $sym = $
756 xgetptr $sym
757 print (struct Lisp_Symbol *) $ptr
758 xprintsym $sym
759 echo \n
760end
761document xsymbol
762Print the name and address of the symbol $.
763This command assumes that $ is an Emacs Lisp symbol value.
764end
765
766define xstring
767 xgetptr $
768 print (struct Lisp_String *) $ptr
769 xprintstr $
770 echo \n
771end
772document xstring
773Print the contents and address of the string $.
774This command assumes that $ is an Emacs Lisp string value.
775end
776
777define xvector
778 xgetptr $
779 print (struct Lisp_Vector *) $ptr
780 output ($->header.size > 50) ? 0 : ($->contents[0])@($->header.size & ~ARRAY_MARK_FLAG)
781echo \n
782end
783document xvector
784Print the contents and address of the vector $.
785This command assumes that $ is an Emacs Lisp vector value.
786end
787
788define xprocess
789 xgetptr $
790 print (struct Lisp_Process *) $ptr
791 output *$
792 echo \n
793end
794document xprocess
795Print the address of the struct Lisp_process to which $ points.
796This command assumes that $ is a Lisp_Object.
797end
798
799define xframe
800 xgetptr $
801 print (struct frame *) $ptr
802 xgetptr $->name
803 set $ptr = (struct Lisp_String *) $ptr
804 xprintstr $ptr
805 echo \n
806end
807document xframe
808Print $ as a frame pointer.
809This command assumes $ is an Emacs Lisp frame value.
810end
811
812define xcompiled
813 xgetptr $
814 print (struct Lisp_Vector *) $ptr
815 output ($->contents[0])@($->header.size & 0xff)
816end
817document xcompiled
818Print $ as a compiled function pointer.
819This command assumes that $ is an Emacs Lisp compiled value.
820end
821
822define xwindow
823 xgetptr $
824 print (struct window *) $ptr
825 set $window = (struct window *) $ptr
826 xgetint $window->total_cols
827 set $width=$int
828 xgetint $window->total_lines
829 set $height=$int
830 xgetint $window->left_col
831 set $left=$int
832 xgetint $window->top_line
833 set $top=$int
834 printf "%dx%d+%d+%d\n", $width, $height, $left, $top
835end
836document xwindow
837Print $ as a window pointer, assuming it is an Emacs Lisp window value.
838Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
839end
840
841define xwinconfig
842 xgetptr $
843 print (struct save_window_data *) $ptr
844end
845document xwinconfig
846Print $ as a window configuration pointer.
847This command assumes that $ is an Emacs Lisp window configuration value.
848end
849
850define xsubr
851 xgetptr $
852 print (struct Lisp_Subr *) $ptr
853 output *$
854 echo \n
855end
856document xsubr
857Print the address of the subr which the Lisp_Object $ points to.
858end
859
860define xchartable
861 xgetptr $
862 print (struct Lisp_Char_Table *) $ptr
863 printf "Purpose: "
864 xprintsym $->purpose
865 printf " %d extra slots", ($->header.size & 0x1ff) - 68
866 echo \n
867end
868document xchartable
869Print the address of the char-table $, and its purpose.
870This command assumes that $ is an Emacs Lisp char-table value.
871end
872
873define xsubchartable
874 xgetptr $
875 print (struct Lisp_Sub_Char_Table *) $ptr
876 xgetint $->depth
877 set $depth = $int
878 xgetint $->min_char
879 printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int
880end
881document xsubchartable
882Print the address of the sub-char-table $, its depth and min-char.
883This command assumes that $ is an Emacs Lisp sub-char-table value.
884end
885
886define xboolvector
887 xgetptr $
888 print (struct Lisp_Bool_Vector *) $ptr
889 output ($->size > 256) ? 0 : ($->data[0])@(($->size + BOOL_VECTOR_BITS_PER_CHAR - 1)/ BOOL_VECTOR_BITS_PER_CHAR)
890 echo \n
891end
892document xboolvector
893Print the contents and address of the bool-vector $.
894This command assumes that $ is an Emacs Lisp bool-vector value.
895end
896
897define xbuffer
898 xgetptr $
899 print (struct buffer *) $ptr
900 xgetptr $->name_
901 output ((struct Lisp_String *) $ptr)->data
902 echo \n
903end
904document xbuffer
905Set $ as a buffer pointer and the name of the buffer.
906This command assumes $ is an Emacs Lisp buffer value.
907end
908
909define xhashtable
910 xgetptr $
911 print (struct Lisp_Hash_Table *) $ptr
912end
913document xhashtable
914Set $ as a hash table pointer.
915This command assumes that $ is an Emacs Lisp hash table value.
916end
917
918define xcons
919 xgetptr $
920 print (struct Lisp_Cons *) $ptr
921 output/x *$
922 echo \n
923end
924document xcons
925Print the contents of $ as an Emacs Lisp cons.
926end
927
928define nextcons
929 p $.u.cdr
930 xcons
931end
932document nextcons
933Print the contents of the next cell in a list.
934This command assumes that the last thing you printed was a cons cell contents
935(type struct Lisp_Cons) or a pointer to one.
936end
937define xcar
938 xgetptr $
939 xgettype $
940 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0)
941end
942document xcar
943Assume that $ is an Emacs Lisp pair and print its car.
944end
945
946define xcdr
947 xgetptr $
948 xgettype $
949 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->u.cdr : 0)
950end
951document xcdr
952Assume that $ is an Emacs Lisp pair and print its cdr.
953end
954
955define xlist
956 xgetptr $
957 set $cons = (struct Lisp_Cons *) $ptr
958 xgetptr Qnil
959 set $nil = $ptr
960 set $i = 0
961 while $cons != $nil && $i < 10
962 p/x $cons->car
963 xpr
964 xgetptr $cons->u.cdr
965 set $cons = (struct Lisp_Cons *) $ptr
966 set $i = $i + 1
967 printf "---\n"
968 end
969 if $cons == $nil
970 printf "nil\n"
971 else
972 printf "...\n"
973 p $ptr
974 end
975end
976document xlist
977Print $ assuming it is a list.
978end
979
980define xfloat
981 xgetptr $
982 print ((struct Lisp_Float *) $ptr)->u.data
983end
984document xfloat
985Print $ assuming it is a lisp floating-point number.
986end
987
988define xscrollbar
989 xgetptr $
990 print (struct scrollbar *) $ptr
991output *$
992echo \n
993end
994document xscrollbar
995Print $ as a scrollbar pointer.
996end
997
998define xpr
999 xtype
1000 if $type == Lisp_Int0 || $type == Lisp_Int1
1001 xint
1002 end
1003 if $type == Lisp_Symbol
1004 xsymbol
1005 end
1006 if $type == Lisp_String
1007 xstring
1008 end
1009 if $type == Lisp_Cons
1010 xcons
1011 end
1012 if $type == Lisp_Float
1013 xfloat
1014 end
1015 if $type == Lisp_Misc
1016 set $misc = (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
1017 if $misc == Lisp_Misc_Free
1018 xmiscfree
1019 end
1020 if $misc == Lisp_Misc_Marker
1021 xmarker
1022 end
1023 if $misc == Lisp_Misc_Overlay
1024 xoverlay
1025 end
1026# if $misc == Lisp_Misc_Save_Value
1027# xsavevalue
1028# end
1029 end
1030 if $type == Lisp_Vectorlike
1031 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1032 if ($size & PSEUDOVECTOR_FLAG)
1033 set $vec = (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
1034 if $vec == PVEC_NORMAL_VECTOR
1035 xvector
1036 end
1037 if $vec == PVEC_PROCESS
1038 xprocess
1039 end
1040 if $vec == PVEC_FRAME
1041 xframe
1042 end
1043 if $vec == PVEC_COMPILED
1044 xcompiled
1045 end
1046 if $vec == PVEC_WINDOW
1047 xwindow
1048 end
1049 if $vec == PVEC_WINDOW_CONFIGURATION
1050 xwinconfig
1051 end
1052 if $vec == PVEC_SUBR
1053 xsubr
1054 end
1055 if $vec == PVEC_CHAR_TABLE
1056 xchartable
1057 end
1058 if $vec == PVEC_BOOL_VECTOR
1059 xboolvector
1060 end
1061 if $vec == PVEC_BUFFER
1062 xbuffer
1063 end
1064 if $vec == PVEC_HASH_TABLE
1065 xhashtable
1066 end
1067 else
1068 xvector
1069 end
1070 end
1071end
1072document xpr
1073Print $ as a lisp object of any type.
1074end
1075
1076define xprintstr
1077 set $data = (char *) $arg0->data
1078 output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
1079end
1080
1081define xprintsym
1082 xgetptr $arg0
1083 set $sym = (struct Lisp_Symbol *) $ptr
1084 xgetptr $sym->name
1085 set $sym_name = (struct Lisp_String *) $ptr
1086 xprintstr $sym_name
1087end
1088document xprintsym
1089 Print argument as a symbol.
1090end
1091
1092define xcoding
1093 set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & VALMASK) | DATA_SEG_BITS)
1094 set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS)
1095 set $name = $tmp->contents[$arg0 * 2]
1096 print $name
1097 pr
1098 print $tmp->contents[$arg0 * 2 + 1]
1099 pr
1100end
1101document xcoding
1102 Print the name and attributes of coding system that has ID (argument).
1103end
1104
1105define xcharset
1106 set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & VALMASK) | DATA_SEG_BITS)
1107 set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS)
1108 p $tmp->contents[charset_table[$arg0].hash_index * 2]
1109 pr
1110end
1111document xcharset
1112 Print the name of charset that has ID (argument).
1113end
1114
1115define xfontset
1116 xgetptr $
1117 set $tbl = (struct Lisp_Char_Table *) $ptr
1118 print $tbl
1119 xgetint $tbl->extras[0]
1120 printf " ID:%d", $int
1121 xgettype $tbl->extras[1]
1122 xgetptr $tbl->extras[1]
1123 if $type == Lisp_String
1124 set $ptr = (struct Lisp_String *) $ptr
1125 printf " Name:"
1126 xprintstr $ptr
1127 else
1128 xgetptr $tbl->extras[2]
1129 set $ptr = (struct Lisp_Char_Table *) $ptr
1130 xgetptr $ptr->extras[1]
1131 set $ptr = (struct Lisp_String *) $ptr
1132 printf " Realized from:"
1133 xprintstr $ptr
1134 end
1135 echo \n
1136end
1137
1138define xfont
1139 xgetptr $
1140 set $size = (((struct Lisp_Vector *) $ptr)->header.size & 0x1FF)
1141 if $size == FONT_SPEC_MAX
1142 print (struct font_spec *) $ptr
1143 else
1144 if $size == FONT_ENTITY_MAX
1145 print (struct font_entity *) $ptr
1146 else
1147 print (struct font *) $ptr
1148 end
1149 end
1150end
1151document xfont
1152Print $ assuming it is a list font (font-spec, font-entity, or font-object).
1153end
1154
1155define xbacktrace
1156 set $bt = backtrace_list
1157 while $bt
1158 xgettype ($bt->function)
1159 if $type == Lisp_Symbol
1160 xprintsym ($bt->function)
1161 printf " (0x%x)\n", $bt->args
1162 else
1163 xgetptr $bt->function
1164 printf "0x%x ", $ptr
1165 if $type == Lisp_Vectorlike
1166 xgetptr ($bt->function)
1167 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1168 if ($size & PSEUDOVECTOR_FLAG)
1169 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
1170 else
1171 output $size & ~ARRAY_MARK_FLAG
1172 end
1173 else
1174 printf "Lisp type %d", $type
1175 end
1176 echo \n
1177 end
1178 set $bt = $bt->next
1179 end
1180end
1181document xbacktrace
1182 Print a backtrace of Lisp function calls from backtrace_list.
1183 Set a breakpoint at Fsignal and call this to see from where
1184 an error was signaled.
1185end
1186
1187define xprintbytestr
1188 set $data = (char *) $arg0->data
1189 printf "Bytecode: "
1190 output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
1191end
1192document xprintbytestr
1193 Print a string of byte code.
1194end
1195
1196define xwhichsymbols
1197 set $output_debug = print_output_debug_flag
1198 set print_output_debug_flag = 0
1199 call safe_debug_print (which_symbols ($arg0, $arg1))
1200 set print_output_debug_flag = $output_debug
1201end
1202document xwhichsymbols
1203 Print symbols which references a given lisp object
1204 either as its symbol value or symbol function.
1205 Call with two arguments: the lisp object and the
1206 maximum number of symbols referencing it to produce.
1207end
1208
1209define xbytecode
1210 set $bt = byte_stack_list
1211 while $bt
1212 xgetptr $bt->byte_string
1213 set $ptr = (struct Lisp_String *) $ptr
1214 xprintbytestr $ptr
1215 printf "\n0x%x => ", $bt->byte_string
1216 xwhichsymbols $bt->byte_string 5
1217 set $bt = $bt->next
1218 end
1219end
1220document xbytecode
1221 Print a backtrace of the byte code stack.
1222end
1223
1224# Show Lisp backtrace after normal backtrace.
1225define hookpost-backtrace
1226 set $bt = backtrace_list
1227 if $bt
1228 echo \n
1229 echo Lisp Backtrace:\n
1230 xbacktrace
1231 end
1232end
1233
1234# Flush display (X only)
1235define ff
1236 set x_flush (0)
1237end
1238document ff
1239Flush pending X window display updates to screen.
1240Works only when an inferior emacs is executing.
1241end
1242
1243
1244set print pretty on
1245set print sevenbit-strings
1246
1247show environment DISPLAY
1248show environment TERM
1249
1250# When debugging, it is handy to be able to "return" from
1251# terminate_due_to_signal when an assertion failure is non-fatal.
1252break terminate_due_to_signal
1253
1254# x_error_quitter is defined only on X. But window-system is set up
1255# only at run time, during Emacs startup, so we need to defer setting
1256# the breakpoint. init_sys_modes is the first function called on
1257# every platform after init_display, where window-system is set.
1258tbreak init_sys_modes
1259commands
1260 silent
1261 xgetptr globals.f_Vinitial_window_system
1262 set $tem = (struct Lisp_Symbol *) $ptr
1263 xgetptr $tem->name
1264 set $tem = (struct Lisp_String *) $ptr
1265 set $tem = (char *) $tem->data
1266 # If we are running in synchronous mode, we want a chance to look
1267 # around before Emacs exits. Perhaps we should put the break
1268 # somewhere else instead...
1269 if $tem[0] == 'x' && $tem[1] == '\0'
1270 break x_error_quitter
1271 end
1272 continue
1273end
diff --git a/src/ChangeLog b/src/ChangeLog
index 332656fcf00..c612c4dd365 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,135 @@
12012-11-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 * sysdep.c (sys_subshell): Don't assume pid_t fits in int.
4
52012-11-24 Ken Brown <kbrown@cornell.edu>
6
7 * keyboard.c (HAVE_MOUSE):
8 * frame.c (HAVE_MOUSE): Remove, and rewrite code as if HAVE_MOUSE
9 were always defined.
10
112012-11-24 Eli Zaretskii <eliz@gnu.org>
12
13 * xdisp.c (set_cursor_from_row): Skip step 2 only if point is not
14 between bpos_covered and bpos_max. This fixes cursor display when
15 several display strings follow each other.
16
17 * .gdbinit (pgx): If the glyph's object is a string, display the
18 pointer to string data, rather than the value of the string object
19 itself (which barfs under CHECK_LISP_OBJECT_TYPE).
20
21 * indent.c (Fvertical_motion): If the starting position is covered
22 by a display string, return to one position before that, to avoid
23 overshooting it inside move_it_to. (Bug#12930)
24
252012-11-23 Dmitry Antipov <dmantipov@yandex.ru>
26
27 * frame.h (struct frame): Remove display_preempted member
28 since all users are dead long ago.
29 * nsterm.h (struct x_output): Use the only dummy member.
30 * w32menu.c (pending_menu_activation): Remove since not
31 really used.
32 (set_frame_menubar): Adjust user.
33 * w32term.h (struct x_output): Drop outdated #if 0 code.
34 (struct w32_output): Use bitfields for explicit_parent,
35 asked_for_visible and menubar_active members. Drop
36 unused pending_menu_activation member.
37 * xterm.h (struct x_output): Drop outdated #if 0 code.
38 Use bitfields for explicit_parent, asked_for_visible,
39 has_been_visible and net_wm_state_hidden_seen members.
40
412012-11-23 Eli Zaretskii <eliz@gnu.org>
42
43 * makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead
44 of a literal "/". (Bug#12955)
45 (gl-stamp): Invoke fc.exe directly, not through cmd.
46
472012-11-23 Paul Eggert <eggert@cs.ucla.edu>
48
49 Assume POSIX 1003.1-1988 or later for dirent.h (Bug#12958).
50 * dired.c: Assume HAVE_DIRENT_H.
51 (NAMLEN): Remove, replacing with ...
52 (dirent_namelen): New function. All uses changed. Use the GNU macro
53 _D_EXACT_NAMELEN if available, as it's faster than strlen.
54 (DIRENTRY): Remove, replacing all uses with 'struct dirent'.
55 (DIRENTRY_NONEMPTY): Remove. All callers now assume it's nonzero.
56 * makefile.w32-in (DIR_H): Remove. All uses replaced with
57 $(NT_INC)/dirent.h.
58 ($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h.
59 * ndir.h: Rename to ../nt/inc/dirent.h.
60 * sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove.
61 Do not include <dirent.h>; no longer needed.
62 * w32.c: Include <dirent.h> rather than "ndir.h".
63
642012-11-23 Chong Yidong <cyd@gnu.org>
65
66 * xftfont.c (xftfont_open): Remove duplicate assignment.
67
682012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
69
70 * alloc.c (Fgarbage_collect): Unblock input after clearing
71 gc_in_progress to avoid note_mouse_highlight glitch with GC.
72 * frame.h (FRAME_MOUSE_UPDATE): New macro.
73 * msdos.c (IT_frame_up_to_date): Use it here...
74 * w32term.c (w32_frame_up_to_date): ...here...
75 * xterm.c (XTframe_up_to_date): ...and here...
76 * nsterm.m (ns_frame_up_to_date): ...but not here.
77 * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member.
78 Adjust users.
79 * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight):
80 Do not check whether GC is in progress.
81
822012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
83
84 * xdisp.c (window_buffer_changed): New function.
85 (update_menu_bar, update_tool_bar): Use it to
86 simplify large 'if' statements.
87 (redisplay_internal): Generalize commonly used
88 'tail' and 'frame' local variables.
89
902012-11-22 Eli Zaretskii <eliz@gnu.org>
91
92 * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts
93 with Windows system header.
94
952012-11-21 Paul Eggert <eggert@cs.ucla.edu>
96
97 Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945).
98 * alloc.c: Assume unistd.h exists.
99 * fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd.
100 * sysdep.c (get_current_dir_name): Assume getcwd exists.
101 (getwd) [USG]: Remove; no longer needed.
102 (sys_subshell) [DOS_NT]: Use getcwd, not getwd.
103 * w32.c (getcwd): Rename from getwd, and switch to getcwd's API.
104 * w32.h (getcwd): Remove decl.
105
1062012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
107
108 * xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind.
109 Make it set selected_window as well.
110 (update_tool_bar): Use it.
111
1122012-11-21 Ken Brown <kbrown@cornell.edu>
113
114 * emacs.c (main): Set the G_SLICE environment variable for all
115 Cygwin builds, not just GTK builds. See
116 https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html.
117
1182012-11-21 Eli Zaretskii <eliz@gnu.org>
119
120 * w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
121 (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]:
122 Define for the MSVC compiler.
123
124 * w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon.
125
126 * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
127 (Fexpand_file_name) [DOS_NT]: Pass encoded file name to
128 dostounix_filename. Prevents crashes down the road, because
129 dostounix_filename assumes it gets a unibyte string. Reported by
130 Michel de Ruiter <michel@sentient.nl>, see
131 http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html
132
12012-11-20 Stefan Monnier <monnier@iro.umontreal.ca> 1332012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 134
3 Conflate Qnil and Qunbound for `symbol-function'. 135 Conflate Qnil and Qunbound for `symbol-function'.
diff --git a/src/alloc.c b/src/alloc.c
index 22e3db3cc77..28c9b51dab4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -63,10 +63,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63#endif 63#endif
64 64
65#include <unistd.h> 65#include <unistd.h>
66#ifndef HAVE_UNISTD_H
67extern void *sbrk ();
68#endif
69
70#include <fcntl.h> 66#include <fcntl.h>
71 67
72#ifdef USE_GTK 68#ifdef USE_GTK
@@ -5335,12 +5331,12 @@ See Info node `(elisp)Garbage Collection'. */)
5335 dump_zombies (); 5331 dump_zombies ();
5336#endif 5332#endif
5337 5333
5338 unblock_input ();
5339
5340 check_cons_list (); 5334 check_cons_list ();
5341 5335
5342 gc_in_progress = 0; 5336 gc_in_progress = 0;
5343 5337
5338 unblock_input ();
5339
5344 consing_since_gc = 0; 5340 consing_since_gc = 0;
5345 if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10) 5341 if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10)
5346 gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10; 5342 gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10;
diff --git a/src/dired.c b/src/dired.c
index 4986f845101..3530b74ecb4 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -31,44 +31,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <errno.h> 31#include <errno.h>
32#include <unistd.h> 32#include <unistd.h>
33 33
34/* The d_nameln member of a struct dirent includes the '\0' character
35 on some systems, but not on others. What's worse, you can't tell
36 at compile-time which one it will be, since it really depends on
37 the sort of system providing the filesystem you're reading from,
38 not the system you are running on. Paul Eggert
39 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
40 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
41 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
42
43 Since applying strlen to the name always works, we'll just do that. */
44#define NAMLEN(p) strlen (p->d_name)
45
46#ifdef HAVE_DIRENT_H
47
48#include <dirent.h> 34#include <dirent.h>
49#define DIRENTRY struct dirent
50
51#else /* not HAVE_DIRENT_H */
52
53#include <sys/dir.h>
54#include <sys/stat.h>
55
56#define DIRENTRY struct direct
57
58extern DIR *opendir (char *);
59extern struct direct *readdir (DIR *);
60
61#endif /* HAVE_DIRENT_H */
62
63#include <filemode.h> 35#include <filemode.h>
64#include <stat-time.h> 36#include <stat-time.h>
65 37
66#ifdef MSDOS
67#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
68#else
69#define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
70#endif
71
72#include "lisp.h" 38#include "lisp.h"
73#include "systime.h" 39#include "systime.h"
74#include "character.h" 40#include "character.h"
@@ -88,6 +54,17 @@ static Lisp_Object Qfile_attributes_lessp;
88 54
89static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); 55static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
90 56
57/* Return the number of bytes in DP's name. */
58static ptrdiff_t
59dirent_namelen (struct dirent *dp)
60{
61#ifdef _D_EXACT_NAMLEN
62 return _D_EXACT_NAMLEN (dp);
63#else
64 return strlen (dp->d_name);
65#endif
66}
67
91#ifdef WINDOWSNT 68#ifdef WINDOWSNT
92Lisp_Object 69Lisp_Object
93directory_files_internal_w32_unwind (Lisp_Object arg) 70directory_files_internal_w32_unwind (Lisp_Object arg)
@@ -124,7 +101,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
124 bool needsep = 0; 101 bool needsep = 0;
125 ptrdiff_t count = SPECPDL_INDEX (); 102 ptrdiff_t count = SPECPDL_INDEX ();
126 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 103 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
127 DIRENTRY *dp; 104 struct dirent *dp;
128#ifdef WINDOWSNT 105#ifdef WINDOWSNT
129 Lisp_Object w32_save = Qnil; 106 Lisp_Object w32_save = Qnil;
130#endif 107#endif
@@ -209,6 +186,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
209 /* Loop reading blocks until EOF or error. */ 186 /* Loop reading blocks until EOF or error. */
210 for (;;) 187 for (;;)
211 { 188 {
189 ptrdiff_t len;
190 bool wanted = 0;
191 Lisp_Object name, finalname;
192 struct gcpro gcpro1, gcpro2;
193
212 errno = 0; 194 errno = 0;
213 dp = readdir (d); 195 dp = readdir (d);
214 196
@@ -225,89 +207,81 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
225 if (dp == NULL) 207 if (dp == NULL)
226 break; 208 break;
227 209
228 if (DIRENTRY_NONEMPTY (dp)) 210 len = dirent_namelen (dp);
211 name = finalname = make_unibyte_string (dp->d_name, len);
212 GCPRO2 (finalname, name);
213
214 /* Note: DECODE_FILE can GC; it should protect its argument,
215 though. */
216 name = DECODE_FILE (name);
217 len = SBYTES (name);
218
219 /* Now that we have unwind_protect in place, we might as well
220 allow matching to be interrupted. */
221 immediate_quit = 1;
222 QUIT;
223
224 if (NILP (match)
225 || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0)))
226 wanted = 1;
227
228 immediate_quit = 0;
229
230 if (wanted)
229 { 231 {
230 ptrdiff_t len; 232 if (!NILP (full))
231 bool wanted = 0; 233 {
232 Lisp_Object name, finalname; 234 Lisp_Object fullname;
233 struct gcpro gcpro1, gcpro2; 235 ptrdiff_t nbytes = len + directory_nbytes + needsep;
236 ptrdiff_t nchars;
234 237
235 len = NAMLEN (dp); 238 fullname = make_uninit_multibyte_string (nbytes, nbytes);
236 name = finalname = make_unibyte_string (dp->d_name, len); 239 memcpy (SDATA (fullname), SDATA (directory),
237 GCPRO2 (finalname, name); 240 directory_nbytes);
238 241
239 /* Note: DECODE_FILE can GC; it should protect its argument, 242 if (needsep)
240 though. */ 243 SSET (fullname, directory_nbytes, DIRECTORY_SEP);
241 name = DECODE_FILE (name);
242 len = SBYTES (name);
243 244
244 /* Now that we have unwind_protect in place, we might as well 245 memcpy (SDATA (fullname) + directory_nbytes + needsep,
245 allow matching to be interrupted. */ 246 SDATA (name), len);
246 immediate_quit = 1;
247 QUIT;
248 247
249 if (NILP (match) 248 nchars = chars_in_text (SDATA (fullname), nbytes);
250 || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0)))
251 wanted = 1;
252 249
253 immediate_quit = 0; 250 /* Some bug somewhere. */
251 if (nchars > nbytes)
252 emacs_abort ();
254 253
255 if (wanted) 254 STRING_SET_CHARS (fullname, nchars);
256 { 255 if (nchars == nbytes)
257 if (!NILP (full)) 256 STRING_SET_UNIBYTE (fullname);
258 { 257
259 Lisp_Object fullname; 258 finalname = fullname;
260 ptrdiff_t nbytes = len + directory_nbytes + needsep;
261 ptrdiff_t nchars;
262
263 fullname = make_uninit_multibyte_string (nbytes, nbytes);
264 memcpy (SDATA (fullname), SDATA (directory),
265 directory_nbytes);
266
267 if (needsep)
268 SSET (fullname, directory_nbytes, DIRECTORY_SEP);
269
270 memcpy (SDATA (fullname) + directory_nbytes + needsep,
271 SDATA (name), len);
272
273 nchars = chars_in_text (SDATA (fullname), nbytes);
274
275 /* Some bug somewhere. */
276 if (nchars > nbytes)
277 emacs_abort ();
278
279 STRING_SET_CHARS (fullname, nchars);
280 if (nchars == nbytes)
281 STRING_SET_UNIBYTE (fullname);
282
283 finalname = fullname;
284 }
285 else
286 finalname = name;
287
288 if (attrs)
289 {
290 /* Construct an expanded filename for the directory entry.
291 Use the decoded names for input to Ffile_attributes. */
292 Lisp_Object decoded_fullname, fileattrs;
293 struct gcpro gcpro1, gcpro2;
294
295 decoded_fullname = fileattrs = Qnil;
296 GCPRO2 (decoded_fullname, fileattrs);
297
298 /* Both Fexpand_file_name and Ffile_attributes can GC. */
299 decoded_fullname = Fexpand_file_name (name, directory);
300 fileattrs = Ffile_attributes (decoded_fullname, id_format);
301
302 list = Fcons (Fcons (finalname, fileattrs), list);
303 UNGCPRO;
304 }
305 else
306 list = Fcons (finalname, list);
307 } 259 }
260 else
261 finalname = name;
308 262
309 UNGCPRO; 263 if (attrs)
264 {
265 /* Construct an expanded filename for the directory entry.
266 Use the decoded names for input to Ffile_attributes. */
267 Lisp_Object decoded_fullname, fileattrs;
268 struct gcpro gcpro1, gcpro2;
269
270 decoded_fullname = fileattrs = Qnil;
271 GCPRO2 (decoded_fullname, fileattrs);
272
273 /* Both Fexpand_file_name and Ffile_attributes can GC. */
274 decoded_fullname = Fexpand_file_name (name, directory);
275 fileattrs = Ffile_attributes (decoded_fullname, id_format);
276
277 list = Fcons (Fcons (finalname, fileattrs), list);
278 UNGCPRO;
279 }
280 else
281 list = Fcons (finalname, list);
310 } 282 }
283
284 UNGCPRO;
311 } 285 }
312 286
313 block_input (); 287 block_input ();
@@ -442,7 +416,8 @@ These are all file names in directory DIRECTORY which begin with FILE. */)
442 return file_name_completion (file, directory, 1, Qnil); 416 return file_name_completion (file, directory, 1, Qnil);
443} 417}
444 418
445static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr); 419static int file_name_completion_stat (Lisp_Object dirname, struct dirent *dp,
420 struct stat *st_addr);
446static Lisp_Object Qdefault_directory; 421static Lisp_Object Qdefault_directory;
447 422
448static Lisp_Object 423static Lisp_Object
@@ -499,7 +474,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
499 /* (att3b compiler bug requires do a null comparison this way) */ 474 /* (att3b compiler bug requires do a null comparison this way) */
500 while (1) 475 while (1)
501 { 476 {
502 DIRENTRY *dp; 477 struct dirent *dp;
503 ptrdiff_t len; 478 ptrdiff_t len;
504 bool canexclude = 0; 479 bool canexclude = 0;
505 480
@@ -517,11 +492,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
517 492
518 if (!dp) break; 493 if (!dp) break;
519 494
520 len = NAMLEN (dp); 495 len = dirent_namelen (dp);
521 496
522 QUIT; 497 QUIT;
523 if (! DIRENTRY_NONEMPTY (dp) 498 if (len < SCHARS (encoded_file)
524 || len < SCHARS (encoded_file)
525 || 0 <= scmp (dp->d_name, SSDATA (encoded_file), 499 || 0 <= scmp (dp->d_name, SSDATA (encoded_file),
526 SCHARS (encoded_file))) 500 SCHARS (encoded_file)))
527 continue; 501 continue;
@@ -806,9 +780,10 @@ scmp (const char *s1, const char *s2, ptrdiff_t len)
806} 780}
807 781
808static int 782static int
809file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) 783file_name_completion_stat (Lisp_Object dirname, struct dirent *dp,
784 struct stat *st_addr)
810{ 785{
811 ptrdiff_t len = NAMLEN (dp); 786 ptrdiff_t len = dirent_namelen (dp);
812 ptrdiff_t pos = SCHARS (dirname); 787 ptrdiff_t pos = SCHARS (dirname);
813 int value; 788 int value;
814 USE_SAFE_ALLOCA; 789 USE_SAFE_ALLOCA;
diff --git a/src/emacs.c b/src/emacs.c
index 079304b6c8e..7f1610ce5ef 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -718,7 +718,7 @@ main (int argc, char **argv)
718 stack_base = &dummy; 718 stack_base = &dummy;
719#endif 719#endif
720 720
721#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) 721#ifdef G_SLICE_ALWAYS_MALLOC
722 /* This is used by the Cygwin build. */ 722 /* This is used by the Cygwin build. */
723 setenv ("G_SLICE", "always-malloc", 1); 723 setenv ("G_SLICE", "always-malloc", 1);
724#endif 724#endif
diff --git a/src/fileio.c b/src/fileio.c
index 572f6d8ef83..442c66550d3 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -315,6 +315,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
315 register const char *beg; 315 register const char *beg;
316#else 316#else
317 register char *beg; 317 register char *beg;
318 Lisp_Object tem_fn;
318#endif 319#endif
319 register const char *p; 320 register const char *p;
320 Lisp_Object handler; 321 Lisp_Object handler;
@@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */)
374 p = beg + strlen (beg); 375 p = beg + strlen (beg);
375 } 376 }
376 } 377 }
377 dostounix_filename (beg); 378 tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg,
378#endif /* DOS_NT */ 379 STRING_MULTIBYTE (filename)));
379 380 dostounix_filename (SSDATA (tem_fn));
381 return DECODE_FILE (tem_fn);
382#else /* DOS_NT */
380 return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); 383 return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename));
384#endif /* DOS_NT */
381} 385}
382 386
383DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, 387DEFUN ("file-name-nondirectory", Ffile_name_nondirectory,
@@ -951,7 +955,18 @@ filesystem tree, not (expand-file-name ".." dirname). */)
951#ifdef DOS_NT 955#ifdef DOS_NT
952 /* Make sure directories are all separated with /, but 956 /* Make sure directories are all separated with /, but
953 avoid allocation of a new string when not required. */ 957 avoid allocation of a new string when not required. */
954 dostounix_filename (nm); 958 if (multibyte)
959 {
960 Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm),
961 multibyte);
962
963 tem_name = ENCODE_FILE (tem_name);
964 dostounix_filename (SSDATA (tem_name));
965 tem_name = DECODE_FILE (tem_name);
966 memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1);
967 }
968 else
969 dostounix_filename (nm);
955#ifdef WINDOWSNT 970#ifdef WINDOWSNT
956 if (IS_DIRECTORY_SEP (nm[1])) 971 if (IS_DIRECTORY_SEP (nm[1]))
957 { 972 {
@@ -1133,7 +1148,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1133 newdir = "/"; 1148 newdir = "/";
1134 } 1149 }
1135 else 1150 else
1136 getwd (adir); 1151 getcwd (adir, MAXPATHLEN + 1);
1137 newdir = adir; 1152 newdir = adir;
1138 } 1153 }
1139 1154
@@ -1305,10 +1320,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1305 target[0] = '/'; 1320 target[0] = '/';
1306 target[1] = ':'; 1321 target[1] = ':';
1307 } 1322 }
1308 dostounix_filename (target);
1309#endif /* DOS_NT */
1310
1311 result = make_specified_string (target, -1, o - target, multibyte); 1323 result = make_specified_string (target, -1, o - target, multibyte);
1324 result = ENCODE_FILE (result);
1325 dostounix_filename (SSDATA (result));
1326 result = DECODE_FILE (result);
1327#else /* !DOS_NT */
1328 result = make_specified_string (target, -1, o - target, multibyte);
1329#endif /* !DOS_NT */
1312 } 1330 }
1313 1331
1314 /* Again look to see if the file name has special constructs in it 1332 /* Again look to see if the file name has special constructs in it
@@ -1587,8 +1605,18 @@ those `/' is discarded. */)
1587 memcpy (nm, SDATA (filename), SBYTES (filename) + 1); 1605 memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
1588 1606
1589#ifdef DOS_NT 1607#ifdef DOS_NT
1590 dostounix_filename (nm); 1608 {
1591 substituted = (strcmp (nm, SDATA (filename)) != 0); 1609 Lisp_Object encoded_filename = ENCODE_FILE (filename);
1610 Lisp_Object tem_fn;
1611
1612 dostounix_filename (SDATA (encoded_filename));
1613 tem_fn = DECODE_FILE (encoded_filename);
1614 nm = alloca (SBYTES (tem_fn) + 1);
1615 memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1);
1616 substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0);
1617 if (substituted)
1618 filename = tem_fn;
1619 }
1592#endif 1620#endif
1593 endp = nm + SBYTES (filename); 1621 endp = nm + SBYTES (filename);
1594 1622
diff --git a/src/frame.c b/src/frame.c
index d580bf7f148..3501fc36675 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1467,7 +1467,6 @@ and returns whatever that function returns. */)
1467 f = SELECTED_FRAME (); 1467 f = SELECTED_FRAME ();
1468 x = y = Qnil; 1468 x = y = Qnil;
1469 1469
1470#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
1471 /* It's okay for the hook to refrain from storing anything. */ 1470 /* It's okay for the hook to refrain from storing anything. */
1472 if (FRAME_TERMINAL (f)->mouse_position_hook) 1471 if (FRAME_TERMINAL (f)->mouse_position_hook)
1473 { 1472 {
@@ -1487,7 +1486,6 @@ and returns whatever that function returns. */)
1487 XSETINT (x, col); 1486 XSETINT (x, col);
1488 XSETINT (y, row); 1487 XSETINT (y, row);
1489 } 1488 }
1490#endif
1491 XSETFRAME (lispy_dummy, f); 1489 XSETFRAME (lispy_dummy, f);
1492 retval = Fcons (lispy_dummy, Fcons (x, y)); 1490 retval = Fcons (lispy_dummy, Fcons (x, y));
1493 GCPRO1 (retval); 1491 GCPRO1 (retval);
@@ -1514,7 +1512,6 @@ and nil for X and Y. */)
1514 f = SELECTED_FRAME (); 1512 f = SELECTED_FRAME ();
1515 x = y = Qnil; 1513 x = y = Qnil;
1516 1514
1517#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
1518 /* It's okay for the hook to refrain from storing anything. */ 1515 /* It's okay for the hook to refrain from storing anything. */
1519 if (FRAME_TERMINAL (f)->mouse_position_hook) 1516 if (FRAME_TERMINAL (f)->mouse_position_hook)
1520 { 1517 {
@@ -1526,7 +1523,6 @@ and nil for X and Y. */)
1526 &time_dummy); 1523 &time_dummy);
1527 } 1524 }
1528 1525
1529#endif
1530 XSETFRAME (lispy_dummy, f); 1526 XSETFRAME (lispy_dummy, f);
1531 return Fcons (lispy_dummy, Fcons (x, y)); 1527 return Fcons (lispy_dummy, Fcons (x, y));
1532} 1528}
@@ -1557,7 +1553,7 @@ before calling this function on it, like this.
1557 /* Warping the mouse will cause enternotify and focus events. */ 1553 /* Warping the mouse will cause enternotify and focus events. */
1558 x_set_mouse_position (XFRAME (frame), XINT (x), XINT (y)); 1554 x_set_mouse_position (XFRAME (frame), XINT (x), XINT (y));
1559#else 1555#else
1560#if defined (MSDOS) && defined (HAVE_MOUSE) 1556#if defined (MSDOS)
1561 if (FRAME_MSDOS_P (XFRAME (frame))) 1557 if (FRAME_MSDOS_P (XFRAME (frame)))
1562 { 1558 {
1563 Fselect_frame (frame, Qnil); 1559 Fselect_frame (frame, Qnil);
@@ -1598,7 +1594,7 @@ before calling this function on it, like this.
1598 /* Warping the mouse will cause enternotify and focus events. */ 1594 /* Warping the mouse will cause enternotify and focus events. */
1599 x_set_mouse_pixel_position (XFRAME (frame), XINT (x), XINT (y)); 1595 x_set_mouse_pixel_position (XFRAME (frame), XINT (x), XINT (y));
1600#else 1596#else
1601#if defined (MSDOS) && defined (HAVE_MOUSE) 1597#if defined (MSDOS)
1602 if (FRAME_MSDOS_P (XFRAME (frame))) 1598 if (FRAME_MSDOS_P (XFRAME (frame)))
1603 { 1599 {
1604 Fselect_frame (frame, Qnil); 1600 Fselect_frame (frame, Qnil);
diff --git a/src/frame.h b/src/frame.h
index 35cbc44becc..5ebfc2f7ec3 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -357,9 +357,6 @@ struct frame
357 unsigned int external_menu_bar : 1; 357 unsigned int external_menu_bar : 1;
358#endif 358#endif
359 359
360 /* Nonzero if last attempt at redisplay on this frame was preempted. */
361 unsigned display_preempted : 1;
362
363 /* visible is nonzero if the frame is currently displayed; we check 360 /* visible is nonzero if the frame is currently displayed; we check
364 it to see if we should bother updating the frame's contents. 361 it to see if we should bother updating the frame's contents.
365 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE. 362 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
@@ -933,6 +930,21 @@ typedef struct frame *FRAME_PTR;
933 && (frame_var = XCAR (list_var), 1)); \ 930 && (frame_var = XCAR (list_var), 1)); \
934 list_var = XCDR (list_var)) 931 list_var = XCDR (list_var))
935 932
933/* Reflect mouse movement when a complete frame update is performed. */
934
935#define FRAME_MOUSE_UPDATE(frame) \
936 do { \
937 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
938 if (frame == hlinfo->mouse_face_mouse_frame) \
939 { \
940 block_input (); \
941 if (hlinfo->mouse_face_mouse_frame) \
942 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
943 hlinfo->mouse_face_mouse_x, \
944 hlinfo->mouse_face_mouse_y); \
945 unblock_input (); \
946 } \
947 } while (0)
936 948
937extern Lisp_Object Qframep, Qframe_live_p; 949extern Lisp_Object Qframep, Qframe_live_p;
938extern Lisp_Object Qtty, Qtty_type; 950extern Lisp_Object Qtty, Qtty_type;
diff --git a/src/indent.c b/src/indent.c
index eee96061e25..a3abf88feeb 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2048,7 +2048,13 @@ whether or not it is currently displayed in some window. */)
2048 comment said this is "so we don't move too far" (2005-01-19 2048 comment said this is "so we don't move too far" (2005-01-19
2049 checkin by kfs). But this does nothing useful that I can 2049 checkin by kfs). But this does nothing useful that I can
2050 tell, and it causes Bug#2694 . -- cyd */ 2050 tell, and it causes Bug#2694 . -- cyd */
2051 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 2051 /* When the position we started from is covered by a display
2052 string, move_it_to will overshoot it, while vertical-motion
2053 wants to put the cursor _before_ the display string. So in
2054 that case, we move to buffer position before the display
2055 string, and avoid overshooting. */
2056 move_it_to (&it, disp_string_at_start_p ? PT - 1 : PT,
2057 -1, -1, -1, MOVE_TO_POS);
2052 2058
2053 /* IT may move too far if truncate-lines is on and PT lies 2059 /* IT may move too far if truncate-lines is on and PT lies
2054 beyond the right margin. IT may also move too far if the 2060 beyond the right margin. IT may also move too far if the
diff --git a/src/keyboard.c b/src/keyboard.c
index bf441efef90..5980ae89522 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -306,9 +306,7 @@ static Lisp_Object Qmake_frame_visible;
306static Lisp_Object Qselect_window; 306static Lisp_Object Qselect_window;
307Lisp_Object Qhelp_echo; 307Lisp_Object Qhelp_echo;
308 308
309#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
310static Lisp_Object Qmouse_fixup_help_message; 309static Lisp_Object Qmouse_fixup_help_message;
311#endif
312 310
313/* Symbols to denote kinds of events. */ 311/* Symbols to denote kinds of events. */
314static Lisp_Object Qfunction_key; 312static Lisp_Object Qfunction_key;
@@ -420,12 +418,10 @@ static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
420static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, 418static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t,
421 Lisp_Object *); 419 Lisp_Object *);
422static Lisp_Object make_lispy_event (struct input_event *); 420static Lisp_Object make_lispy_event (struct input_event *);
423#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
424static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, 421static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object,
425 enum scroll_bar_part, 422 enum scroll_bar_part,
426 Lisp_Object, Lisp_Object, 423 Lisp_Object, Lisp_Object,
427 Time); 424 Time);
428#endif
429static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object, 425static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object,
430 Lisp_Object, const char *const *, 426 Lisp_Object, const char *const *,
431 Lisp_Object *, ptrdiff_t); 427 Lisp_Object *, ptrdiff_t);
@@ -1237,8 +1233,6 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0,
1237 user_error ("No recursive edit is in progress"); 1233 user_error ("No recursive edit is in progress");
1238} 1234}
1239 1235
1240#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
1241
1242/* Restore mouse tracking enablement. See Ftrack_mouse for the only use 1236/* Restore mouse tracking enablement. See Ftrack_mouse for the only use
1243 of this function. */ 1237 of this function. */
1244 1238
@@ -1313,7 +1307,6 @@ some_mouse_moved (void)
1313 return 0; 1307 return 0;
1314} 1308}
1315 1309
1316#endif /* HAVE_MOUSE || HAVE_GPM */
1317 1310
1318/* This is the actual command reading loop, 1311/* This is the actual command reading loop,
1319 sans error-handling encapsulation. */ 1312 sans error-handling encapsulation. */
@@ -1405,14 +1398,11 @@ command_loop_1 (void)
1405 1398
1406 Vdeactivate_mark = Qnil; 1399 Vdeactivate_mark = Qnil;
1407 1400
1408#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
1409
1410 /* Don't ignore mouse movements for more than a single command 1401 /* Don't ignore mouse movements for more than a single command
1411 loop. (This flag is set in xdisp.c whenever the tool bar is 1402 loop. (This flag is set in xdisp.c whenever the tool bar is
1412 resized, because the resize moves text up or down, and would 1403 resized, because the resize moves text up or down, and would
1413 generate false mouse drag events if we don't ignore them.) */ 1404 generate false mouse drag events if we don't ignore them.) */
1414 ignore_mouse_drag_p = 0; 1405 ignore_mouse_drag_p = 0;
1415#endif
1416 1406
1417 /* If minibuffer on and echo area in use, 1407 /* If minibuffer on and echo area in use,
1418 wait a short time and redraw minibuffer. */ 1408 wait a short time and redraw minibuffer. */
@@ -2185,7 +2175,6 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2185 return; 2175 return;
2186 } 2176 }
2187 2177
2188#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
2189 if (!noninteractive && STRINGP (help)) 2178 if (!noninteractive && STRINGP (help))
2190 { 2179 {
2191 /* The mouse-fixup-help-message Lisp function can call 2180 /* The mouse-fixup-help-message Lisp function can call
@@ -2198,7 +2187,6 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2198 if (f) 2187 if (f)
2199 f->mouse_moved = 1; 2188 f->mouse_moved = 1;
2200 } 2189 }
2201#endif
2202 2190
2203 if (STRINGP (help) || NILP (help)) 2191 if (STRINGP (help) || NILP (help))
2204 { 2192 {
@@ -3393,11 +3381,9 @@ readable_events (int flags)
3393 return 1; 3381 return 1;
3394 } 3382 }
3395 3383
3396#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
3397 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES) 3384 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
3398 && !NILP (do_mouse_tracking) && some_mouse_moved ()) 3385 && !NILP (do_mouse_tracking) && some_mouse_moved ())
3399 return 1; 3386 return 1;
3400#endif
3401 if (single_kboard) 3387 if (single_kboard)
3402 { 3388 {
3403 if (current_kboard->kbd_queue_has_data) 3389 if (current_kboard->kbd_queue_has_data)
@@ -3765,10 +3751,8 @@ kbd_buffer_get_event (KBOARD **kbp,
3765 3751
3766 if (kbd_fetch_ptr != kbd_store_ptr) 3752 if (kbd_fetch_ptr != kbd_store_ptr)
3767 break; 3753 break;
3768#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
3769 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 3754 if (!NILP (do_mouse_tracking) && some_mouse_moved ())
3770 break; 3755 break;
3771#endif
3772 3756
3773 /* If the quit flag is set, then read_char will return 3757 /* If the quit flag is set, then read_char will return
3774 quit_char, so that counts as "available input." */ 3758 quit_char, so that counts as "available input." */
@@ -3783,10 +3767,8 @@ kbd_buffer_get_event (KBOARD **kbp,
3783#endif 3767#endif
3784 if (kbd_fetch_ptr != kbd_store_ptr) 3768 if (kbd_fetch_ptr != kbd_store_ptr)
3785 break; 3769 break;
3786#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
3787 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 3770 if (!NILP (do_mouse_tracking) && some_mouse_moved ())
3788 break; 3771 break;
3789#endif
3790 if (end_time) 3772 if (end_time)
3791 { 3773 {
3792 EMACS_TIME now = current_emacs_time (); 3774 EMACS_TIME now = current_emacs_time ();
@@ -4050,7 +4032,6 @@ kbd_buffer_get_event (KBOARD **kbp,
4050 } 4032 }
4051 } 4033 }
4052 } 4034 }
4053#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
4054 /* Try generating a mouse motion event. */ 4035 /* Try generating a mouse motion event. */
4055 else if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4036 else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4056 { 4037 {
@@ -4095,7 +4076,6 @@ kbd_buffer_get_event (KBOARD **kbp,
4095 if (!NILP (x) && NILP (obj)) 4076 if (!NILP (x) && NILP (obj))
4096 obj = make_lispy_movement (f, bar_window, part, x, y, t); 4077 obj = make_lispy_movement (f, bar_window, part, x, y, t);
4097 } 4078 }
4098#endif /* HAVE_MOUSE || HAVE GPM */
4099 else 4079 else
4100 /* We were promised by the above while loop that there was 4080 /* We were promised by the above while loop that there was
4101 something for us to read! */ 4081 something for us to read! */
@@ -5407,7 +5387,6 @@ make_lispy_event (struct input_event *event)
5407 return Qnil; 5387 return Qnil;
5408#endif 5388#endif
5409 5389
5410#ifdef HAVE_MOUSE
5411 /* A mouse click. Figure out where it is, decide whether it's 5390 /* A mouse click. Figure out where it is, decide whether it's
5412 a press, click or drag, and build the appropriate structure. */ 5391 a press, click or drag, and build the appropriate structure. */
5413 case MOUSE_CLICK_EVENT: 5392 case MOUSE_CLICK_EVENT:
@@ -5859,7 +5838,6 @@ make_lispy_event (struct input_event *event)
5859 Fcons (files, 5838 Fcons (files,
5860 Qnil))); 5839 Qnil)));
5861 } 5840 }
5862#endif /* HAVE_MOUSE */
5863 5841
5864#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 5842#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
5865 || defined (HAVE_NS) || defined (USE_GTK) 5843 || defined (HAVE_NS) || defined (USE_GTK)
@@ -5984,8 +5962,6 @@ make_lispy_event (struct input_event *event)
5984 } 5962 }
5985} 5963}
5986 5964
5987#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
5988
5989static Lisp_Object 5965static Lisp_Object
5990make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 5966make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
5991 Lisp_Object x, Lisp_Object y, Time t) 5967 Lisp_Object x, Lisp_Object y, Time t)
@@ -6013,8 +5989,6 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
6013 } 5989 }
6014} 5990}
6015 5991
6016#endif /* HAVE_MOUSE || HAVE GPM */
6017
6018/* Construct a switch frame event. */ 5992/* Construct a switch frame event. */
6019static Lisp_Object 5993static Lisp_Object
6020make_lispy_switch_frame (Lisp_Object frame) 5994make_lispy_switch_frame (Lisp_Object frame)
@@ -11249,9 +11223,7 @@ init_keyboard (void)
11249 recent_keys_index = 0; 11223 recent_keys_index = 0;
11250 kbd_fetch_ptr = kbd_buffer; 11224 kbd_fetch_ptr = kbd_buffer;
11251 kbd_store_ptr = kbd_buffer; 11225 kbd_store_ptr = kbd_buffer;
11252#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11253 do_mouse_tracking = Qnil; 11226 do_mouse_tracking = Qnil;
11254#endif
11255 input_pending = 0; 11227 input_pending = 0;
11256 interrupt_input_blocked = 0; 11228 interrupt_input_blocked = 0;
11257 pending_signals = 0; 11229 pending_signals = 0;
@@ -11406,9 +11378,7 @@ syms_of_keyboard (void)
11406 DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar"); 11378 DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
11407 DEFSYM (Qmenu_bar, "menu-bar"); 11379 DEFSYM (Qmenu_bar, "menu-bar");
11408 11380
11409#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11410 DEFSYM (Qmouse_fixup_help_message, "mouse-fixup-help-message"); 11381 DEFSYM (Qmouse_fixup_help_message, "mouse-fixup-help-message");
11411#endif
11412 11382
11413 DEFSYM (Qabove_handle, "above-handle"); 11383 DEFSYM (Qabove_handle, "above-handle");
11414 DEFSYM (Qhandle, "handle"); 11384 DEFSYM (Qhandle, "handle");
@@ -11528,9 +11498,7 @@ syms_of_keyboard (void)
11528 defsubr (&Sread_key_sequence); 11498 defsubr (&Sread_key_sequence);
11529 defsubr (&Sread_key_sequence_vector); 11499 defsubr (&Sread_key_sequence_vector);
11530 defsubr (&Srecursive_edit); 11500 defsubr (&Srecursive_edit);
11531#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11532 defsubr (&Strack_mouse); 11501 defsubr (&Strack_mouse);
11533#endif
11534 defsubr (&Sinput_pending_p); 11502 defsubr (&Sinput_pending_p);
11535 defsubr (&Scommand_execute); 11503 defsubr (&Scommand_execute);
11536 defsubr (&Srecent_keys); 11504 defsubr (&Srecent_keys);
diff --git a/src/lisp.h b/src/lisp.h
index ae532eed5a2..a5c4f862d37 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1654,10 +1654,6 @@ typedef struct {
1654 int mouse_face_face_id; 1654 int mouse_face_face_id;
1655 Lisp_Object mouse_face_overlay; 1655 Lisp_Object mouse_face_overlay;
1656 1656
1657 /* 1 if a mouse motion event came and we didn't handle it right away because
1658 gc was in progress. */
1659 int mouse_face_deferred_gc;
1660
1661 /* FRAME and X, Y position of mouse when last checked for 1657 /* FRAME and X, Y position of mouse when last checked for
1662 highlighting. X and Y can be negative or out of range for the frame. */ 1658 highlighting. X and Y can be negative or out of range for the frame. */
1663 struct frame *mouse_face_mouse_frame; 1659 struct frame *mouse_face_mouse_frame;
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 9778e955677..a296f6eb393 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -229,12 +229,12 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
229obj = $(GLOBAL_SOURCES:.c=.o) 229obj = $(GLOBAL_SOURCES:.c=.o)
230 230
231globals.h: gl-stamp 231globals.h: gl-stamp
232 @cmd /c rem true 232 @cmd $(SWITCHCHAR)c rem true
233 233
234gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES) 234gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
235 - $(DEL) gl-tmp 235 - $(DEL) gl-tmp
236 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp 236 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
237 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h" 237 fc.exe $(SWITCHCHAR)b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h
238 - $(DEL) gl-tmp 238 - $(DEL) gl-tmp
239 echo timestamp > $@ 239 echo timestamp > $@
240 240
@@ -413,8 +413,6 @@ CONF_POST_H = $(SRC)/conf_post.h \
413 $(MS_W32_H) 413 $(MS_W32_H)
414CONFIG_H = $(SRC)/config.h \ 414CONFIG_H = $(SRC)/config.h \
415 $(CONF_POST_H) 415 $(CONF_POST_H)
416DIR_H = $(NT_INC)/sys/dir.h \
417 $(SRC)/ndir.h
418W32GUI_H = $(SRC)/w32gui.h \ 416W32GUI_H = $(SRC)/w32gui.h \
419 $(SYSTIME_H) 417 $(SYSTIME_H)
420DISPEXTERN_H = $(SRC)/dispextern.h \ 418DISPEXTERN_H = $(SRC)/dispextern.h \
@@ -714,6 +712,7 @@ $(BLD)/dired.$(O) : \
714 $(SRC)/blockinput.h \ 712 $(SRC)/blockinput.h \
715 $(SRC)/commands.h \ 713 $(SRC)/commands.h \
716 $(SRC)/regex.h \ 714 $(SRC)/regex.h \
715 $(NT_INC)/dirent.h \
717 $(NT_INC)/pwd.h \ 716 $(NT_INC)/pwd.h \
718 $(NT_INC)/sys/stat.h \ 717 $(NT_INC)/sys/stat.h \
719 $(NT_INC)/unistd.h \ 718 $(NT_INC)/unistd.h \
@@ -722,7 +721,6 @@ $(BLD)/dired.$(O) : \
722 $(CHARSET_H) \ 721 $(CHARSET_H) \
723 $(CODING_H) \ 722 $(CODING_H) \
724 $(CONFIG_H) \ 723 $(CONFIG_H) \
725 $(DIR_H) \
726 $(FILEMODE_H) \ 724 $(FILEMODE_H) \
727 $(GRP_H) \ 725 $(GRP_H) \
728 $(LISP_H) \ 726 $(LISP_H) \
@@ -1175,11 +1173,11 @@ $(BLD)/minibuf.$(O) : \
1175 1173
1176$(BLD)/w32.$(O) : \ 1174$(BLD)/w32.$(O) : \
1177 $(SRC)/w32.c \ 1175 $(SRC)/w32.c \
1178 $(SRC)/ndir.h \
1179 $(SRC)/w32.h \ 1176 $(SRC)/w32.h \
1180 $(SRC)/w32common.h \ 1177 $(SRC)/w32common.h \
1181 $(SRC)/w32heap.h \ 1178 $(SRC)/w32heap.h \
1182 $(SRC)/w32select.h \ 1179 $(SRC)/w32select.h \
1180 $(NT_INC)/dirent.h \
1183 $(NT_INC)/pwd.h \ 1181 $(NT_INC)/pwd.h \
1184 $(NT_INC)/sys/file.h \ 1182 $(NT_INC)/sys/file.h \
1185 $(NT_INC)/sys/time.h \ 1183 $(NT_INC)/sys/time.h \
diff --git a/src/msdos.c b/src/msdos.c
index dd05a8b2c5d..433bf1074d8 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1275,7 +1275,6 @@ IT_update_begin (struct frame *f)
1275 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 1275 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1276 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 1276 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1277 hlinfo->mouse_face_window = Qnil; 1277 hlinfo->mouse_face_window = Qnil;
1278 hlinfo->mouse_face_deferred_gc = 0;
1279 hlinfo->mouse_face_mouse_frame = NULL; 1278 hlinfo->mouse_face_mouse_frame = NULL;
1280 } 1279 }
1281 1280
@@ -1295,21 +1294,10 @@ IT_update_end (struct frame *f)
1295static void 1294static void
1296IT_frame_up_to_date (struct frame *f) 1295IT_frame_up_to_date (struct frame *f)
1297{ 1296{
1298 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1299 Lisp_Object new_cursor, frame_desired_cursor; 1297 Lisp_Object new_cursor, frame_desired_cursor;
1300 struct window *sw; 1298 struct window *sw;
1301 1299
1302 if (hlinfo->mouse_face_deferred_gc 1300 FRAME_MOUSE_UPDATE (f);
1303 || (f && f == hlinfo->mouse_face_mouse_frame))
1304 {
1305 block_input ();
1306 if (hlinfo->mouse_face_mouse_frame)
1307 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1308 hlinfo->mouse_face_mouse_x,
1309 hlinfo->mouse_face_mouse_y);
1310 hlinfo->mouse_face_deferred_gc = 0;
1311 unblock_input ();
1312 }
1313 1301
1314 /* Set the cursor type to whatever they wanted. In a minibuffer 1302 /* Set the cursor type to whatever they wanted. In a minibuffer
1315 window, we want the cursor to appear only if we are reading input 1303 window, we want the cursor to appear only if we are reading input
@@ -1849,7 +1837,6 @@ internal_terminal_init (void)
1849 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 1837 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
1850 } 1838 }
1851 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; 1839 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
1852 the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0;
1853 the_only_display_info.mouse_highlight.mouse_face_beg_row = 1840 the_only_display_info.mouse_highlight.mouse_face_beg_row =
1854 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1; 1841 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
1855 the_only_display_info.mouse_highlight.mouse_face_end_row = 1842 the_only_display_info.mouse_highlight.mouse_face_end_row =
diff --git a/src/ndir.h b/src/ndir.h
deleted file mode 100644
index cd7cdbe55f5..00000000000
--- a/src/ndir.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 <dir.h> -- definitions for 4.2BSD-compatible directory access
3
4 last edit: 09-Jul-1983 D A Gwyn
5
6 * The code here is forced by the interface, and is not subject to
7 * copyright, constituting the only possible expression of the
8 * algorithm in this format.
9 */
10
11#define DIRBLKSIZ 512 /* size of directory block */
12#ifdef WINDOWSNT
13#define MAXNAMLEN 255
14#else /* not WINDOWSNT */
15#define MAXNAMLEN 15 /* maximum filename length */
16#endif /* not WINDOWSNT */
17 /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
18
19struct direct /* data from readdir() */
20 {
21 long d_ino; /* inode number of entry */
22 unsigned short d_reclen; /* length of this record */
23 unsigned short d_namlen; /* length of string in d_name */
24 char d_name[MAXNAMLEN+1]; /* name of file */
25 };
26
27typedef struct
28 {
29 int dd_fd; /* file descriptor */
30 int dd_loc; /* offset in block */
31 int dd_size; /* amount of valid data */
32 char dd_buf[DIRBLKSIZ]; /* directory block */
33 } DIR; /* stream data from opendir() */
34
35extern DIR *opendir (char *);
36extern struct direct *readdir (DIR *);
37extern void seekdir (DIR *, long);
38extern void closedir (DIR *);
39
40#define rewinddir( dirp ) seekdir( dirp, 0L )
41
diff --git a/src/nsterm.h b/src/nsterm.h
index 2e868b86caf..005701ed415 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -630,8 +630,7 @@ struct ns_output
630/* this dummy decl needed to support TTYs */ 630/* this dummy decl needed to support TTYs */
631struct x_output 631struct x_output
632{ 632{
633 unsigned long background_pixel; 633 int unused;
634 unsigned long foreground_pixel;
635}; 634};
636 635
637 636
diff --git a/src/nsterm.m b/src/nsterm.m
index 57d32ee0528..25eb7ebc495 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1186,7 +1186,6 @@ x_free_frame_resources (struct frame *f)
1186 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 1186 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1187 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 1187 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1188 hlinfo->mouse_face_window = Qnil; 1188 hlinfo->mouse_face_window = Qnil;
1189 hlinfo->mouse_face_deferred_gc = 0;
1190 hlinfo->mouse_face_mouse_frame = 0; 1189 hlinfo->mouse_face_mouse_frame = 0;
1191 } 1190 }
1192 1191
@@ -1887,8 +1886,7 @@ static void
1887ns_frame_up_to_date (struct frame *f) 1886ns_frame_up_to_date (struct frame *f)
1888/* -------------------------------------------------------------------------- 1887/* --------------------------------------------------------------------------
1889 External (hook): Fix up mouse highlighting right after a full update. 1888 External (hook): Fix up mouse highlighting right after a full update.
1890 Some highlighting was deferred if GC was happening during 1889 Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls.
1891 note_mouse_highlight (), while other highlighting was deferred for update.
1892 -------------------------------------------------------------------------- */ 1890 -------------------------------------------------------------------------- */
1893{ 1891{
1894 NSTRACE (ns_frame_up_to_date); 1892 NSTRACE (ns_frame_up_to_date);
@@ -1896,19 +1894,17 @@ ns_frame_up_to_date (struct frame *f)
1896 if (FRAME_NS_P (f)) 1894 if (FRAME_NS_P (f))
1897 { 1895 {
1898 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 1896 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1899 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) 1897 if (f == hlinfo->mouse_face_mouse_frame)
1900 /*&& hlinfo->mouse_face_mouse_frame*/) 1898 {
1901 { 1899 block_input ();
1902 block_input ();
1903 ns_update_begin(f); 1900 ns_update_begin(f);
1904 if (hlinfo->mouse_face_mouse_frame) 1901 if (hlinfo->mouse_face_mouse_frame)
1905 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1902 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1906 hlinfo->mouse_face_mouse_x, 1903 hlinfo->mouse_face_mouse_x,
1907 hlinfo->mouse_face_mouse_y); 1904 hlinfo->mouse_face_mouse_y);
1908 hlinfo->mouse_face_deferred_gc = 0;
1909 ns_update_end(f); 1905 ns_update_end(f);
1910 unblock_input (); 1906 unblock_input ();
1911 } 1907 }
1912 } 1908 }
1913} 1909}
1914 1910
@@ -3869,7 +3865,6 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3869 dpyinfo->root_window = 42; /* a placeholder.. */ 3865 dpyinfo->root_window = 42; /* a placeholder.. */
3870 3866
3871 hlinfo->mouse_face_mouse_frame = NULL; 3867 hlinfo->mouse_face_mouse_frame = NULL;
3872 hlinfo->mouse_face_deferred_gc = 0;
3873 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 3868 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
3874 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 3869 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
3875 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; 3870 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
diff --git a/src/sysdep.c b/src/sysdep.c
index 7c5c144fa8c..1a3834f0379 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -101,7 +101,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
101#define _P_WAIT 0 101#define _P_WAIT 0
102int _cdecl _spawnlp (int, const char *, const char *, ...); 102int _cdecl _spawnlp (int, const char *, const char *, ...);
103int _cdecl _getpid (void); 103int _cdecl _getpid (void);
104extern char *getwd (char *);
105#endif 104#endif
106 105
107#include "syssignal.h" 106#include "syssignal.h"
@@ -134,12 +133,12 @@ char*
134get_current_dir_name (void) 133get_current_dir_name (void)
135{ 134{
136 char *buf; 135 char *buf;
137 char *pwd; 136 char *pwd = getenv ("PWD");
138 struct stat dotstat, pwdstat; 137 struct stat dotstat, pwdstat;
139 /* If PWD is accurate, use it instead of calling getwd. PWD is 138 /* If PWD is accurate, use it instead of calling getcwd. PWD is
140 sometimes a nicer name, and using it may avoid a fatal error if a 139 sometimes a nicer name, and using it may avoid a fatal error if a
141 parent directory is searchable but not readable. */ 140 parent directory is searchable but not readable. */
142 if ((pwd = getenv ("PWD")) != 0 141 if (pwd
143 && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) 142 && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1])))
144 && stat (pwd, &pwdstat) == 0 143 && stat (pwd, &pwdstat) == 0
145 && stat (".", &dotstat) == 0 144 && stat (".", &dotstat) == 0
@@ -155,7 +154,6 @@ get_current_dir_name (void)
155 return NULL; 154 return NULL;
156 strcpy (buf, pwd); 155 strcpy (buf, pwd);
157 } 156 }
158#ifdef HAVE_GETCWD
159 else 157 else
160 { 158 {
161 size_t buf_size = 1024; 159 size_t buf_size = 1024;
@@ -179,22 +177,6 @@ get_current_dir_name (void)
179 return NULL; 177 return NULL;
180 } 178 }
181 } 179 }
182#else
183 else
184 {
185 /* We need MAXPATHLEN here. */
186 buf = malloc (MAXPATHLEN + 1);
187 if (!buf)
188 return NULL;
189 if (getwd (buf) == NULL)
190 {
191 int tmp_errno = errno;
192 free (buf);
193 errno = tmp_errno;
194 return NULL;
195 }
196 }
197#endif
198 return buf; 180 return buf;
199} 181}
200#endif 182#endif
@@ -471,7 +453,7 @@ sys_subshell (void)
471 int st; 453 int st;
472 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ 454 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
473#endif 455#endif
474 int pid; 456 pid_t pid;
475 struct save_signal saved_handlers[5]; 457 struct save_signal saved_handlers[5];
476 Lisp_Object dir; 458 Lisp_Object dir;
477 unsigned char *volatile str_volatile = 0; 459 unsigned char *volatile str_volatile = 0;
@@ -521,7 +503,7 @@ sys_subshell (void)
521 const char *sh = 0; 503 const char *sh = 0;
522 504
523#ifdef DOS_NT /* MW, Aug 1993 */ 505#ifdef DOS_NT /* MW, Aug 1993 */
524 getwd (oldwd); 506 getcwd (oldwd, sizeof oldwd);
525 if (sh == 0) 507 if (sh == 0)
526 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ 508 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */
527#endif 509#endif
@@ -2238,82 +2220,6 @@ emacs_readlink (char const *filename, char initial_buf[READLINK_BUFSIZE])
2238 &emacs_norealloc_allocator, careadlinkatcwd); 2220 &emacs_norealloc_allocator, careadlinkatcwd);
2239} 2221}
2240 2222
2241#ifdef USG
2242/*
2243 * All of the following are for USG.
2244 *
2245 * On USG systems the system calls are INTERRUPTIBLE by signals
2246 * that the user program has elected to catch. Thus the system call
2247 * must be retried in these cases. To handle this without massive
2248 * changes in the source code, we remap the standard system call names
2249 * to names for our own functions in sysdep.c that do the system call
2250 * with retries. Actually, for portability reasons, it is good
2251 * programming practice, as this example shows, to limit all actual
2252 * system calls to a single occurrence in the source. Sure, this
2253 * adds an extra level of function call overhead but it is almost
2254 * always negligible. Fred Fish, Unisoft Systems Inc.
2255 */
2256
2257/*
2258 * Warning, this function may not duplicate 4.2 action properly
2259 * under error conditions.
2260 */
2261
2262#if !defined (HAVE_GETWD) || defined (BROKEN_GETWD)
2263
2264#ifndef MAXPATHLEN
2265/* In 4.1, param.h fails to define this. */
2266#define MAXPATHLEN 1024
2267#endif
2268
2269char *
2270getwd (char *pathname)
2271{
2272 char *npath, *spath;
2273 extern char *getcwd (char *, size_t);
2274
2275 block_input (); /* getcwd uses malloc */
2276 spath = npath = getcwd ((char *) 0, MAXPATHLEN);
2277 if (spath == 0)
2278 {
2279 unblock_input ();
2280 return spath;
2281 }
2282 /* On Altos 3068, getcwd can return @hostname/dir, so discard
2283 up to first slash. Should be harmless on other systems. */
2284 while (*npath && *npath != '/')
2285 npath++;
2286 strcpy (pathname, npath);
2287 free (spath); /* getcwd uses malloc */
2288 unblock_input ();
2289 return pathname;
2290}
2291
2292#endif /* !defined (HAVE_GETWD) || defined (BROKEN_GETWD) */
2293#endif /* USG */
2294
2295/* Directory routines for systems that don't have them. */
2296
2297#ifdef HAVE_DIRENT_H
2298
2299#include <dirent.h>
2300
2301#if !defined (HAVE_CLOSEDIR)
2302
2303int
2304closedir (DIR *dirp /* stream from opendir */)
2305{
2306 int rtnval;
2307
2308 rtnval = emacs_close (dirp->dd_fd);
2309 xfree (dirp);
2310
2311 return rtnval;
2312}
2313#endif /* not HAVE_CLOSEDIR */
2314#endif /* HAVE_DIRENT_H */
2315
2316
2317/* Return a struct timeval that is roughly equivalent to T. 2223/* Return a struct timeval that is roughly equivalent to T.
2318 Use the least timeval not less than T. 2224 Use the least timeval not less than T.
2319 Return an extremal value if the result would overflow. */ 2225 Return an extremal value if the result would overflow. */
diff --git a/src/w32.c b/src/w32.c
index 94cf472a4ae..c8e16dfaa94 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -119,9 +119,10 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX {
119#include <aclapi.h> 119#include <aclapi.h>
120 120
121#ifdef _MSC_VER 121#ifdef _MSC_VER
122/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER, except 122/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the
123 on ntifs.h, which cannot be included because it triggers conflicts 123 associated macros, except on ntifs.h, which cannot be included
124 with other Windows API headers. So we define it here by hand. */ 124 because it triggers conflicts with other Windows API headers. So
125 we define it here by hand. */
125 126
126typedef struct _REPARSE_DATA_BUFFER { 127typedef struct _REPARSE_DATA_BUFFER {
127 ULONG ReparseTag; 128 ULONG ReparseTag;
@@ -149,6 +150,12 @@ typedef struct _REPARSE_DATA_BUFFER {
149 } DUMMYUNIONNAME; 150 } DUMMYUNIONNAME;
150} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; 151} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
151 152
153#define FILE_DEVICE_FILE_SYSTEM 9
154#define METHOD_BUFFERED 0
155#define FILE_ANY_ACCESS 0x00000000
156#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
157#define FSCTL_GET_REPARSE_POINT \
158 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
152#endif 159#endif
153 160
154/* TCP connection support. */ 161/* TCP connection support. */
@@ -172,7 +179,7 @@ typedef struct _REPARSE_DATA_BUFFER {
172#undef sendto 179#undef sendto
173 180
174#include "w32.h" 181#include "w32.h"
175#include "ndir.h" 182#include <dirent.h>
176#include "w32common.h" 183#include "w32common.h"
177#include "w32heap.h" 184#include "w32heap.h"
178#include "w32select.h" 185#include "w32select.h"
@@ -901,8 +908,18 @@ static char startup_dir[MAXPATHLEN];
901 908
902/* Get the current working directory. */ 909/* Get the current working directory. */
903char * 910char *
904getwd (char *dir) 911getcwd (char *dir, int dirsize)
905{ 912{
913 if (!dirsize)
914 {
915 errno = EINVAL;
916 return NULL;
917 }
918 if (dirsize <= strlen (startup_dir))
919 {
920 errno = ERANGE;
921 return NULL;
922 }
906#if 0 923#if 0
907 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0) 924 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0)
908 return dir; 925 return dir;
@@ -1818,7 +1835,7 @@ init_environment (char ** argv)
1818 memcpy (*envp, "COMSPEC=", 8); 1835 memcpy (*envp, "COMSPEC=", 8);
1819 } 1836 }
1820 1837
1821 /* Remember the initial working directory for getwd. */ 1838 /* Remember the initial working directory for getcwd. */
1822 /* FIXME: Do we need to resolve possible symlinks in startup_dir? 1839 /* FIXME: Do we need to resolve possible symlinks in startup_dir?
1823 Does it matter anywhere in Emacs? */ 1840 Does it matter anywhere in Emacs? */
1824 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) 1841 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))
@@ -2431,7 +2448,7 @@ is_exec (const char * name)
2431 and readdir. We can't use the procedures supplied in sysdep.c, 2448 and readdir. We can't use the procedures supplied in sysdep.c,
2432 so we provide them here. */ 2449 so we provide them here. */
2433 2450
2434struct direct dir_static; /* simulated directory contents */ 2451struct dirent dir_static; /* simulated directory contents */
2435static HANDLE dir_find_handle = INVALID_HANDLE_VALUE; 2452static HANDLE dir_find_handle = INVALID_HANDLE_VALUE;
2436static int dir_is_fat; 2453static int dir_is_fat;
2437static char dir_pathname[MAXPATHLEN+1]; 2454static char dir_pathname[MAXPATHLEN+1];
@@ -2501,7 +2518,7 @@ closedir (DIR *dirp)
2501 xfree ((char *) dirp); 2518 xfree ((char *) dirp);
2502} 2519}
2503 2520
2504struct direct * 2521struct dirent *
2505readdir (DIR *dirp) 2522readdir (DIR *dirp)
2506{ 2523{
2507 int downcase = !NILP (Vw32_downcase_file_names); 2524 int downcase = !NILP (Vw32_downcase_file_names);
@@ -2555,7 +2572,7 @@ readdir (DIR *dirp)
2555 downcase = 1; /* 8+3 aliases are returned in all caps */ 2572 downcase = 1; /* 8+3 aliases are returned in all caps */
2556 } 2573 }
2557 dir_static.d_namlen = strlen (dir_static.d_name); 2574 dir_static.d_namlen = strlen (dir_static.d_name);
2558 dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 + 2575 dir_static.d_reclen = sizeof (struct dirent) - MAXNAMLEN + 3 +
2559 dir_static.d_namlen - dir_static.d_namlen % 4; 2576 dir_static.d_namlen - dir_static.d_namlen % 4;
2560 2577
2561 /* If the file name in cFileName[] includes `?' characters, it means 2578 /* If the file name in cFileName[] includes `?' characters, it means
diff --git a/src/w32.h b/src/w32.h
index 8309a3cc23d..23eda830268 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -163,7 +163,6 @@ extern int sys_spawnve (int, char *, char **, char **);
163extern void register_child (int, int); 163extern void register_child (int, int);
164 164
165extern void sys_sleep (int); 165extern void sys_sleep (int);
166extern char *getwd (char *);
167extern int sys_link (const char *, const char *); 166extern int sys_link (const char *, const char *);
168 167
169 168
@@ -181,4 +180,3 @@ extern ssize_t emacs_gnutls_push (gnutls_transport_ptr_t p,
181#endif /* HAVE_GNUTLS */ 180#endif /* HAVE_GNUTLS */
182 181
183#endif /* EMACS_W32_H */ 182#endif /* EMACS_W32_H */
184
diff --git a/src/w32menu.c b/src/w32menu.c
index 36bf9574fdc..84fb1bdc71e 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -114,17 +114,6 @@ static int fill_in_menu (HMENU, widget_value *);
114 114
115void w32_free_menu_strings (HWND); 115void w32_free_menu_strings (HWND);
116 116
117
118
119/* This is set nonzero after the user activates the menu bar, and set
120 to zero again after the menu bars are redisplayed by prepare_menu_bar.
121 While it is nonzero, all calls to set_frame_menubar go deep.
122
123 I don't understand why this is needed, but it does seem to be
124 needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>. */
125
126int pending_menu_activation;
127
128#ifdef HAVE_MENUS 117#ifdef HAVE_MENUS
129 118
130DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0, 119DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0,
@@ -389,8 +378,6 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
389 378
390 if (! menubar_widget) 379 if (! menubar_widget)
391 deep_p = 1; 380 deep_p = 1;
392 else if (pending_menu_activation && !deep_p)
393 deep_p = 1;
394 381
395 if (deep_p) 382 if (deep_p)
396 { 383 {
diff --git a/src/w32term.c b/src/w32term.c
index 032912c27f4..ab6afd32c75 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -723,21 +723,7 @@ static void
723w32_frame_up_to_date (struct frame *f) 723w32_frame_up_to_date (struct frame *f)
724{ 724{
725 if (FRAME_W32_P (f)) 725 if (FRAME_W32_P (f))
726 { 726 FRAME_MOUSE_UPDATE (f);
727 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
728
729 if (hlinfo->mouse_face_deferred_gc
730 || f == hlinfo->mouse_face_mouse_frame)
731 {
732 block_input ();
733 if (hlinfo->mouse_face_mouse_frame)
734 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
735 hlinfo->mouse_face_mouse_x,
736 hlinfo->mouse_face_mouse_y);
737 hlinfo->mouse_face_deferred_gc = 0;
738 unblock_input ();
739 }
740 }
741} 727}
742 728
743 729
@@ -5979,7 +5965,6 @@ x_free_frame_resources (struct frame *f)
5979 hlinfo->mouse_face_end_row 5965 hlinfo->mouse_face_end_row
5980 = hlinfo->mouse_face_end_col = -1; 5966 = hlinfo->mouse_face_end_col = -1;
5981 hlinfo->mouse_face_window = Qnil; 5967 hlinfo->mouse_face_window = Qnil;
5982 hlinfo->mouse_face_deferred_gc = 0;
5983 hlinfo->mouse_face_mouse_frame = 0; 5968 hlinfo->mouse_face_mouse_frame = 0;
5984 } 5969 }
5985 5970
diff --git a/src/w32term.h b/src/w32term.h
index 83535b8faa3..28d4ca6c490 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -251,16 +251,10 @@ extern Lisp_Object x_get_focus_frame (struct frame *);
251 diffs between X and w32 code. */ 251 diffs between X and w32 code. */
252struct x_output 252struct x_output
253{ 253{
254#if 0 /* These are also defined in struct frame. Use that instead. */
255 PIX_TYPE background_pixel;
256 PIX_TYPE foreground_pixel;
257#endif
258
259 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this 254 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
260 frame, or IMPLICIT if we received an EnterNotify. 255 frame, or IMPLICIT if we received an EnterNotify.
261 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 256 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
262 int focus_state; 257 int focus_state;
263
264}; 258};
265 259
266enum 260enum
@@ -347,17 +341,13 @@ struct w32_output
347 341
348 /* Nonzero means our parent is another application's window 342 /* Nonzero means our parent is another application's window
349 and was explicitly specified. */ 343 and was explicitly specified. */
350 char explicit_parent; 344 unsigned explicit_parent : 1;
351 345
352 /* Nonzero means tried already to make this frame visible. */ 346 /* Nonzero means tried already to make this frame visible. */
353 char asked_for_visible; 347 unsigned asked_for_visible : 1;
354 348
355 /* Nonzero means menubar is currently active. */ 349 /* Nonzero means menubar is currently active. */
356 char menubar_active; 350 unsigned menubar_active : 1;
357
358 /* Nonzero means menubar is about to become active, but should be
359 brought up to date first. */
360 volatile char pending_menu_activation;
361 351
362 /* Relief GCs, colors etc. */ 352 /* Relief GCs, colors etc. */
363 struct relief 353 struct relief
@@ -751,7 +741,7 @@ extern int w32_system_caret_y;
751typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR); 741typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR);
752typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR); 742typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR);
753BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD); 743BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
754BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD) 744BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD);
755#ifdef UNICODE 745#ifdef UNICODE
756#define EnumSystemLocales EnumSystemLocalesW 746#define EnumSystemLocales EnumSystemLocalesW
757#else 747#else
diff --git a/src/xdisp.c b/src/xdisp.c
index a14c54dfc23..f212c39607f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9696,7 +9696,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
9696 do_pending_window_change (0); 9696 do_pending_window_change (0);
9697 echo_area_display (1); 9697 echo_area_display (1);
9698 do_pending_window_change (0); 9698 do_pending_window_change (0);
9699 if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 9699 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
9700 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); 9700 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
9701 } 9701 }
9702} 9702}
@@ -9793,7 +9793,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9793 do_pending_window_change (0); 9793 do_pending_window_change (0);
9794 echo_area_display (1); 9794 echo_area_display (1);
9795 do_pending_window_change (0); 9795 do_pending_window_change (0);
9796 if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 9796 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
9797 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); 9797 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
9798 } 9798 }
9799} 9799}
@@ -10962,6 +10962,21 @@ window_outdated (struct window *w)
10962 || w->last_overlay_modified < OVERLAY_MODIFF); 10962 || w->last_overlay_modified < OVERLAY_MODIFF);
10963} 10963}
10964 10964
10965/* Nonzero if W's buffer was changed but not saved or Transient Mark mode
10966 is enabled and mark of W's buffer was changed since last W's update. */
10967
10968static int
10969window_buffer_changed (struct window *w)
10970{
10971 struct buffer *b = XBUFFER (w->buffer);
10972
10973 eassert (BUFFER_LIVE_P (b));
10974
10975 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
10976 || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
10977 != !NILP (w->region_showing)));
10978}
10979
10965/*********************************************************************** 10980/***********************************************************************
10966 Mode Lines and Frame Titles 10981 Mode Lines and Frame Titles
10967 ***********************************************************************/ 10982 ***********************************************************************/
@@ -11381,12 +11396,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11381 /* This used to test w->update_mode_line, but we believe 11396 /* This used to test w->update_mode_line, but we believe
11382 there is no need to recompute the menu in that case. */ 11397 there is no need to recompute the menu in that case. */
11383 || update_mode_lines 11398 || update_mode_lines
11384 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11399 || window_buffer_changed (w))
11385 < BUF_MODIFF (XBUFFER (w->buffer)))
11386 != w->last_had_star)
11387 || ((!NILP (Vtransient_mark_mode)
11388 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11389 != !NILP (w->region_showing)))
11390 { 11400 {
11391 struct buffer *prev = current_buffer; 11401 struct buffer *prev = current_buffer;
11392 ptrdiff_t count = SPECPDL_INDEX (); 11402 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11538,11 +11548,18 @@ FRAME_PTR last_mouse_frame;
11538 11548
11539int last_tool_bar_item; 11549int last_tool_bar_item;
11540 11550
11541 11551/* Select `frame' temporarily without running all the code in
11552 do_switch_frame.
11553 FIXME: Maybe do_switch_frame should be trimmed down similarly
11554 when `norecord' is set. */
11542static Lisp_Object 11555static Lisp_Object
11543update_tool_bar_unwind (Lisp_Object frame) 11556fast_set_selected_frame (Lisp_Object frame)
11544{ 11557{
11545 selected_frame = frame; 11558 if (!EQ (selected_frame, frame))
11559 {
11560 selected_frame = frame;
11561 selected_window = XFRAME (frame)->selected_window;
11562 }
11546 return Qnil; 11563 return Qnil;
11547} 11564}
11548 11565
@@ -11579,12 +11596,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11579 if (windows_or_buffers_changed 11596 if (windows_or_buffers_changed
11580 || w->update_mode_line 11597 || w->update_mode_line
11581 || update_mode_lines 11598 || update_mode_lines
11582 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11599 || window_buffer_changed (w))
11583 < BUF_MODIFF (XBUFFER (w->buffer)))
11584 != w->last_had_star)
11585 || ((!NILP (Vtransient_mark_mode)
11586 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11587 != !NILP (w->region_showing)))
11588 { 11600 {
11589 struct buffer *prev = current_buffer; 11601 struct buffer *prev = current_buffer;
11590 ptrdiff_t count = SPECPDL_INDEX (); 11602 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11614,9 +11626,13 @@ update_tool_bar (struct frame *f, int save_match_data)
11614 before calling tool_bar_items, because the calculation of 11626 before calling tool_bar_items, because the calculation of
11615 the tool-bar keymap uses the selected frame (see 11627 the tool-bar keymap uses the selected frame (see
11616 `tool-bar-make-keymap' in tool-bar.el). */ 11628 `tool-bar-make-keymap' in tool-bar.el). */
11617 record_unwind_protect (update_tool_bar_unwind, selected_frame); 11629 eassert (EQ (selected_window,
11630 /* Since we only explicitly preserve selected_frame,
11631 check that selected_window would be redundant. */
11632 XFRAME (selected_frame)->selected_window));
11633 record_unwind_protect (fast_set_selected_frame, selected_frame);
11618 XSETFRAME (frame, f); 11634 XSETFRAME (frame, f);
11619 selected_frame = frame; 11635 fast_set_selected_frame (frame);
11620 11636
11621 /* Build desired tool-bar items from keymaps. */ 11637 /* Build desired tool-bar items from keymaps. */
11622 new_tool_bar 11638 new_tool_bar
@@ -13031,7 +13047,7 @@ redisplay_internal (void)
13031 ptrdiff_t count, count1; 13047 ptrdiff_t count, count1;
13032 struct frame *sf; 13048 struct frame *sf;
13033 int polling_stopped_here = 0; 13049 int polling_stopped_here = 0;
13034 Lisp_Object old_frame = selected_frame; 13050 Lisp_Object tail, frame, old_frame = selected_frame;
13035 struct backtrace backtrace; 13051 struct backtrace backtrace;
13036 13052
13037 /* Non-zero means redisplay has to consider all windows on all 13053 /* Non-zero means redisplay has to consider all windows on all
@@ -13083,15 +13099,8 @@ redisplay_internal (void)
13083 backtrace.debug_on_exit = 0; 13099 backtrace.debug_on_exit = 0;
13084 backtrace_list = &backtrace; 13100 backtrace_list = &backtrace;
13085 13101
13086 { 13102 FOR_EACH_FRAME (tail, frame)
13087 Lisp_Object tail, frame; 13103 XFRAME (frame)->already_hscrolled_p = 0;
13088
13089 FOR_EACH_FRAME (tail, frame)
13090 {
13091 struct frame *f = XFRAME (frame);
13092 f->already_hscrolled_p = 0;
13093 }
13094 }
13095 13104
13096 retry: 13105 retry:
13097 /* Remember the currently selected window. */ 13106 /* Remember the currently selected window. */
@@ -13141,25 +13150,20 @@ redisplay_internal (void)
13141 FRAME_TTY (sf)->previous_frame = sf; 13150 FRAME_TTY (sf)->previous_frame = sf;
13142 } 13151 }
13143 13152
13144 /* Set the visible flags for all frames. Do this before checking 13153 /* Set the visible flags for all frames. Do this before checking for
13145 for resized or garbaged frames; they want to know if their frames 13154 resized or garbaged frames; they want to know if their frames are
13146 are visible. See the comment in frame.h for 13155 visible. See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */
13147 FRAME_SAMPLE_VISIBILITY. */ 13156 number_of_visible_frames = 0;
13148 {
13149 Lisp_Object tail, frame;
13150
13151 number_of_visible_frames = 0;
13152 13157
13153 FOR_EACH_FRAME (tail, frame) 13158 FOR_EACH_FRAME (tail, frame)
13154 { 13159 {
13155 struct frame *f = XFRAME (frame); 13160 struct frame *f = XFRAME (frame);
13156 13161
13157 FRAME_SAMPLE_VISIBILITY (f); 13162 FRAME_SAMPLE_VISIBILITY (f);
13158 if (FRAME_VISIBLE_P (f)) 13163 if (FRAME_VISIBLE_P (f))
13159 ++number_of_visible_frames; 13164 ++number_of_visible_frames;
13160 clear_desired_matrices (f); 13165 clear_desired_matrices (f);
13161 } 13166 }
13162 }
13163 13167
13164 /* Notice any pending interrupt request to change frame size. */ 13168 /* Notice any pending interrupt request to change frame size. */
13165 do_pending_window_change (1); 13169 do_pending_window_change (1);
@@ -13517,8 +13521,6 @@ redisplay_internal (void)
13517 13521
13518 if (consider_all_windows_p) 13522 if (consider_all_windows_p)
13519 { 13523 {
13520 Lisp_Object tail, frame;
13521
13522 FOR_EACH_FRAME (tail, frame) 13524 FOR_EACH_FRAME (tail, frame)
13523 XFRAME (frame)->updated_p = 0; 13525 XFRAME (frame)->updated_p = 0;
13524 13526
@@ -13728,7 +13730,6 @@ redisplay_internal (void)
13728 frames here explicitly. */ 13730 frames here explicitly. */
13729 if (!pending) 13731 if (!pending)
13730 { 13732 {
13731 Lisp_Object tail, frame;
13732 int new_count = 0; 13733 int new_count = 0;
13733 13734
13734 FOR_EACH_FRAME (tail, frame) 13735 FOR_EACH_FRAME (tail, frame)
@@ -14293,7 +14294,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14293 GLYPH_BEFORE and GLYPH_AFTER. */ 14294 GLYPH_BEFORE and GLYPH_AFTER. */
14294 if (!((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end) 14295 if (!((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
14295 && BUFFERP (glyph->object) && glyph->charpos == pt_old) 14296 && BUFFERP (glyph->object) && glyph->charpos == pt_old)
14296 && bpos_covered < pt_old) 14297 && !(bpos_max < pt_old && pt_old <= bpos_covered))
14297 { 14298 {
14298 /* An empty line has a single glyph whose OBJECT is zero and 14299 /* An empty line has a single glyph whose OBJECT is zero and
14299 whose CHARPOS is the position of a newline on that line. 14300 whose CHARPOS is the position of a newline on that line.
@@ -27936,12 +27937,6 @@ note_mouse_highlight (struct frame *f, int x, int y)
27936 if (hlinfo->mouse_face_defer) 27937 if (hlinfo->mouse_face_defer)
27937 return; 27938 return;
27938 27939
27939 if (gc_in_progress)
27940 {
27941 hlinfo->mouse_face_deferred_gc = 1;
27942 return;
27943 }
27944
27945 /* Which window is that in? */ 27940 /* Which window is that in? */
27946 window = window_from_coordinates (f, x, y, &part, 1); 27941 window = window_from_coordinates (f, x, y, &part, 1);
27947 27942
diff --git a/src/xftfont.c b/src/xftfont.c
index 372ed87705f..181a1da9b38 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -369,7 +369,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
369 ASET (font_object, FONT_FORMAT_INDEX, 369 ASET (font_object, FONT_FORMAT_INDEX,
370 ftfont_font_format (xftfont->pattern, filename)); 370 ftfont_font_format (xftfont->pattern, filename));
371 font = XFONT_OBJECT (font_object); 371 font = XFONT_OBJECT (font_object);
372 font->pixel_size = pixel_size; 372 font->pixel_size = size;
373 font->driver = &xftfont_driver; 373 font->driver = &xftfont_driver;
374 font->encoding_charset = font->repertory_charset = -1; 374 font->encoding_charset = font->repertory_charset = -1;
375 375
@@ -387,8 +387,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
387 xftfont_info->matrix.xy = 0x10000L * matrix->xy; 387 xftfont_info->matrix.xy = 0x10000L * matrix->xy;
388 xftfont_info->matrix.yx = 0x10000L * matrix->yx; 388 xftfont_info->matrix.yx = 0x10000L * matrix->yx;
389 } 389 }
390 font->pixel_size = size;
391 font->driver = &xftfont_driver;
392 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))) 390 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
393 spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); 391 spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
394 else 392 else
diff --git a/src/xterm.c b/src/xterm.c
index ef0b2267dcd..b5b8f03da48 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -672,21 +672,7 @@ static void
672XTframe_up_to_date (struct frame *f) 672XTframe_up_to_date (struct frame *f)
673{ 673{
674 if (FRAME_X_P (f)) 674 if (FRAME_X_P (f))
675 { 675 FRAME_MOUSE_UPDATE (f);
676 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
677
678 if (hlinfo->mouse_face_deferred_gc
679 || f == hlinfo->mouse_face_mouse_frame)
680 {
681 block_input ();
682 if (hlinfo->mouse_face_mouse_frame)
683 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
684 hlinfo->mouse_face_mouse_x,
685 hlinfo->mouse_face_mouse_y);
686 hlinfo->mouse_face_deferred_gc = 0;
687 unblock_input ();
688 }
689 }
690} 676}
691 677
692 678
@@ -9516,7 +9502,6 @@ x_free_frame_resources (struct frame *f)
9516 hlinfo->mouse_face_end_row 9502 hlinfo->mouse_face_end_row
9517 = hlinfo->mouse_face_end_col = -1; 9503 = hlinfo->mouse_face_end_col = -1;
9518 hlinfo->mouse_face_window = Qnil; 9504 hlinfo->mouse_face_window = Qnil;
9519 hlinfo->mouse_face_deferred_gc = 0;
9520 hlinfo->mouse_face_mouse_frame = 0; 9505 hlinfo->mouse_face_mouse_frame = 0;
9521 } 9506 }
9522 9507
@@ -10171,7 +10156,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10171 dpyinfo->bitmaps_last = 0; 10156 dpyinfo->bitmaps_last = 0;
10172 dpyinfo->scratch_cursor_gc = 0; 10157 dpyinfo->scratch_cursor_gc = 0;
10173 hlinfo->mouse_face_mouse_frame = 0; 10158 hlinfo->mouse_face_mouse_frame = 0;
10174 hlinfo->mouse_face_deferred_gc = 0;
10175 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 10159 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10176 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 10160 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10177 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; 10161 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
diff --git a/src/xterm.h b/src/xterm.h
index 6ef3d11fe48..d63ed1c4583 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -506,12 +506,6 @@ struct x_output
506 value contains an ID of the fontset, else -1. */ 506 value contains an ID of the fontset, else -1. */
507 int fontset; 507 int fontset;
508 508
509 /* Pixel values used for various purposes.
510 border_pixel may be -1 meaning use a gray tile. */
511#if 0 /* These are also defined in struct frame. Use that instead. */
512 unsigned long background_pixel;
513 unsigned long foreground_pixel;
514#endif
515 unsigned long cursor_pixel; 509 unsigned long cursor_pixel;
516 unsigned long border_pixel; 510 unsigned long border_pixel;
517 unsigned long mouse_pixel; 511 unsigned long mouse_pixel;
@@ -574,13 +568,13 @@ struct x_output
574 568
575 /* Nonzero means our parent is another application's window 569 /* Nonzero means our parent is another application's window
576 and was explicitly specified. */ 570 and was explicitly specified. */
577 char explicit_parent; 571 unsigned explicit_parent : 1;
578 572
579 /* Nonzero means tried already to make this frame visible. */ 573 /* Nonzero means tried already to make this frame visible. */
580 char asked_for_visible; 574 unsigned asked_for_visible : 1;
581 575
582 /* Nonzero if this frame was ever previously visible. */ 576 /* Nonzero if this frame was ever previously visible. */
583 char has_been_visible; 577 unsigned has_been_visible : 1;
584 578
585#ifdef HAVE_X_I18N 579#ifdef HAVE_X_I18N
586 /* Input context (currently, this means Compose key handler setup). */ 580 /* Input context (currently, this means Compose key handler setup). */
@@ -634,7 +628,7 @@ struct x_output
634 int top_before_move; 628 int top_before_move;
635 629
636 /* Non-zero if _NET_WM_STATE_HIDDEN is set for this frame. */ 630 /* Non-zero if _NET_WM_STATE_HIDDEN is set for this frame. */
637 int net_wm_state_hidden_seen; 631 unsigned net_wm_state_hidden_seen : 1;
638}; 632};
639 633
640#define No_Cursor (None) 634#define No_Cursor (None)