aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-02-03 23:28:36 +0000
committerKaroly Lorentey2005-02-03 23:28:36 +0000
commit597cfb3fbc57114062f12dfdfa37c0157fff1e97 (patch)
treedea42300f641805b707eb9a64035acac8c9f547e /src
parentfd41924555942f6c3c1e12400ab313717a3818cd (diff)
parent4e07258f2b539fa9a3ba97442e81e3e67a9ce5a7 (diff)
downloademacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.tar.gz
emacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.zip
Merged in changes from CVS trunk. (Long time no see!) :-)
Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-1 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-2 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-7 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-8 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-9 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-10 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-14 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-15 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-19 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-20 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-24 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-25 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-26 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-27 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-28 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-29 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-30 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-31 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-32 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-38 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-41 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-47 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-50 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-52 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-53 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-54 Update from CVS: lisp/cus-start.el (all): Add `undo-outer-limit'. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-55 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-56 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-57 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-58 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-59 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-60 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-61 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-62 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-63 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-64 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-65 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-66 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-67 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-68 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-69 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-70 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-71 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-72 src/dispextern.h (xassert): Enable unconditionally. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-73 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-74 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-75 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-4 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-5 Update from CVS: exi/gnus-faq.texi ([4.1]): Typo. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-6 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-7 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-8 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-9 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-10 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-11 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-281
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit15
-rw-r--r--src/ChangeLog618
-rw-r--r--src/alloc.c54
-rw-r--r--src/buffer.c9
-rw-r--r--src/casefiddle.c87
-rw-r--r--src/casetab.c2
-rw-r--r--src/coding.c2
-rw-r--r--src/config.in3
-rw-r--r--src/dispextern.h25
-rw-r--r--src/dispnew.c16
-rw-r--r--src/editfns.c29
-rw-r--r--src/emacs.c15
-rw-r--r--src/fileio.c6
-rw-r--r--src/fns.c10
-rw-r--r--src/fringe.c39
-rw-r--r--src/gtkutil.c35
-rw-r--r--src/indent.c13
-rw-r--r--src/insdel.c16
-rw-r--r--src/keyboard.c117
-rw-r--r--src/keymap.c19
-rw-r--r--src/lisp.h3
-rw-r--r--src/macfns.c97
-rw-r--r--src/macgui.h7
-rw-r--r--src/macterm.c352
-rw-r--r--src/macterm.h2
-rw-r--r--src/process.c14
-rw-r--r--src/s/darwin.h12
-rw-r--r--src/term.c4
-rw-r--r--src/undo.c44
-rw-r--r--src/w32bdf.c5
-rw-r--r--src/w32fns.c21
-rw-r--r--src/w32term.c50
-rw-r--r--src/window.c105
-rw-r--r--src/xdisp.c567
-rw-r--r--src/xfaces.c63
-rw-r--r--src/xfns.c8
-rw-r--r--src/xmenu.c14
-rw-r--r--src/xselect.c10
-rw-r--r--src/xterm.c91
-rw-r--r--src/xterm.h2
40 files changed, 1924 insertions, 677 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index ad6be09ec46..358774f5bec 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -35,20 +35,23 @@ handle 2 noprint pass
35# debugging. 35# debugging.
36handle SIGALRM ignore 36handle SIGALRM ignore
37 37
38# Set up a mask to use. 38# $valmask and $tagmask are mask values set up by the xreload macro below.
39# This should be EMACS_INT, but in some cases that is a macro.
40# long ought to work in all cases right now.
41 39
40# Use $bugfix so that the value isn't a constant.
41# Using a constant runs into GDB bugs sometimes.
42define xgetptr 42define xgetptr
43 set $ptr = (gdb_use_union ? $arg0.u.val : $arg0 & $valmask) | gdb_data_seg_bits 43 set $bugfix = $arg0
44 set $ptr = (gdb_use_union ? $bugfix.u.val : $bugfix & $valmask) | gdb_data_seg_bits
44end 45end
45 46
46define xgetint 47define xgetint
47 set $int = gdb_use_union ? $arg0.s.val : (gdb_use_lsb ? $arg0 : $arg0 << gdb_gctypebits) >> gdb_gctypebits 48 set $bugfix = $arg0
49 set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits
48end 50end
49 51
50define xgettype 52define xgettype
51 set $type = gdb_use_union ? $arg0.s.type : (enum Lisp_Type) (gdb_use_lsb ? $arg0 & $tagmask : $arg0 >> gdb_valbits) 53 set $bugfix = $arg0
54 set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
52end 55end
53 56
54# Set up something to print out s-expressions. 57# Set up something to print out s-expressions.
diff --git a/src/ChangeLog b/src/ChangeLog
index 494f45f9af8..6dd4211364f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,526 @@
12005-02-03 Richard M. Stallman <rms@gnu.org>
2
3 * xterm.c (x_error_quitter): On GCC 3 and up, specify noinline.
4
5 * xdisp.c (echo_area_display): Clear echo_message_buffer.
6
7 * buffer.c (Fbury_buffer): Doc fix.
8
92005-02-02 Steven Tamm <steventamm@mac.com>
10
11 * macfns.c (unwind_create_frame): Fixing compile error due to
12 xassert being uncondition, but predicate is.
13 * dispnew.c (update_window): Fixing compile error due to
14 xassert being uncondition, but predicate is.
15
162005-02-02 Miles Bader <miles@gnu.org>
17
18 * dispextern.h (xassert): Enable unconditionally.
19
202005-02-02 Kim F. Storm <storm@cua.dk>
21
22 * undo.c (Fprimitive_undo): Fix dummy apply undo entry.
23
242005-02-02 Kenichi Handa <handa@m17n.org>
25
26 * casefiddle.c (casify_object): Enable changing characters of
27 different byte length.
28 (casify_region): Fix loop condition, args to replace_range_2, and
29 update opoint_byte.
30
31 * insdel.c (replace_range_2): Fix bugs in adjusting markers and
32 point.
33
342005-02-01 Kim F. Storm <storm@cua.dk>
35
36 * xdisp.c (back_to_previous_visible_line_start): Reset iterator
37 stack before calling handle_display_prop.
38
392005-01-31 Kim F. Storm <storm@cua.dk>
40
41 * undo.c (Qapply): New lisp var.
42 (syms_of_undo): Intern and staticpro it.
43 (Fprimitive_undo): Support formats (apply FUNNAME . ARGS) and
44 (apply DELTA BEG END FUNNAME . ARGS) instead of (FUNNAME . ARGS).
45
46 * buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
47
482005-01-30 Jesper Harder <harder@phys.au.dk>
49
50 * macterm.c (syms_of_macterm) <mac-reverse-ctrl-meta>
51 <mac-emulate-three-button-mouse>: Fix docstring indentation.
52
532005-01-29 Luc Teirlinck <teirllm@auburn.edu>
54
55 * undo.c (syms_of_undo) <undo-outer-limit>: Doc update.
56 Increase value to 3 Meg.
57
582005-01-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
59
60 * xfns.c (show_hourglass): Use FRAME_X_WINDOW as parent for GTK,
61 button events are not received otherwise.
62
632005-01-29 Richard M. Stallman <rms@gnu.org>
64
65 * buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
66
67 * undo.c (Fprimitive_undo): Handle (FUNNAME . ARGS) by calling FUNNAME.
68
692005-01-28 Stefan Monnier <monnier@iro.umontreal.ca>
70
71 * keymap.c (access_keymap): YAILOM.
72
732005-01-27 Kim F. Storm <storm@cua.dk>
74
75 * xdisp.c (get_phys_cursor_geometry): New function to calculate
76 phys cursor position and size for hollow cursor. Position is
77 aligned with get_glyph_string_clip_rect and ensures that a hollow
78 cursor is shown, even when the actual glyph is not visible.
79
80 * dispextern.h (get_phys_cursor_geometry): Add prototype.
81
82 * xterm.c (x_clip_to_row): Ensure y >= 0.
83 (x_draw_hollow_cursor): Use get_phys_cursor_geometry.
84
85 * w32term.c (x_draw_hollow_cursor): Use get_phys_cursor_geometry.
86
87 * macterm.c (x_draw_hollow_cursor): Use get_phys_cursor_geometry.
88
892005-01-27 Stefan Monnier <monnier@iro.umontreal.ca>
90
91 * xterm.c (x_error_quitter): Add a prototype. Make it static again.
92
932005-01-27 Kim F. Storm <storm@cua.dk>
94
95 * xdisp.c (get_glyph_string_clip_rect): Always show a cursor
96 glyph, even when row is only partially visible and actual cursor
97 position is not visible.
98
992005-01-24 Richard M. Stallman <rms@gnu.org>
100
101 * xterm.c (x_error_quitter): No longer static, and moved after
102 x_error_handler.
103
1042005-01-24 Kim F. Storm <storm@cua.dk>
105
106 * xdisp.c (move_it_by_lines): If we move forward after going too
107 far back, cancel move if end position is same as start position.
108
1092005-01-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
110
111 * dispextern.h (struct glyph_string): New members clip_head and
112 clip_tail.
113
114 * xdisp.c (get_glyph_string_clip_rect): Restrict horizontal clip
115 region to the area between clip_head and clip_tail.
116 (draw_glyphs): Record the area that need to be actually redrawn to
117 the new variables clip_head and clip_tail when there are
118 overhangs. Set values of these variables to the corresponding
119 members in struct glyph_string. Refine x coordinates for
120 notice_overwritten_cursor using clip_head and clip_tail.
121
122 * macgui.h (STORE_XCHARSETSTRUCT): New macro.
123
124 * macterm.c (mac_compute_glyph_string_overhangs): Implement with
125 QDTextBounds.
126 (x_draw_glyph_string): Don't fill the background of the successor
127 of a glyph with a right overhang if the successor will draw a cursor.
128 (XLoadQueryFont): Obtain font metrics using QDTextBounds.
129 (x_redisplay_interface): Add entry for compute_glyph_string_overhangs.
130
1312005-01-24 Kim F. Storm <storm@cua.dk>
132
133 * window.c (window_scroll_pixel_based): Fix scrolling in the wrong
134 direction if window height was smaller than next-screen-context-lines.
135 Now always scroll at least one line in the requested direction.
136 Ensure that we actually do scroll backwards when requested to do so.
137
138 * xdisp.c (redisplay_window): Only try to make cursor line fully
139 visible once (to avoid redisplay loop).
140
1412005-01-23 Kim F. Storm <storm@cua.dk>
142
143 * window.c (Fpos_visible_in_window_p): Simplify return value for
144 partially visible rows.
145 (window_scroll_pixel_based): Adapt to that change.
146
147 * window.c (window_scroll_pixel_based): Force moving to next line
148 if scrolling doesn't move start point, e.g. if looking at tall image.
149
150 * xdisp.c (pos_visible_p): Return 0 if non-interactive.
151 Clear last_height before calling line_bottom_y to get real height.
152 Fix calculation of y.
153
1542005-01-22 Steven Tamm <steventamm@mac.com>
155
156 * s/darwin.h: Removed PTY_ITERATION from here.
157 (DARWIN): Define.
158 * process.c (init_process): Default process-connection-type to
159 nil on darwin 6 or less, t if it is 7 or higher. This way the
160 broken pty behavior is still allowed on darwin 6 for interactive
161 processes for people that know what they are doing.
162
1632005-01-22 Kim F. Storm <storm@cua.dk>
164
165 * window.c (auto_window_vscroll_p): New boolean.
166 (syms_of_window): DEFVAR_BOOL it.
167 (Fpos_visible_in_window_p): Extend return value to include RTOP
168 and RBOT values if FULLY is nil.
169 (window_scroll_pixel_based): Adjust vscroll for partially visible
170 rows if auto_window_vscroll_p is set.
171 (Fset_window_vscroll): Do nothing if vscroll is not modified.
172
173 * xdisp.c (pos_visible_p): Replace FULLY arg by RTOP and RBOT args
174 to return number of partially invisible pixels at top and bottom
175 of the dislay row at POS.
176
177 * lisp.h (pos_visible_p): Fix prototype.
178
1792005-01-21 Richard M. Stallman <rms@gnu.org>
180
181 * fileio.c (Fcopy_file): Doc fix.
182
1832005-01-21 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
184
185 * gtkutil.c (xg_tool_bar_detach_callback): Remove unused variable bw.
186 (xg_get_file_name): Move declaration ofx_use_old_gtk_file_dialog to
187 start of function for older compilers.
188
1892005-01-20 Richard M. Stallman <rms@gnu.org>
190
191 * editfns.c (Fmessage): If arg is "", return "" (as before).
192
193 * keymap.c (access_keymap): Protect from bad value of meta_prefix_char.
194
195 * .gdbinit (xgetptr, xgetint, xgettype): Copy $arg0 into a temp
196 variable.
197
1982005-01-20 Steven Tamm <steventamm@mac.com>
199
200 * editfns.c (Voperating_system_release): Add.
201 (init_editfns): Assign new variable operating-system-release
202 based on call to uname if available.
203 (get_operating_system_release): Add function to
204 allow c-level access to operating system release.
205
206 * config.h: Regenerated.
207
208 * s/darwin.h (PTY_ITERATION): Don't allow PTYs on darwin 6 or less.
209 (MIN_PTY_KERNEL_VERSION): Define minimum kernel version for
210 using ptys as '7'.
211
2122005-01-20 Kim F. Storm <storm@cua.dk>
213
214 * alloc.c (STRING_MARKED_P, VECTOR_MARKED_P): Return boolean.
215
216 * xterm.c (x_draw_glyph_string_box): Fix last_x for full width rows.
217 Thanks to Chong Yidong <cyd@stupidchicken.com> for debugging this.
218
219 * macterm.c (x_draw_glyph_string_box): Likewise.
220
221 * w32term.c (x_draw_glyph_string_box): Likewise.
222
223 * indent.c (Fvertical_motion): Temporarily disable selective display.
224
2252005-01-19 Kim F. Storm <storm@cua.dk>
226
227 * xdisp.c (note_mode_line_or_margin_highlight): Fix :pointer
228 image property.
229
230 * fns.c (sweep_weak_table): Advance prev pointer when we keep a pair.
231
2322005-01-18 Kim F. Storm <storm@cua.dk>
233
234 * xdisp.c (fast_find_position): Backtrack to find first row if
235 charpos is inside a display overlay that spans multiple lines.
236
2372005-01-18 Kenichi Handa <handa@m17n.org>
238
239 * coding.c (decode_coding_iso2022): Translate invalid codes if
240 translation-table is specified.
241
2422005-01-18 Kim F. Storm <storm@cua.dk>
243
244 * xdisp.c (back_to_previous_visible_line_start): Undo 2004-12-28
245 change. If handle_display_prop indicates newline is replaced by
246 image or text, move back to start of relevant overlay or interval
247 and continue scan from there. Simplify.
248
2492005-01-17 Kim F. Storm <storm@cua.dk>
250
251 * dispnew.c (mode_line_string, marginal_area_string):
252 Fix off-by-one error in search for glyph.
253
2542005-01-16 Kim F. Storm <storm@cua.dk>
255
256 * macterm.c (syms_of_macterm) <mac-allow-anti-aliasing>: Doc fix.
257
2582005-01-16 Steven Tamm <steventamm@mac.com>
259
260 * macterm.c (mac_to_x_fontname): Remove spurious argument.
261
2622005-01-16 Andreas Schwab <schwab@suse.de>
263
264 * macterm.c (mac_draw_string_common): Fix compilation on OSX 10.1.
265
2662005-01-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
267
268 * fringe.c (Fdefine_fringe_bitmap, init_fringe): When assigning
269 fringe_faces, cast result from xmalloc/xrealloc to Lisp_Object *.
270
2712005-01-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
272
273 * keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)
274 (READABLE_EVENTS_FILTER_EVENTS, READABLE_EVENTS_IGNORE_SQUEEZABLES):
275 New flags for readable_events.
276 (get_filtered_input_pending, readable_filtered_events): Remove.
277 (tracking_off): Call readable_events and get_input_pending with
278 flag READABLE_EVENTS_DO_TIMERS_NOW.
279 (readable_events): Move code from old readable_filtered_events here,
280 but check new READABLE_EVENTS_* in argument flags instead of previous
281 two boolean arguments do_timers_now and filter_events.
282 If we are doing mouse tracking and the mouse moved, return only if
283 READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags.
284 (swallow_events): Call get_input_pending with flag
285 READABLE_EVENTS_DO_TIMERS_NOW.
286 (get_input_pending): Move code from old get_filtered_input_pending
287 here. Replace boolean arguments do_timers_now, filter_events with
288 flags, and pass flags to readable_events. Document new
289 READABLE_EVENTS_* flags.
290 (detect_input_pending_ignore_squeezables): New function.
291 (detect_input_pending_run_timers): Call get_input_pending with flag
292 READABLE_EVENTS_DO_TIMERS_NOW.
293 (Finput_pending_p): Call get_input_pending with flags
294 READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS.
295
296 * dispnew.c (update_window, update_frame_1): Replace calls to
297 detect_input_pending with detect_input_pending_ignore_squeezables
298 so that redisplay is not paused if the event queue contains only
299 mouse movements.
300
301 * lisp.h: Declare detect_input_pending_ignore_squeezables.
302
3032005-01-15 Steven Tamm <steventamm@mac.com>
304
305 * macterm.c (Vmac_use_core_graphics): Declare variable for
306 mac-allow-anti-aliasing.
307 (syms_of_macterm): DEFVAR_LISP and initialize it.
308 (mac_draw_string_common): Use core graphics text rendering if
309 mac-allow-anti-aliasing is enabled.
310
311 * macfns.c (Fx_file_dialog): Save As dialog includes only the
312 file name in the text box.
313
3142005-01-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
315
316 * macfns.c (x_set_foreground_color, x_set_background_color):
317 Sync with xfns.c.
318 (mac_window, x_create_tip_frame): Use XSetWindowBackground.
319 * macterm.c (XSetBackground, XSetWindowBackground): New functions.
320 * macterm.h (XSetBackground, XSetWindowBackground): Add externs.
321
3222005-01-14 Kim F. Storm <storm@cua.dk>
323
324 * keyboard.c (Fposn_at_x_y): Add optional arg WHOLE.
325
3262005-01-13 Richard M. Stallman <rms@gnu.org>
327
328 * keymap.c (Fcurrent_active_maps): Ignore Voverriding_local_map
329 if Voverriding_terminal_local_map is non-nil.
330
331 * keyboard.c (syms_of_keyboard): Doc fix.
332
3332005-01-13 Kim F. Storm <storm@cua.dk>
334
335 * xdisp.c (Fformat_mode_line): Fix last change. Remove NO_PROPS arg
336 (specify 0 for FACE instead). Reorder arg list. Doc fix.
337
3382005-01-12 Richard M. Stallman <rms@gnu.org>
339
340 * xdisp.c (Fformat_mode_line): New arg FACE specifies a default
341 face property for characters that don't specify one.
342
343 * fns.c (Frequire): Record in load-history unconditionally.
344
3452005-01-10 Kim F. Storm <storm@cua.dk>
346
347 * dispextern.h (merge_faces): Rename from merge_into_realized_face.
348
349 * xfaces.c (merge_faces): Rename from merge_into_realized_face.
350 Callers changed.
351 Add support to merge with lisp face id too (if face_name is t).
352
353 * xdisp.c (get_next_display_element, next_element_from_display_vector):
354 Don't lookup lface_id from display table glyphs here; instead use
355 merge_faces to merge the lisp face id into current face.
356
3572005-01-09 Kim F. Storm <storm@cua.dk>
358
359 * dispextern.h (struct it): New member dpvec_face_id.
360 (merge_into_realized_face): Add prototype.
361
362 * xfaces.c (merge_into_realized_face): New function. Used to
363 merge escape-glyph face or face from display table into current face.
364
365 * xdisp.c (Vshow_nonbreak_escape): New lisp var.
366 (syms_of_xdisp): DEFVAR_LISP it.
367 (escape_glyph_face): Remove var.
368 (redisplay_window): Don't initialize it.
369 (setup_for_ellipsis, get_next_display_element):
370 Set it->dpvec_face_id to -1.
371 (get_next_display_element): Test Vshow_nonbreak_escape.
372 Do not setup escape_glyph_face.
373 Properly merge escape-glyph face or face from display table with
374 current face for escape and control characters.
375 Set it->dpvec_face_id to relevant face id instead of adding it to each
376 element of display vector.
377 (next_element_from_display_vector): If it->dpvec_face_id is set,
378 use that instead of lface_id from glyph itself.
379
3802005-01-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
381
382 * xterm.h (struct x_output): New member, toolbar_detached.
383
384 * gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to
385 38.
386 (xg_tool_bar_detach_callback): Set toolbar_detached to 1.
387 (xg_tool_bar_attach_callback): Set toolbar_detached to 0.
388 (xg_create_tool_bar): Initialize toolbar_detached.
389 (update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if
390 toolbar_detached is zero.
391
3922005-01-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
393
394 * xmenu.c (create_and_show_popup_menu): Pass zero as button to
395 gtk_menu_popup if not for_click, so callbacks for the menu are called.
396
397 * gtkutil.c (xg_gtk_scroll_destroy, xg_create_scroll_bar)
398 (xg_tool_bar_callback, xg_tool_bar_help_callback)
399 (update_frame_tool_bar): Cast to EMACS_INT to avoid compiler warning.
400
401 * xselect.c (x_get_foreign_selection, x_fill_property_data)
402 (Fx_get_atom_name, Fx_send_client_event): Replace XFLOAT with
403 XFLOAT_DATA to get extract number from Lisp object.
404
4052005-01-07 Kim F. Storm <storm@cua.dk>
406
407 * xdisp.c (set_iterator_to_next): Fix 2004-12-13 change.
408 Set stop_charpos to current charpos instead of 0.
409
4102005-01-06 Nick Roberts <nickrob@snap.net.nz>
411
412 * xdisp.c (Fformat_mode_line): First arg now required.
413
4142005-01-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
415
416 * macterm.c (XLoadQueryFont): Correctly handle 0 size
417 font widths that are returned from some Japanese fonts.
418
4192005-01-06 Kim F. Storm <storm@cua.dk>
420
421 * fringe.c (fringe_faces): Change to Lisp_Object pointer.
422 (draw_fringe_bitmap_1): Lookup user defined fringe faces here.
423 (destroy_fringe_bitmap): Set fringe_faces element to nil.
424 (Fdefine_fringe_bitmap, init_fringe): Change allocation of
425 fringe_faces array and init elements to nil.
426 (Fset_fringe_bitmap_face): Set fringe_faces to face name instead of
427 non-persistent face id.
428 (mark_fringe_data): New function for GC.
429
430 * alloc.c (mark_fringe_data): Declare extern.
431 (Fgarbage_collect): Call mark_fringe_data.
432
433 * alloc.c (overrun_check_free): Invalidate freed memory if
434 XMALLOC_CLEAR_FREE_MEMORY is defined.
435
4362005-01-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
437
438 * macfns.c: Include sys/param.h.
439 [TARGET_API_MAC_CARBON] (mac_nav_event_callback): New declaration
440 and function.
441 [TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size
442 of filename string. Set event callback function when creating
443 dialog boxes. Add code conversions for filenames. Don't dispose
444 apple event descriptor record if failed to create it.
445
446 * macterm.c: Include sys/param.h.
447 [USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for
448 kEventWindowUpdate.
449 (install_window_handler) [USE_CARBON_EVENTS]: Register it.
450 (do_ae_open_documents) [TARGET_API_MAC_CARBON]: Get FSRef instead
451 of FSSpec from apple event descriptor record.
452 (do_ae_open_documents) [TARGET_API_MAC_CARBON]: Use MAXPATHLEN for
453 size of filename string.
454 [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Likewise.
455 [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Return error when a
456 file dialog is in action.
457 [TARGET_API_MAC_CARBON] (mac_do_track_drag): Likewise.
458 Reject only when there are no filename items. Set background color
459 before (un)highlighting the window below the dragged items.
460 (XTread_socket) [!USE_CARBON_EVENTS]: Don't call do_window_update.
461
4622005-01-05 Romain Francoise <romain@orebokech.com>
463
464 * term.c (encode_terminal_code): Fix buffer size computation.
465
4662005-01-04 Richard M. Stallman <rms@gnu.org>
467
468 * xdisp.c (Fformat_mode_line): Doc fix.
469
4702005-01-04 Stefan Monnier <monnier@iro.umontreal.ca>
471
472 * alloc.c (refill_memory_reserve): Move.
473 (emacs_blocked_free, emacs_blocked_malloc, emacs_blocked_realloc)
474 (reset_malloc_hooks, uninterrupt_malloc) [SYNC_INPUT]: Don't define.
475
4762005-01-03 Richard M. Stallman <rms@gnu.org>
477
478 * window.c (window_scroll_pixel_based): Don't correct preserve_y
479 for CURRENT_HEADER_LINE_HEIGHT when moving backwards.
480
4812005-01-03 Jason Rumney <jasonr@gnu.org>
482
483 * w32bdf.c (w32_load_bdf_font): Set fontp->average_width and
484 fontp->space_width to FONT_WIDTH so they are valid.
485
486 * w32fns.c (w32_load_system_font): Set FONT_WIDTH to maximum, not
487 average width. Set fontp->average_width and fontp->space_width to
488 their appropriate values.
489
490 * w32term.c (x_new_font): Set FRAME_COLUMN_WIDTH to
491 fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to
492 fontp->space_width.
493
4942005-01-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
495
496 * macterm.c (x_new_font): Set FRAME_SPACE_WIDTH.
497 (x_font_min_bounds, XLoadQueryFont): Use the correct font width
498 metrics for max and min bounds.
499 (x_load_font): Correctly calculate average font width metrics.
500
5012005-01-02 Richard M. Stallman <rms@gnu.org>
502
503 * alloc.c (Fgarbage_collect): Don't truncate_undo_list on dead buffers.
504
12004-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 5052004-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 506
3 * xterm.c (handle_one_xevent): Clear area in expose event for GTK. 507 * xterm.c (handle_one_xevent): Clear area in expose event for GTK.
4 508
52004-12-31 Richard M. Stallman <rms@gnu.org> 5092004-12-31 Richard M. Stallman <rms@gnu.org>
6 510
511 * xdisp.c (setup_for_ellipsis, get_next_display_element):
512 Set it->ellipsis_p to 1 or 0.
513 (display_line): Record whether row ends in mid-ellipsis.
514 (set_cursor_from_row): If ends in ellipsis. find start of it.
515 (cursor_row_p): If PT's at the end of the ellipsis the row
516 ends within, don't display cursor on this row.
517
518 * dispextern.h (struct it): New element ellipsis_p.
519 (struct glyph_row): New element ends_in_ellipsis_p.
520
521 * xdisp.c (BUFFER_POS_REACHED_P): We haven't reached the specified
522 position if we're reading from something other than the buffer.
523
7 * window.c (window_scroll_pixel_based): Only look at 524 * window.c (window_scroll_pixel_based): Only look at
8 Vscroll_preserve_screen_position if the old PT can't be kept. 525 Vscroll_preserve_screen_position if the old PT can't be kept.
9 (syms_of_window) <scroll-preserve-screen-position>: Doc fix. 526 (syms_of_window) <scroll-preserve-screen-position>: Doc fix.
@@ -22,8 +539,7 @@
22 539
23 * fileio.c (Finsert_file_contents): Don't use 540 * fileio.c (Finsert_file_contents): Don't use
24 current_buffer->buffer_file_coding_system even if REPLACE is 541 current_buffer->buffer_file_coding_system even if REPLACE is
25 non-nil. Call Qafter_insert_file_set_coding with the second arg 542 non-nil. Call Qafter_insert_file_set_coding with the second arg VISIT.
26 VISIT.
27 543
28 * fontset.h (struct font_info): New members space_width and 544 * fontset.h (struct font_info): New members space_width and
29 average_width. 545 average_width.
@@ -35,9 +551,8 @@
35 551
36 * xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to 552 * xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to
37 fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to 553 fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to
38 fontp-?space_width.. 554 fontp->space_width.
39 (x_load_font): Calculate fontp->space_width and 555 (x_load_font): Calculate fontp->space_width and fontp->average_width.
40 fontp->average_width.
41 (x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH. 556 (x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH.
42 557
43 * xdisp.c (x_produce_glyphs): Calculate tab width by 558 * xdisp.c (x_produce_glyphs): Calculate tab width by
@@ -46,8 +561,7 @@
462004-12-29 Sanghyuk Suh <han9kin@mac.com> 5612004-12-29 Sanghyuk Suh <han9kin@mac.com>
47 562
48 * macterm.c (SelectionRange): Add Xcode position apple event struct. 563 * macterm.c (SelectionRange): Add Xcode position apple event struct.
49 (do_ae_open_documents): Handle Xcode-style file position open 564 (do_ae_open_documents): Handle Xcode-style file position open events.
50 events.
51 565
522004-12-29 Luc Teirlinck <teirllm@auburn.edu> 5662004-12-29 Luc Teirlinck <teirllm@auburn.edu>
53 567
@@ -73,11 +587,16 @@
73 init_mac_drag_n_drop. 587 init_mac_drag_n_drop.
74 (mac_do_track_drag): New function and declaration. 588 (mac_do_track_drag): New function and declaration.
75 (install_window_handler): Return OSErr value. 589 (install_window_handler): Return OSErr value.
76 (install_window_handler) [TARGET_API_MAC_CARBON]: Register 590 (install_window_handler) [TARGET_API_MAC_CARBON]:
77 handlers for tracking/receiving drag-and-drop items. 591 Register handlers for tracking/receiving drag-and-drop items.
78 (do_ae_open_documents): Generate unibyte strings for filenames. 592 (do_ae_open_documents): Generate unibyte strings for filenames.
79 (mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise. Reject 593<<<<<<< ChangeLog
80 only non-filename items. Set event modifiers. Set return value. 594 (mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise.
595 Reject only non-filename items. Set event modifiers and return value.
596=======
597 (mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise.
598 Reject only non-filename items. Set event modifiers, and return value.
599>>>>>>> 1.4187
81 600
822004-12-28 Dan Nicolaescu <dann@ics.uci.edu> 6012004-12-28 Dan Nicolaescu <dann@ics.uci.edu>
83 602
@@ -101,8 +620,8 @@
101 * xmenu.c (popup_get_selection): Only pop down dialogs 620 * xmenu.c (popup_get_selection): Only pop down dialogs
102 on C-g and Escape. 621 on C-g and Escape.
103 (popup_get_selection): Remove parameter down_on_keypress. 622 (popup_get_selection): Remove parameter down_on_keypress.
104 (create_and_show_popup_menu, create_and_show_dialog): Remove 623 (create_and_show_popup_menu, create_and_show_dialog):
105 parameter down_on_keypress to popup_get_selection. 624 Remove parameter down_on_keypress to popup_get_selection.
106 625
1072004-12-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 6262004-12-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
108 627
@@ -119,8 +638,8 @@
119 638
120 * frame.c (x_set_frame_parameters, x_report_frame_params) 639 * frame.c (x_set_frame_parameters, x_report_frame_params)
121 (x_set_fullscreen): Remove #ifndef HAVE_CARBON. 640 (x_set_fullscreen): Remove #ifndef HAVE_CARBON.
122 (x_set_border_width, Vdefault_frame_scroll_bars): Change 641 (x_set_border_width, Vdefault_frame_scroll_bars):
123 HAVE_CARBON to MAC_OS. 642 Change HAVE_CARBON to MAC_OS.
124 643
125 * image.c [MAC_OS]: Include sys/stat.h. 644 * image.c [MAC_OS]: Include sys/stat.h.
126 [MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and 645 [MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and
@@ -128,8 +647,7 @@
128 647
129 * mac.c [!MAC_OSX] (mac_wait_next_event): Add extern. 648 * mac.c [!MAC_OSX] (mac_wait_next_event): Add extern.
130 [!MAC_OSX] (select): Use mac_wait_next_event. 649 [!MAC_OSX] (select): Use mac_wait_next_event.
131 [!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to 650 [!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to Vexec_suffixes.
132 Vexec_suffixes.
133 [!MAC_OSX] (select, run_mac_command): Change `#ifdef 651 [!MAC_OSX] (select, run_mac_command): Change `#ifdef
134 TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. 652 TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'.
135 (mac_clear_font_name_table): Add extern. 653 (mac_clear_font_name_table): Add extern.
@@ -148,21 +666,19 @@
148 * macfns.c (mac_initialized): Remove extern. 666 * macfns.c (mac_initialized): Remove extern.
149 (stricmp): Put in #if 0. All callers changed to use xstricmp in 667 (stricmp): Put in #if 0. All callers changed to use xstricmp in
150 xfaces.c. 668 xfaces.c.
151 (strnicmp): Decrement `n' at the end of each loop, not the 669 (strnicmp): Decrement `n' at the end of each loop, not the beginning.
152 beginning. 670 (check_mac): Use the term "Mac native windows" instead of "Mac OS".
153 (check_mac): Use the term "Mac native windows" instead of "Mac
154 OS".
155 (check_x_display_info, x_display_info_for_name): Sync with xfns.c. 671 (check_x_display_info, x_display_info_for_name): Sync with xfns.c.
156 (mac_get_rdb_resource): New function (from w32reg.c). 672 (mac_get_rdb_resource): New function (from w32reg.c).
157 (x_get_string_resource): Use it. 673 (x_get_string_resource): Use it.
158 (install_window_handler): Add extern. 674 (install_window_handler): Add extern.
159 (mac_window): New function. 675 (mac_window): New function.
160 (Fx_create_frame): Use it instead of make_mac_frame. Set 676 (Fx_create_frame): Use it instead of make_mac_frame.
161 parameter for Qfullscreen. Call x_wm_set_size_hint. 677 Set parameter for Qfullscreen. Call x_wm_set_size_hint.
162 (Fx_open_connection, Fx_close_connection): New defuns. 678 (Fx_open_connection, Fx_close_connection): New defuns.
163 (syms_of_macfns): Defsubr them. 679 (syms_of_macfns): Defsubr them.
164 (x_create_tip_frame) [TARGET_API_MAC_CARBON]: Add 680 (x_create_tip_frame) [TARGET_API_MAC_CARBON]:
165 kWindowNoUpdatesAttribute to the window attribute. 681 Add kWindowNoUpdatesAttribute to the window attribute.
166 (x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow. 682 (x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow.
167 (x_create_tip_frame): Don't call ShowWindow. 683 (x_create_tip_frame): Don't call ShowWindow.
168 (Fx_show_tip): Call ShowWindow. 684 (Fx_show_tip): Call ShowWindow.
@@ -171,8 +687,7 @@
171 (mac_frame_parm_handlers): Set handlers for Qfullscreen. 687 (mac_frame_parm_handlers): Set handlers for Qfullscreen.
172 (syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0. 688 (syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0.
173 689
174 * macgui.h [!MAC_OSX]: Don't include Controls.h. Include 690 * macgui.h [!MAC_OSX]: Don't include Controls.h. Include Windows.h.
175 Windows.h.
176 (Window): Typedef to WindowPtr and move outside `#if 691 (Window): Typedef to WindowPtr and move outside `#if
177 TARGET_API_MAC_CARBON'. 692 TARGET_API_MAC_CARBON'.
178 (XSizeHints): New struct. 693 (XSizeHints): New struct.
@@ -191,8 +706,12 @@
191 (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window 706 (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window
192 if the position is neither user-specified nor program-specified. 707 if the position is neither user-specified nor program-specified.
193 (x_free_frame_resources): Free size_hints. 708 (x_free_frame_resources): Free size_hints.
194 (x_wm_set_size_hint): Allocate size_hints if needed. Set 709<<<<<<< ChangeLog
195 size_hints. 710 (x_wm_set_size_hint): Allocate size_hints if needed.
711 Set size_hints.
712=======
713 (x_wm_set_size_hint): Allocate size_hints if needed. Set size_hints.
714>>>>>>> 1.4187
196 (mac_clear_font_name_table): New function. 715 (mac_clear_font_name_table): New function.
197 (mac_do_list_fonts): Initialize font_name_table if needed. 716 (mac_do_list_fonts): Initialize font_name_table if needed.
198 (x_list_fonts): Don't initialize font_name_table. Add BLOCK_INPUT 717 (x_list_fonts): Don't initialize font_name_table. Add BLOCK_INPUT
@@ -206,8 +725,7 @@
206 (do_window_update): Add BeginUpdate/EndUpdate for the tooltip 725 (do_window_update): Add BeginUpdate/EndUpdate for the tooltip
207 window. Use UpdateControls. Get the rectangle that should be 726 window. Use UpdateControls. Get the rectangle that should be
208 updated and restrict the target of expose_frame to it. 727 updated and restrict the target of expose_frame to it.
209 (do_grow_window): Set minimum height/width according to 728 (do_grow_window): Set minimum height/width according to size_hints.
210 size_hints.
211 (do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow. 729 (do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow.
212 (do_zoom_window): Don't use x_set_window_size. 730 (do_zoom_window): Don't use x_set_window_size.
213 [USE_CARBON_EVENTS] (mac_handle_window_event): New function. 731 [USE_CARBON_EVENTS] (mac_handle_window_event): New function.
@@ -219,10 +737,10 @@
219 (XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event. 737 (XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event.
220 Update mouse_region when mouse is moved. 738 Update mouse_region when mouse is moved.
221 (make_mac_frame): Remove. 739 (make_mac_frame): Remove.
222 (make_mac_terminal_frame): Put in #ifdef MAC_OS8. Initialize 740 (make_mac_terminal_frame): Put in #ifdef MAC_OS8.
223 mouse pointer shapes. Change values of f->left_pos and 741 Initialize mouse pointer shapes. Change values of f->left_pos and
224 f->top_pos. Don't use make_mac_frame. Use NewCWindow. Don't 742 f->top_pos. Don't use make_mac_frame. Use NewCWindow.
225 call ShowWindow. 743 Don't call ShowWindow.
226 (mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from 744 (mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from
227 Vinvocation_name and Vsystem_name. 745 Vinvocation_name and Vsystem_name.
228 (mac_make_rdb): New function (from w32term.c). 746 (mac_make_rdb): New function (from w32term.c).
@@ -245,17 +763,21 @@
245 763
2462004-12-27 Richard M. Stallman <rms@gnu.org> 7642004-12-27 Richard M. Stallman <rms@gnu.org>
247 765
248 * buffer.c (Fbuffer_disable_undo): Deleted (moved to simple.el). 766<<<<<<< ChangeLog
767 * buffer.c (Fbuffer_disable_undo): Delete (moved to simple.el).
768=======
769 * buffer.c (Fbuffer_disable_undo): Delete (move to simple.el).
770>>>>>>> 1.4187
249 (syms_of_buffer): Don't defsubr it. 771 (syms_of_buffer): Don't defsubr it.
250 772
251 * process.c (list_processes_1): Set undo_list instead 773 * process.c (list_processes_1): Set undo_list instead
252 of calling Fbuffer_disable_undo. 774 of calling Fbuffer_disable_undo.
253 775
254 * xdisp.c (single_display_spec_string_p): Renamed from 776 * xdisp.c (single_display_spec_string_p): Rename from
255 single_display_prop_string_p. 777 single_display_prop_string_p.
256 (single_display_spec_intangible_p): Renamed from 778 (single_display_spec_intangible_p): Rename from
257 single_display_prop_intangible_p. 779 single_display_prop_intangible_p.
258 (handle_single_display_spec): Renamed from handle_single_display_prop. 780 (handle_single_display_spec): Rename from handle_single_display_prop.
259 Rewritten to be easier to understand. 781 Rewritten to be easier to understand.
260 782
261 Change in load-history format. Functions now get (defun . NAME), 783 Change in load-history format. Functions now get (defun . NAME),
@@ -285,6 +807,10 @@
285 * gtkutil.c (xg_initialize): Install bindings for C-g so that 807 * gtkutil.c (xg_initialize): Install bindings for C-g so that
286 dialogs and menus pop down. 808 dialogs and menus pop down.
287 809
8102004-12-27 Kenichi Handa <handa@m17n.org>
811
812 * coding.c (code_convert_region): Fix calculation of `ratio'.
813
2882004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 8142004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
289 815
290 * gtkutil.c (update_frame_tool_bar): Make the value of 816 * gtkutil.c (update_frame_tool_bar): Make the value of
@@ -335,7 +861,7 @@
335 861
336 * alloc.c (Fgarbage_collect): Update call to truncate_undo_list. 862 * alloc.c (Fgarbage_collect): Update call to truncate_undo_list.
337 Call that at the very start. 863 Call that at the very start.
338 (undo_limit, undo_strong_limit, undo_outer_limit): Moved to undo.c. 864 (undo_limit, undo_strong_limit, undo_outer_limit): Move to undo.c.
339 (syms_of_alloc): Don't define undo-limit, 865 (syms_of_alloc): Don't define undo-limit,
340 undo-strong-limit and undo-outer-limit here. 866 undo-strong-limit and undo-outer-limit here.
341 867
@@ -370,8 +896,8 @@
370 896
3712004-12-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 8972004-12-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
372 898
373 * macterm.c (endif, x_font_name_to_mac_font_name): Use 899 * macterm.c (endif, x_font_name_to_mac_font_name):
374 maccentraleurroman instead of maccentraleuropean 900 Use maccentraleurroman instead of maccentraleuropean
375 (mac_c_string_match, mac_do_list_fonts): Speed up font search by 901 (mac_c_string_match, mac_do_list_fonts): Speed up font search by
376 quickly finding a specific font without needing regexps. 902 quickly finding a specific font without needing regexps.
377 903
@@ -397,8 +923,8 @@
397 923
398 * sysdep.c (select_alarm): Call SIGNAL_THREAD_CHECK. 924 * sysdep.c (select_alarm): Call SIGNAL_THREAD_CHECK.
399 925
400 * process.c (send_process_trap, sigchld_handler): Call 926 * process.c (send_process_trap, sigchld_handler):
401 SIGNAL_THREAD_CHECK. 927 Call SIGNAL_THREAD_CHECK.
402 928
403 * data.c (arith_error): Call SIGNAL_THREAD_CHECK. 929 * data.c (arith_error): Call SIGNAL_THREAD_CHECK.
404 930
@@ -488,7 +1014,7 @@
488 1014
489 * alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC. 1015 * alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC.
490 1016
4912004-12-07 Stefan <monnier@iro.umontreal.ca> 10172004-12-07 Stefan Monnier <monnier@iro.umontreal.ca>
492 1018
493 * eval.c (init_eval_once): Increase max_specpdl_size to 1000. 1019 * eval.c (init_eval_once): Increase max_specpdl_size to 1000.
494 1020
@@ -1641,7 +2167,7 @@
1641 2167
1642 * window.c (Fspecial_display_p): Doc fix. 2168 * window.c (Fspecial_display_p): Doc fix.
1643 2169
16442004-10-15 Stefan <monnier@iro.umontreal.ca> 21702004-10-15 Stefan Monnier <monnier@iro.umontreal.ca>
1645 2171
1646 * doc.c (Fsubstitute_command_keys): Fix remap-handling. 2172 * doc.c (Fsubstitute_command_keys): Fix remap-handling.
1647 Don't ignore menus, because where-is-internal already does it for us. 2173 Don't ignore menus, because where-is-internal already does it for us.
diff --git a/src/alloc.c b/src/alloc.c
index eabbf5192f4..49fc69e7058 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -103,7 +103,7 @@ extern __malloc_size_t __malloc_extra_blocks;
103 that the backend handles concurrent access to malloc within its own threads 103 that the backend handles concurrent access to malloc within its own threads
104 but Emacs code running in the main thread is not included in that control). 104 but Emacs code running in the main thread is not included in that control).
105 105
106 When UNBLOCK_INPUT is called, revoke_input_signal may be called. If this 106 When UNBLOCK_INPUT is called, reinvoke_input_signal may be called. If this
107 happens in one of the backend threads we will have two threads that tries 107 happens in one of the backend threads we will have two threads that tries
108 to run Emacs code at once, and the code is not prepared for that. 108 to run Emacs code at once, and the code is not prepared for that.
109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ 109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
@@ -143,11 +143,11 @@ static __malloc_size_t bytes_used_when_full;
143 143
144#define MARK_STRING(S) ((S)->size |= ARRAY_MARK_FLAG) 144#define MARK_STRING(S) ((S)->size |= ARRAY_MARK_FLAG)
145#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG) 145#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG)
146#define STRING_MARKED_P(S) ((S)->size & ARRAY_MARK_FLAG) 146#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0)
147 147
148#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG) 148#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG)
149#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) 149#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG)
150#define VECTOR_MARKED_P(V) ((V)->size & ARRAY_MARK_FLAG) 150#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0)
151 151
152/* Value is the number of bytes/chars of S, a pointer to a struct 152/* Value is the number of bytes/chars of S, a pointer to a struct
153 Lisp_String. This must be used instead of STRING_BYTES (S) or 153 Lisp_String. This must be used instead of STRING_BYTES (S) or
@@ -310,6 +310,7 @@ static void mark_glyph_matrix P_ ((struct glyph_matrix *));
310static void mark_face_cache P_ ((struct face_cache *)); 310static void mark_face_cache P_ ((struct face_cache *));
311 311
312#ifdef HAVE_WINDOW_SYSTEM 312#ifdef HAVE_WINDOW_SYSTEM
313extern void mark_fringe_data P_ ((void));
313static void mark_image P_ ((struct image *)); 314static void mark_image P_ ((struct image *));
314static void mark_image_cache P_ ((struct frame *)); 315static void mark_image_cache P_ ((struct frame *));
315#endif /* HAVE_WINDOW_SYSTEM */ 316#endif /* HAVE_WINDOW_SYSTEM */
@@ -705,9 +706,14 @@ overrun_check_free (block)
705 val + osize, 706 val + osize,
706 XMALLOC_OVERRUN_CHECK_SIZE)) 707 XMALLOC_OVERRUN_CHECK_SIZE))
707 abort (); 708 abort ();
709#ifdef XMALLOC_CLEAR_FREE_MEMORY
710 val -= XMALLOC_OVERRUN_CHECK_SIZE;
711 memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
712#else
708 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); 713 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
709 val -= XMALLOC_OVERRUN_CHECK_SIZE; 714 val -= XMALLOC_OVERRUN_CHECK_SIZE;
710 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); 715 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
716#endif
711 } 717 }
712 718
713 free (val); 719 free (val);
@@ -1114,17 +1120,34 @@ allocate_buffer ()
1114} 1120}
1115 1121
1116 1122
1123#ifndef SYSTEM_MALLOC
1124
1125/* If we released our reserve (due to running out of memory),
1126 and we have a fair amount free once again,
1127 try to set aside another reserve in case we run out once more.
1128
1129 This is called when a relocatable block is freed in ralloc.c. */
1130
1131void
1132refill_memory_reserve ()
1133{
1134 if (spare_memory == 0)
1135 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1136}
1137
1138
1117/* Arranging to disable input signals while we're in malloc. 1139/* Arranging to disable input signals while we're in malloc.
1118 1140
1119 This only works with GNU malloc. To help out systems which can't 1141 This only works with GNU malloc. To help out systems which can't
1120 use GNU malloc, all the calls to malloc, realloc, and free 1142 use GNU malloc, all the calls to malloc, realloc, and free
1121 elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT 1143 elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
1122 pairs; unfortunately, we have no idea what C library functions 1144 pair; unfortunately, we have no idea what C library functions
1123 might call malloc, so we can't really protect them unless you're 1145 might call malloc, so we can't really protect them unless you're
1124 using GNU malloc. Fortunately, most of the major operating systems 1146 using GNU malloc. Fortunately, most of the major operating systems
1125 can use GNU malloc. */ 1147 can use GNU malloc. */
1126 1148
1127#ifndef SYSTEM_MALLOC 1149#ifndef SYNC_INPUT
1150
1128#ifndef DOUG_LEA_MALLOC 1151#ifndef DOUG_LEA_MALLOC
1129extern void * (*__malloc_hook) P_ ((size_t)); 1152extern void * (*__malloc_hook) P_ ((size_t));
1130extern void * (*__realloc_hook) P_ ((void *, size_t)); 1153extern void * (*__realloc_hook) P_ ((void *, size_t));
@@ -1183,20 +1206,6 @@ emacs_blocked_free (ptr)
1183} 1206}
1184 1207
1185 1208
1186/* If we released our reserve (due to running out of memory),
1187 and we have a fair amount free once again,
1188 try to set aside another reserve in case we run out once more.
1189
1190 This is called when a relocatable block is freed in ralloc.c. */
1191
1192void
1193refill_memory_reserve ()
1194{
1195 if (spare_memory == 0)
1196 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1197}
1198
1199
1200/* This function is the malloc hook that Emacs uses. */ 1209/* This function is the malloc hook that Emacs uses. */
1201 1210
1202static void * 1211static void *
@@ -1348,6 +1357,7 @@ uninterrupt_malloc ()
1348 __realloc_hook = emacs_blocked_realloc; 1357 __realloc_hook = emacs_blocked_realloc;
1349} 1358}
1350 1359
1360#endif /* not SYNC_INPUT */
1351#endif /* not SYSTEM_MALLOC */ 1361#endif /* not SYSTEM_MALLOC */
1352 1362
1353 1363
@@ -4684,7 +4694,7 @@ returns nil, because real GC can't be done. */)
4684 turned off in that buffer. Calling truncate_undo_list on 4694 turned off in that buffer. Calling truncate_undo_list on
4685 Qt tends to return NULL, which effectively turns undo back on. 4695 Qt tends to return NULL, which effectively turns undo back on.
4686 So don't call truncate_undo_list if undo_list is Qt. */ 4696 So don't call truncate_undo_list if undo_list is Qt. */
4687 if (! EQ (nextb->undo_list, Qt)) 4697 if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt))
4688 truncate_undo_list (nextb); 4698 truncate_undo_list (nextb);
4689 4699
4690 /* Shrink buffer gaps, but skip indirect and dead buffers. */ 4700 /* Shrink buffer gaps, but skip indirect and dead buffers. */
@@ -4797,6 +4807,10 @@ returns nil, because real GC can't be done. */)
4797 } 4807 }
4798 mark_backtrace (); 4808 mark_backtrace ();
4799 4809
4810#ifdef HAVE_WINDOW_SYSTEM
4811 mark_fringe_data ();
4812#endif
4813
4800#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES 4814#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4801 mark_stack (); 4815 mark_stack ();
4802#endif 4816#endif
diff --git a/src/buffer.c b/src/buffer.c
index b3bcb68c281..ae390ba7500 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1952,6 +1952,7 @@ DEFUN ("bury-buffer", Fbury_buffer, Sbury_buffer, 0, 1, "",
1952 doc: /* Put BUFFER at the end of the list of all buffers. 1952 doc: /* Put BUFFER at the end of the list of all buffers.
1953There it is the least likely candidate for `other-buffer' to return; 1953There it is the least likely candidate for `other-buffer' to return;
1954thus, the least likely buffer for \\[switch-to-buffer] to select by default. 1954thus, the least likely buffer for \\[switch-to-buffer] to select by default.
1955You can specify a buffer name as BUFFER, or an actual buffer object.
1955If BUFFER is nil or omitted, bury the current buffer. 1956If BUFFER is nil or omitted, bury the current buffer.
1956Also, if BUFFER is nil or omitted, remove the current buffer from the 1957Also, if BUFFER is nil or omitted, remove the current buffer from the
1957selected window if it is displayed there. */) 1958selected window if it is displayed there. */)
@@ -5782,6 +5783,14 @@ An entry (nil PROPERTY VALUE BEG . END) indicates that a text property
5782was modified between BEG and END. PROPERTY is the property name, 5783was modified between BEG and END. PROPERTY is the property name,
5783and VALUE is the old value. 5784and VALUE is the old value.
5784 5785
5786An entry (apply FUN-NAME . ARGS) means undo the change with
5787\(apply FUN-NAME ARGS).
5788
5789An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo
5790in the active region. BEG and END is the range affected by this entry
5791and DELTA is the number of bytes added or deleted in that range by
5792this change.
5793
5785An entry (MARKER . DISTANCE) indicates that the marker MARKER 5794An entry (MARKER . DISTANCE) indicates that the marker MARKER
5786was adjusted in position by the offset DISTANCE (an integer). 5795was adjusted in position by the offset DISTANCE (an integer).
5787 5796
diff --git a/src/casefiddle.c b/src/casefiddle.c
index ae4888088bd..9af4015fbb3 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -1,5 +1,5 @@
1/* GNU Emacs case conversion functions. 1/* GNU Emacs case conversion functions.
2 Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004 2 Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004, 2005
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -73,71 +73,38 @@ casify_object (flag, obj)
73 if (STRINGP (obj)) 73 if (STRINGP (obj))
74 { 74 {
75 int multibyte = STRING_MULTIBYTE (obj); 75 int multibyte = STRING_MULTIBYTE (obj);
76 int n;
76 77
77 obj = Fcopy_sequence (obj); 78 obj = Fcopy_sequence (obj);
78 len = SBYTES (obj); 79 len = SBYTES (obj);
79 80
80 /* Scan all single-byte characters from start of string. */ 81 /* I counts bytes, and N counts chars. */
81 for (i = 0; i < len;) 82 for (i = n = 0; i < len; n++)
82 { 83 {
84 int from_len = 1, to_len = 1;
85
83 c = SREF (obj, i); 86 c = SREF (obj, i);
84 87
85 if (multibyte && c >= 0x80) 88 if (multibyte && c >= 0x80)
86 /* A multibyte character can't be handled in this 89 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len);
87 simple loop. */
88 break;
89 if (inword && flag != CASE_CAPITALIZE_UP) 90 if (inword && flag != CASE_CAPITALIZE_UP)
90 c = DOWNCASE (c); 91 c = DOWNCASE (c);
91 else if (!UPPERCASEP (c) 92 else if (!UPPERCASEP (c)
92 && (!inword || flag != CASE_CAPITALIZE_UP)) 93 && (!inword || flag != CASE_CAPITALIZE_UP))
93 c = UPCASE1 (c); 94 c = UPCASE1 (c);
94 /* If this char won't fit in a single-byte string. 95 if (ASCII_BYTE_P (c) || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
95 fall out to the multibyte case. */ 96 SSET (obj, i, c);
96 if (multibyte ? ! ASCII_BYTE_P (c) 97 else
97 : ! SINGLE_BYTE_CHAR_P (c))
98 break;
99
100 SSET (obj, i, c);
101 if ((int) flag >= (int) CASE_CAPITALIZE)
102 inword = SYNTAX (c) == Sword;
103 i++;
104 }
105
106 /* If we didn't do the whole string as single-byte,
107 scan the rest in a more complex way. */
108 if (i < len)
109 {
110 /* The work is not yet finished because of a multibyte
111 character just encountered. */
112 int fromlen, j_byte = i;
113 char *buf;
114 int bufsize;
115 USE_SAFE_ALLOCA;
116
117 bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i;
118 SAFE_ALLOCA (buf, char *, bufsize);
119
120 /* Copy data already handled. */
121 bcopy (SDATA (obj), buf, i);
122
123 /* From now on, I counts bytes. */
124 while (i < len)
125 { 98 {
126 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, 99 to_len = CHAR_BYTES (c);
127 len - i, fromlen); 100 if (from_len == to_len)
128 if (inword && flag != CASE_CAPITALIZE_UP) 101 CHAR_STRING (c, SDATA (obj) + i);
129 c = DOWNCASE (c); 102 else
130 else if (!UPPERCASEP (c) 103 Faset (obj, make_number (n), make_number (c));
131 && (!inword || flag != CASE_CAPITALIZE_UP))
132 c = UPCASE1 (c);
133 i += fromlen;
134 j_byte += CHAR_STRING (c, buf + j_byte);
135 if ((int) flag >= (int) CASE_CAPITALIZE)
136 inword = SYNTAX (c) == Sword;
137 } 104 }
138 obj = make_multibyte_string (buf, SCHARS (obj), 105 if ((int) flag >= (int) CASE_CAPITALIZE)
139 j_byte); 106 inword = SYNTAX (c) == Sword;
140 SAFE_FREE (); 107 i += to_len;
141 } 108 }
142 return obj; 109 return obj;
143 } 110 }
@@ -253,7 +220,7 @@ casify_region (flag, b, e)
253 int opoint_byte = PT_BYTE; 220 int opoint_byte = PT_BYTE;
254 int c2; 221 int c2;
255 222
256 while (i < end_byte) 223 while (start < end)
257 { 224 {
258 if ((c = FETCH_BYTE (i)) >= 0x80) 225 if ((c = FETCH_BYTE (i)) >= 0x80)
259 c = FETCH_MULTIBYTE_CHAR (i); 226 c = FETCH_MULTIBYTE_CHAR (i);
@@ -281,12 +248,16 @@ casify_region (flag, b, e)
281 FETCH_BYTE (i + j) = str[j]; 248 FETCH_BYTE (i + j) = str[j];
282 } 249 }
283 else 250 else
284 /* Replace one character with the other, 251 {
285 keeping text properties the same. */ 252 /* Replace one character with the other,
286 replace_range_2 (start + 1, i + tolen, 253 keeping text properties the same. */
287 start + 2, i + tolen + fromlen, 254 replace_range_2 (start, i,
288 str, 1, tolen, 255 start + 1, i + fromlen,
289 0); 256 str, 1, tolen,
257 1);
258 if (opoint > start)
259 opoint_byte += tolen - fromlen;
260 }
290 } 261 }
291 if ((int) flag >= (int) CASE_CAPITALIZE) 262 if ((int) flag >= (int) CASE_CAPITALIZE)
292 inword = SYNTAX (c2) == Sword; 263 inword = SYNTAX (c2) == Sword;
diff --git a/src/casetab.c b/src/casetab.c
index 6fc2d415fde..5ba025e2b5a 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -18,7 +18,7 @@ along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */ 19Boston, MA 02111-1307, USA. */
20 20
21/* Written by Howard Gayle. See chartab.c for details. */ 21/* Written by Howard Gayle. */
22 22
23#include <config.h> 23#include <config.h>
24#include "lisp.h" 24#include "lisp.h"
diff --git a/src/coding.c b/src/coding.c
index a4adf767f36..11a7061c837 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2204,6 +2204,8 @@ decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes)
2204 DECODE_COMPOSITION_END ('1'); 2204 DECODE_COMPOSITION_END ('1');
2205 src = src_base; 2205 src = src_base;
2206 c = *src++; 2206 c = *src++;
2207 if (! NILP (translation_table))
2208 c = translate_char (translation_table, c, 0, 0, 0);
2207 EMIT_CHAR (c); 2209 EMIT_CHAR (c);
2208 } 2210 }
2209 2211
diff --git a/src/config.in b/src/config.in
index a7b29aac1c9..d3dab7ffab6 100644
--- a/src/config.in
+++ b/src/config.in
@@ -598,6 +598,9 @@ Boston, MA 02111-1307, USA. */
598/* Define to 1 if you have the <sys/un.h> header file. */ 598/* Define to 1 if you have the <sys/un.h> header file. */
599#undef HAVE_SYS_UN_H 599#undef HAVE_SYS_UN_H
600 600
601/* Define to 1 if you have the <sys/utsname.h> header file. */
602#undef HAVE_SYS_UTSNAME_H
603
601/* Define to 1 if you have the <sys/vlimit.h> header file. */ 604/* Define to 1 if you have the <sys/vlimit.h> header file. */
602#undef HAVE_SYS_VLIMIT_H 605#undef HAVE_SYS_VLIMIT_H
603 606
diff --git a/src/dispextern.h b/src/dispextern.h
index b7dcfb799d0..84fff3f0b09 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1,5 +1,5 @@
1/* Interface definitions for display code. 1/* Interface definitions for display code.
2 Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004 2 Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004, 2005
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -123,12 +123,13 @@ enum window_part
123 123
124#if GLYPH_DEBUG 124#if GLYPH_DEBUG
125#define IF_DEBUG(X) X 125#define IF_DEBUG(X) X
126#define xassert(X) do {if (!(X)) abort ();} while (0)
127#else 126#else
128#define IF_DEBUG(X) (void) 0 127#define IF_DEBUG(X) (void) 0
129#define xassert(X) (void) 0
130#endif 128#endif
131 129
130/* Maybe move this inside the above `#ifdef GLYPH_DEBUG' for release. */
131#define xassert(X) do {if (!(X)) abort ();} while (0)
132
132/* Macro for displaying traces of redisplay. If Emacs was compiled 133/* Macro for displaying traces of redisplay. If Emacs was compiled
133 with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to 134 with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to
134 a non-zero value in debugging sessions to activate traces. */ 135 a non-zero value in debugging sessions to activate traces. */
@@ -817,6 +818,9 @@ struct glyph_row
817 /* 1 means this row currently shows the cursor in the right fringe. */ 818 /* 1 means this row currently shows the cursor in the right fringe. */
818 unsigned cursor_in_fringe_p : 1; 819 unsigned cursor_in_fringe_p : 1;
819 820
821 /* 1 means the last glyph in the row is part of an ellipsis. */
822 unsigned ends_in_ellipsis_p : 1;
823
820 /* Non-zero means display a bitmap on X frames indicating that this 824 /* Non-zero means display a bitmap on X frames indicating that this
821 the first line of the buffer. */ 825 the first line of the buffer. */
822 unsigned indicate_bob_p : 1; 826 unsigned indicate_bob_p : 1;
@@ -1185,6 +1189,11 @@ struct glyph_string
1185 /* Slice */ 1189 /* Slice */
1186 struct glyph_slice slice; 1190 struct glyph_slice slice;
1187 1191
1192 /* Non-null means the horizontal clipping region starts from the
1193 left edge of *clip_head, and ends with the right edge of
1194 *clip_tail, not including their overhangs. */
1195 struct glyph_string *clip_head, *clip_tail;
1196
1188 struct glyph_string *next, *prev; 1197 struct glyph_string *next, *prev;
1189}; 1198};
1190 1199
@@ -1820,6 +1829,10 @@ struct it
1820 Don't handle some `display' properties in these strings. */ 1829 Don't handle some `display' properties in these strings. */
1821 unsigned string_from_display_prop_p : 1; 1830 unsigned string_from_display_prop_p : 1;
1822 1831
1832 /* When METHOD == next_element_from_display_vector,
1833 this is 1 if we're doing an ellipsis. Otherwise meaningless. */
1834 unsigned ellipsis_p : 1;
1835
1823 /* Display table in effect or null for none. */ 1836 /* Display table in effect or null for none. */
1824 struct Lisp_Char_Table *dp; 1837 struct Lisp_Char_Table *dp;
1825 1838
@@ -1835,6 +1848,9 @@ struct it
1835 means that no such character is involved. */ 1848 means that no such character is involved. */
1836 int dpvec_char_len; 1849 int dpvec_char_len;
1837 1850
1851 /* Face id to use for all characters in display vector. -1 if unused. */
1852 int dpvec_face_id;
1853
1838 /* Face id of the iterator saved in case a glyph from dpvec contains 1854 /* Face id of the iterator saved in case a glyph from dpvec contains
1839 a face. The face is restored when all glyphs from dpvec have 1855 a face. The face is restored when all glyphs from dpvec have
1840 been delivered. */ 1856 been delivered. */
@@ -2620,6 +2636,8 @@ extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *,
2620extern void draw_phys_cursor_glyph P_ ((struct window *, 2636extern void draw_phys_cursor_glyph P_ ((struct window *,
2621 struct glyph_row *, 2637 struct glyph_row *,
2622 enum draw_glyphs_face)); 2638 enum draw_glyphs_face));
2639extern int get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *,
2640 struct glyph *, int *));
2623extern void erase_phys_cursor P_ ((struct window *)); 2641extern void erase_phys_cursor P_ ((struct window *));
2624extern void display_and_set_cursor P_ ((struct window *, 2642extern void display_and_set_cursor P_ ((struct window *,
2625 int, int, int, int, int)); 2643 int, int, int, int, int));
@@ -2741,6 +2759,7 @@ int face_at_buffer_position P_ ((struct window *, int, int, int, int *,
2741 int, int)); 2759 int, int));
2742int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, 2760int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int,
2743 int, int *, enum face_id, int)); 2761 int, int *, enum face_id, int));
2762int merge_faces P_ ((struct frame *, Lisp_Object, int, int));
2744int compute_char_face P_ ((struct frame *, int, Lisp_Object)); 2763int compute_char_face P_ ((struct frame *, int, Lisp_Object));
2745void free_all_realized_faces P_ ((Lisp_Object)); 2764void free_all_realized_faces P_ ((Lisp_Object));
2746extern Lisp_Object Qforeground_color, Qbackground_color; 2765extern Lisp_Object Qforeground_color, Qbackground_color;
diff --git a/src/dispnew.c b/src/dispnew.c
index 6813cda5a71..3fef2af7429 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4064,19 +4064,19 @@ update_window (w, force_p)
4064 int preempt_count = baud_rate / 2400 + 1; 4064 int preempt_count = baud_rate / 2400 + 1;
4065 extern int input_pending; 4065 extern int input_pending;
4066 extern Lisp_Object do_mouse_tracking; 4066 extern Lisp_Object do_mouse_tracking;
4067 struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
4067#if GLYPH_DEBUG 4068#if GLYPH_DEBUG
4068 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4069 struct frame *f = XFRAME (WINDOW_FRAME (w));
4069#endif
4070 struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
4071 4070
4072 /* Check that W's frame doesn't have glyph matrices. */ 4071 /* Check that W's frame doesn't have glyph matrices. */
4073 xassert (FRAME_WINDOW_P (f)); 4072 xassert (FRAME_WINDOW_P (f));
4073#endif
4074 4074
4075 /* Check pending input the first time so that we can quickly return. */ 4075 /* Check pending input the first time so that we can quickly return. */
4076 if (redisplay_dont_pause) 4076 if (redisplay_dont_pause)
4077 force_p = 1; 4077 force_p = 1;
4078 else 4078 else
4079 detect_input_pending (); 4079 detect_input_pending_ignore_squeezables ();
4080 4080
4081 /* If forced to complete the update, or if no input is pending, do 4081 /* If forced to complete the update, or if no input is pending, do
4082 the update. */ 4082 the update. */
@@ -4150,7 +4150,7 @@ update_window (w, force_p)
4150 scrolling large windows with repeated scroll-up 4150 scrolling large windows with repeated scroll-up
4151 commands will too quickly pause redisplay. */ 4151 commands will too quickly pause redisplay. */
4152 if (!force_p && ++n_updated % preempt_count == 0) 4152 if (!force_p && ++n_updated % preempt_count == 0)
4153 detect_input_pending (); 4153 detect_input_pending_ignore_squeezables ();
4154 4154
4155 changed_p |= update_window_line (w, vpos, 4155 changed_p |= update_window_line (w, vpos,
4156 &mouse_face_overwritten_p); 4156 &mouse_face_overwritten_p);
@@ -5099,7 +5099,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5099 5099
5100 if (redisplay_dont_pause) 5100 if (redisplay_dont_pause)
5101 force_p = 1; 5101 force_p = 1;
5102 else if (!force_p && detect_input_pending ()) 5102 else if (!force_p && detect_input_pending_ignore_squeezables ())
5103 { 5103 {
5104 pause = 1; 5104 pause = 1;
5105 goto do_pause; 5105 goto do_pause;
@@ -5155,7 +5155,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5155 } 5155 }
5156 5156
5157 if ((i - 1) % preempt_count == 0) 5157 if ((i - 1) % preempt_count == 0)
5158 detect_input_pending (); 5158 detect_input_pending_ignore_squeezables ();
5159 5159
5160 update_frame_line (f, i); 5160 update_frame_line (f, i);
5161 } 5161 }
@@ -5851,7 +5851,7 @@ mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height)
5851 it's the one we were looking for. */ 5851 it's the one we were looking for. */
5852 glyph = row->glyphs[TEXT_AREA]; 5852 glyph = row->glyphs[TEXT_AREA];
5853 end = glyph + row->used[TEXT_AREA]; 5853 end = glyph + row->used[TEXT_AREA];
5854 for (x0 = *x; glyph < end && x0 > glyph->pixel_width; ++glyph) 5854 for (x0 = *x; glyph < end && x0 >= glyph->pixel_width; ++glyph)
5855 x0 -= glyph->pixel_width; 5855 x0 -= glyph->pixel_width;
5856 *x = glyph - row->glyphs[TEXT_AREA]; 5856 *x = glyph - row->glyphs[TEXT_AREA];
5857 if (glyph < end) 5857 if (glyph < end)
@@ -5943,7 +5943,7 @@ marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
5943 5943
5944 glyph = row->glyphs[area]; 5944 glyph = row->glyphs[area];
5945 end = glyph + row->used[area]; 5945 end = glyph + row->used[area];
5946 for (x0 = *x - x0; glyph < end && x0 > glyph->pixel_width; ++glyph) 5946 for (x0 = *x - x0; glyph < end && x0 >= glyph->pixel_width; ++glyph)
5947 x0 -= glyph->pixel_width; 5947 x0 -= glyph->pixel_width;
5948 *x = glyph - row->glyphs[area]; 5948 *x = glyph - row->glyphs[area];
5949 if (glyph < end) 5949 if (glyph < end)
diff --git a/src/editfns.c b/src/editfns.c
index 45b7caa280b..0587d66bb0f 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -34,6 +34,10 @@ Boston, MA 02111-1307, USA. */
34#include <unistd.h> 34#include <unistd.h>
35#endif 35#endif
36 36
37#ifdef HAVE_SYS_UTSNAME_H
38#include <sys/utsname.h>
39#endif
40
37/* systime.h includes <sys/time.h> which, on some systems, is required 41/* systime.h includes <sys/time.h> which, on some systems, is required
38 for <sys/resource.h>; thus systime.h must be included before 42 for <sys/resource.h>; thus systime.h must be included before
39 <sys/resource.h> */ 43 <sys/resource.h> */
@@ -106,6 +110,7 @@ Lisp_Object Vsystem_name;
106Lisp_Object Vuser_real_login_name; /* login name of current user ID */ 110Lisp_Object Vuser_real_login_name; /* login name of current user ID */
107Lisp_Object Vuser_full_name; /* full name of current user */ 111Lisp_Object Vuser_full_name; /* full name of current user */
108Lisp_Object Vuser_login_name; /* user name from LOGNAME or USER */ 112Lisp_Object Vuser_login_name; /* user name from LOGNAME or USER */
113Lisp_Object Voperating_system_release; /* Operating System Release */
109 114
110/* Symbol for the text property used to mark fields. */ 115/* Symbol for the text property used to mark fields. */
111 116
@@ -170,6 +175,16 @@ init_editfns ()
170 Vuser_full_name = build_string (p); 175 Vuser_full_name = build_string (p);
171 else if (NILP (Vuser_full_name)) 176 else if (NILP (Vuser_full_name))
172 Vuser_full_name = build_string ("unknown"); 177 Vuser_full_name = build_string ("unknown");
178
179#ifdef HAVE_SYS_UTSNAME_H
180 {
181 struct utsname uts;
182 uname (&uts);
183 Voperating_system_release = build_string (uts.release);
184 }
185#else
186 Voperating_system_release = Qnil;
187#endif
173} 188}
174 189
175DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, 190DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
@@ -1349,6 +1364,15 @@ get_system_name ()
1349 return ""; 1364 return "";
1350} 1365}
1351 1366
1367char *
1368get_operating_system_release()
1369{
1370 if (STRINGP (Voperating_system_release))
1371 return (char *) SDATA (Voperating_system_release);
1372 else
1373 return "";
1374}
1375
1352DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, 1376DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
1353 doc: /* Return the process ID of Emacs, as an integer. */) 1377 doc: /* Return the process ID of Emacs, as an integer. */)
1354 () 1378 ()
@@ -3111,7 +3135,7 @@ usage: (message STRING &rest ARGS) */)
3111 && SBYTES (args[0]) == 0)) 3135 && SBYTES (args[0]) == 0))
3112 { 3136 {
3113 message (0); 3137 message (0);
3114 return Qnil; 3138 return args[0];
3115 } 3139 }
3116 else 3140 else
3117 { 3141 {
@@ -4293,6 +4317,9 @@ functions if all the text being accessed has this property. */);
4293 DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name, 4317 DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name,
4294 doc: /* The user's name, based upon the real uid only. */); 4318 doc: /* The user's name, based upon the real uid only. */);
4295 4319
4320 DEFVAR_LISP ("operating-system-release", &Voperating_system_release,
4321 doc: /* The release of the operating system Emacs is running on. */);
4322
4296 defsubr (&Spropertize); 4323 defsubr (&Spropertize);
4297 defsubr (&Schar_equal); 4324 defsubr (&Schar_equal);
4298 defsubr (&Sgoto_char); 4325 defsubr (&Sgoto_char);
diff --git a/src/emacs.c b/src/emacs.c
index cbe386d3296..d5ae652d6ee 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,6 +1,6 @@
1/* Fully extensible Emacs, running on Unix, intended for GNU. 1/* Fully extensible Emacs, running on Unix, intended for GNU.
2 Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,03,2004 2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001,
3 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -2429,7 +2429,16 @@ syms_of_emacs ()
2429Many arguments are deleted from the list as they are processed. */); 2429Many arguments are deleted from the list as they are processed. */);
2430 2430
2431 DEFVAR_LISP ("system-type", &Vsystem_type, 2431 DEFVAR_LISP ("system-type", &Vsystem_type,
2432 doc: /* Value is symbol indicating type of operating system you are using. */); 2432+ doc: /* Value is symbol indicating type of operating system you are using.
2433+Special values:
2434+ `gnu/linux' compiled for a GNU/Linux system.
2435+ `darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
2436+ `macos' compiled for Mac OS 9.
2437+ `ms-dos' compiled as an MS-DOS application.
2438+ `windows-nt' compiled as a native W32 application.
2439+ `cygwin' compiled using the Cygwin library.
2440+ `vax-vms' or `axp-vms': compiled for a (Open)VMS system.
2441+Anything else indicates some sort of Unix system. */);
2433 Vsystem_type = intern (SYSTEM_TYPE); 2442 Vsystem_type = intern (SYSTEM_TYPE);
2434 2443
2435 DEFVAR_LISP ("system-configuration", &Vsystem_configuration, 2444 DEFVAR_LISP ("system-configuration", &Vsystem_configuration,
diff --git a/src/fileio.c b/src/fileio.c
index 1943a186316..12360c677f8 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2392,10 +2392,10 @@ Signals a `file-already-exists' error if file NEWNAME already exists,
2392unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. 2392unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
2393A number as third arg means request confirmation if NEWNAME already exists. 2393A number as third arg means request confirmation if NEWNAME already exists.
2394This is what happens in interactive use with M-x. 2394This is what happens in interactive use with M-x.
2395Fourth arg KEEP-TIME non-nil means give the new file the same 2395Always sets the file modes of the output file to match the input file.
2396Fourth arg KEEP-TIME non-nil means give the output file the same
2396last-modified time as the old one. (This works on only some systems.) 2397last-modified time as the old one. (This works on only some systems.)
2397A prefix arg makes KEEP-TIME non-nil. 2398A prefix arg makes KEEP-TIME non-nil. */)
2398Also set the file modes of the target file to match the source file. */)
2399 (file, newname, ok_if_already_exists, keep_time) 2399 (file, newname, ok_if_already_exists, keep_time)
2400 Lisp_Object file, newname, ok_if_already_exists, keep_time; 2400 Lisp_Object file, newname, ok_if_already_exists, keep_time;
2401{ 2401{
diff --git a/src/fns.c b/src/fns.c
index b163223803c..9a3121a3391 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3443,6 +3443,10 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
3443 3443
3444 CHECK_SYMBOL (feature); 3444 CHECK_SYMBOL (feature);
3445 3445
3446 /* Record the presence of `require' in this file
3447 even if the feature specified is already loaded. */
3448 LOADHIST_ATTACH (Fcons (Qrequire, feature));
3449
3446 tem = Fmemq (feature, Vfeatures); 3450 tem = Fmemq (feature, Vfeatures);
3447 3451
3448 if (NILP (tem)) 3452 if (NILP (tem))
@@ -3450,8 +3454,6 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
3450 int count = SPECPDL_INDEX (); 3454 int count = SPECPDL_INDEX ();
3451 int nesting = 0; 3455 int nesting = 0;
3452 3456
3453 LOADHIST_ATTACH (Fcons (Qrequire, feature));
3454
3455 /* This is to make sure that loadup.el gives a clear picture 3457 /* This is to make sure that loadup.el gives a clear picture
3456 of what files are preloaded and when. */ 3458 of what files are preloaded and when. */
3457 if (! NILP (Vpurify_flag)) 3459 if (! NILP (Vpurify_flag))
@@ -4834,6 +4836,10 @@ sweep_weak_table (h, remove_entries_p)
4834 4836
4835 h->count = make_number (XFASTINT (h->count) - 1); 4837 h->count = make_number (XFASTINT (h->count) - 1);
4836 } 4838 }
4839 else
4840 {
4841 prev = idx;
4842 }
4837 } 4843 }
4838 else 4844 else
4839 { 4845 {
diff --git a/src/fringe.c b/src/fringe.c
index d08f0ea4535..5344d58737e 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -447,7 +447,7 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
447}; 447};
448 448
449static struct fringe_bitmap **fringe_bitmaps; 449static struct fringe_bitmap **fringe_bitmaps;
450static unsigned *fringe_faces; 450static Lisp_Object *fringe_faces;
451static int max_fringe_bitmaps; 451static int max_fringe_bitmaps;
452 452
453static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; 453static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
@@ -548,7 +548,13 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
548 } 548 }
549 549
550 if (face_id == DEFAULT_FACE_ID) 550 if (face_id == DEFAULT_FACE_ID)
551 face_id = fringe_faces[which]; 551 {
552 Lisp_Object face;
553
554 if ((face = fringe_faces[which], NILP (face))
555 || (face_id = lookup_named_face (f, face, 'A', 1), face_id < 0))
556 face_id = FRINGE_FACE_ID;
557 }
552 558
553 fb = fringe_bitmaps[which]; 559 fb = fringe_bitmaps[which];
554 if (fb == NULL) 560 if (fb == NULL)
@@ -575,7 +581,8 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
575 581
576 if (p.face == NULL) 582 if (p.face == NULL)
577 { 583 {
578 /* Why does this happen? ++kfs */ 584 /* This could happen after clearing face cache.
585 But it shouldn't happen anymore. ++kfs */
579 return; 586 return;
580 } 587 }
581 588
@@ -1074,7 +1081,7 @@ destroy_fringe_bitmap (n)
1074{ 1081{
1075 struct fringe_bitmap **fbp; 1082 struct fringe_bitmap **fbp;
1076 1083
1077 fringe_faces[n] = FRINGE_FACE_ID; 1084 fringe_faces[n] = Qnil;
1078 1085
1079 fbp = &fringe_bitmaps[n]; 1086 fbp = &fringe_bitmaps[n];
1080 if (*fbp && (*fbp)->dynamic) 1087 if (*fbp && (*fbp)->dynamic)
@@ -1300,12 +1307,12 @@ If BITMAP already exists, the existing definition is replaced. */)
1300 = ((struct fringe_bitmap **) 1307 = ((struct fringe_bitmap **)
1301 xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); 1308 xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
1302 fringe_faces 1309 fringe_faces
1303 = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned)); 1310 = (Lisp_Object *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object));
1304 1311
1305 for (; i < max_fringe_bitmaps; i++) 1312 for (; i < max_fringe_bitmaps; i++)
1306 { 1313 {
1307 fringe_bitmaps[i] = NULL; 1314 fringe_bitmaps[i] = NULL;
1308 fringe_faces[i] = FRINGE_FACE_ID; 1315 fringe_faces[i] = Qnil;
1309 } 1316 }
1310 } 1317 }
1311 } 1318 }
@@ -1363,10 +1370,8 @@ If FACE is nil, reset face to default fringe face. */)
1363 if (face_id < 0) 1370 if (face_id < 0)
1364 error ("No such face"); 1371 error ("No such face");
1365 } 1372 }
1366 else
1367 face_id = FRINGE_FACE_ID;
1368 1373
1369 fringe_faces[n] = face_id; 1374 fringe_faces[n] = face;
1370 1375
1371 return Qnil; 1376 return Qnil;
1372} 1377}
@@ -1440,6 +1445,18 @@ You must (require 'fringe) to use fringe bitmap symbols in your programs." */);
1440 Vfringe_bitmaps = Qnil; 1445 Vfringe_bitmaps = Qnil;
1441} 1446}
1442 1447
1448/* Garbage collection hook */
1449
1450void
1451mark_fringe_data ()
1452{
1453 int i;
1454
1455 for (i = 0; i < max_fringe_bitmaps; i++)
1456 if (!NILP (fringe_faces[i]))
1457 mark_object (fringe_faces[i]);
1458}
1459
1443/* Initialize this module when Emacs starts. */ 1460/* Initialize this module when Emacs starts. */
1444 1461
1445void 1462void
@@ -1461,12 +1478,12 @@ init_fringe ()
1461 fringe_bitmaps 1478 fringe_bitmaps
1462 = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); 1479 = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
1463 fringe_faces 1480 fringe_faces
1464 = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned)); 1481 = (Lisp_Object *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
1465 1482
1466 for (i = 0; i < max_fringe_bitmaps; i++) 1483 for (i = 0; i < max_fringe_bitmaps; i++)
1467 { 1484 {
1468 fringe_bitmaps[i] = NULL; 1485 fringe_bitmaps[i] = NULL;
1469 fringe_faces[i] = FRINGE_FACE_ID; 1486 fringe_faces[i] = Qnil;
1470 } 1487 }
1471} 1488}
1472 1489
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 22919230a65..aecc4e2eaea 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -756,7 +756,7 @@ xg_create_frame_widgets (f)
756 So we cheat a bit by setting a height that is what it will have 756 So we cheat a bit by setting a height that is what it will have
757 later on when tool bar items are added. */ 757 later on when tool bar items are added. */
758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) 758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0)
759 FRAME_TOOLBAR_HEIGHT (f) = 34; 759 FRAME_TOOLBAR_HEIGHT (f) = 38;
760 760
761 761
762 /* We don't want this widget double buffered, because we draw on it 762 /* We don't want this widget double buffered, because we draw on it
@@ -1312,6 +1312,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
1312 char *fn = 0; 1312 char *fn = 0;
1313 int filesel_done = 0; 1313 int filesel_done = 0;
1314 xg_get_file_func func; 1314 xg_get_file_func func;
1315 extern int x_use_old_gtk_file_dialog;
1315 1316
1316#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) 1317#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
1317 /* I really don't know why this is needed, but without this the GLIBC add on 1318 /* I really don't know why this is needed, but without this the GLIBC add on
@@ -1321,7 +1322,6 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
1321#endif /* HAVE_GTK_AND_PTHREAD */ 1322#endif /* HAVE_GTK_AND_PTHREAD */
1322 1323
1323#ifdef HAVE_GTK_FILE_BOTH 1324#ifdef HAVE_GTK_FILE_BOTH
1324 extern int x_use_old_gtk_file_dialog;
1325 1325
1326 if (x_use_old_gtk_file_dialog) 1326 if (x_use_old_gtk_file_dialog)
1327 w = xg_get_file_with_selection (f, prompt, default_filename, 1327 w = xg_get_file_with_selection (f, prompt, default_filename,
@@ -2850,7 +2850,7 @@ xg_gtk_scroll_destroy (widget, data)
2850 gpointer data; 2850 gpointer data;
2851{ 2851{
2852 gpointer p; 2852 gpointer p;
2853 int id = (int)data; 2853 int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */
2854 2854
2855 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); 2855 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA);
2856 if (p) xfree (p); 2856 if (p) xfree (p);
@@ -2920,10 +2920,11 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name)
2920 "value-changed", 2920 "value-changed",
2921 scroll_callback, 2921 scroll_callback,
2922 (gpointer) bar); 2922 (gpointer) bar);
2923 /* The EMACS_INT cast avoids a warning. */
2923 g_signal_connect (G_OBJECT (wscroll), 2924 g_signal_connect (G_OBJECT (wscroll),
2924 "destroy", 2925 "destroy",
2925 G_CALLBACK (xg_gtk_scroll_destroy), 2926 G_CALLBACK (xg_gtk_scroll_destroy),
2926 (gpointer) scroll_id); 2927 (gpointer) (EMACS_INT) scroll_id);
2927 2928
2928 /* Connect to button press and button release to detect if any scroll bar 2929 /* Connect to button press and button release to detect if any scroll bar
2929 has the pointer. */ 2930 has the pointer. */
@@ -3112,7 +3113,8 @@ xg_tool_bar_callback (w, client_data)
3112 GtkWidget *w; 3113 GtkWidget *w;
3113 gpointer client_data; 3114 gpointer client_data;
3114{ 3115{
3115 int idx = (int)client_data; 3116 /* The EMACS_INT cast avoids a warning. */
3117 int idx = (int) (EMACS_INT) client_data;
3116 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 3118 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
3117 Lisp_Object key, frame; 3119 Lisp_Object key, frame;
3118 struct input_event event; 3120 struct input_event event;
@@ -3154,10 +3156,11 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
3154 3156
3155 if (f) 3157 if (f)
3156 { 3158 {
3159 FRAME_X_OUTPUT (f)->toolbar_detached = 1;
3160
3157 /* When detaching a tool bar, not everything dissapear. There are 3161 /* When detaching a tool bar, not everything dissapear. There are
3158 a few pixels left that are used to drop the tool bar back into 3162 a few pixels left that are used to drop the tool bar back into
3159 place. */ 3163 place. */
3160 int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox));
3161 FRAME_TOOLBAR_HEIGHT (f) = 2; 3164 FRAME_TOOLBAR_HEIGHT (f) = 2;
3162 3165
3163 /* The height has changed, resize outer widget and set columns 3166 /* The height has changed, resize outer widget and set columns
@@ -3185,11 +3188,13 @@ xg_tool_bar_attach_callback (wbox, w, client_data)
3185 { 3188 {
3186 GtkRequisition req; 3189 GtkRequisition req;
3187 3190
3191 FRAME_X_OUTPUT (f)->toolbar_detached = 0;
3192
3188 gtk_widget_size_request (w, &req); 3193 gtk_widget_size_request (w, &req);
3189 FRAME_TOOLBAR_HEIGHT (f) = req.height; 3194 FRAME_TOOLBAR_HEIGHT (f) = req.height;
3190 3195
3191 /* The height has changed, resize outer widget and set columns 3196 /* The height has changed, resize outer widget and set columns
3192 rows to what we had before detaching the tool bar. */ 3197 rows to what we had before attaching the tool bar. */
3193 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 3198 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
3194 } 3199 }
3195} 3200}
@@ -3209,7 +3214,8 @@ xg_tool_bar_help_callback (w, event, client_data)
3209 GdkEventCrossing *event; 3214 GdkEventCrossing *event;
3210 gpointer client_data; 3215 gpointer client_data;
3211{ 3216{
3212 int idx = (int)client_data; 3217 /* The EMACS_INT cast avoids a warning. */
3218 int idx = (int) (EMACS_INT) client_data;
3213 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 3219 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
3214 Lisp_Object help, frame; 3220 Lisp_Object help, frame;
3215 3221
@@ -3302,6 +3308,8 @@ xg_create_tool_bar (f)
3302 3308
3303 x->toolbar_widget = gtk_toolbar_new (); 3309 x->toolbar_widget = gtk_toolbar_new ();
3304 x->handlebox_widget = gtk_handle_box_new (); 3310 x->handlebox_widget = gtk_handle_box_new ();
3311 x->toolbar_detached = 0;
3312
3305 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), 3313 gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
3306 x->toolbar_widget); 3314 x->toolbar_widget);
3307 3315
@@ -3452,11 +3460,12 @@ update_frame_tool_bar (f)
3452 3460
3453 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); 3461 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
3454 3462
3463 /* The EMACS_INT cast avoids a warning. */
3455 gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), 3464 gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget),
3456 0, 0, 0, 3465 0, 0, 0,
3457 w, 3466 w,
3458 GTK_SIGNAL_FUNC (xg_tool_bar_callback), 3467 GTK_SIGNAL_FUNC (xg_tool_bar_callback),
3459 (gpointer)i); 3468 (gpointer) (EMACS_INT) i);
3460 3469
3461 /* Save the image so we can see if an update is needed when 3470 /* Save the image so we can see if an update is needed when
3462 this function is called again. */ 3471 this function is called again. */
@@ -3486,14 +3495,15 @@ update_frame_tool_bar (f)
3486 rather than the GtkButton specific signals "enter" and 3495 rather than the GtkButton specific signals "enter" and
3487 "leave", so we can have only one callback. The event 3496 "leave", so we can have only one callback. The event
3488 will tell us what kind of event it is. */ 3497 will tell us what kind of event it is. */
3498 /* The EMACS_INT cast avoids a warning. */
3489 g_signal_connect (G_OBJECT (w), 3499 g_signal_connect (G_OBJECT (w),
3490 "enter-notify-event", 3500 "enter-notify-event",
3491 G_CALLBACK (xg_tool_bar_help_callback), 3501 G_CALLBACK (xg_tool_bar_help_callback),
3492 (gpointer)i); 3502 (gpointer) (EMACS_INT) i);
3493 g_signal_connect (G_OBJECT (w), 3503 g_signal_connect (G_OBJECT (w),
3494 "leave-notify-event", 3504 "leave-notify-event",
3495 G_CALLBACK (xg_tool_bar_help_callback), 3505 G_CALLBACK (xg_tool_bar_help_callback),
3496 (gpointer)i); 3506 (gpointer) (EMACS_INT) i);
3497 } 3507 }
3498 } 3508 }
3499 else 3509 else
@@ -3532,7 +3542,8 @@ update_frame_tool_bar (f)
3532 } 3542 }
3533 3543
3534 gtk_widget_size_request (x->toolbar_widget, &new_req); 3544 gtk_widget_size_request (x->toolbar_widget, &new_req);
3535 if (old_req.height != new_req.height) 3545 if (old_req.height != new_req.height
3546 && ! FRAME_X_OUTPUT (f)->toolbar_detached)
3536 { 3547 {
3537 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; 3548 FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
3538 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 3549 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
diff --git a/src/indent.c b/src/indent.c
index 7cfe53d80bb..39602c60d16 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,6 +1,6 @@
1/* Indentation functions. 1/* Indentation functions.
2 Copyright (C) 1985,86,87,88,93,94,95,98,2000,01,02,03,2004 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 2000, 2001,
3 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -342,7 +342,9 @@ will have a variable width)
342Ignores finite width of frame, which means that this function may return 342Ignores finite width of frame, which means that this function may return
343values greater than (frame-width). 343values greater than (frame-width).
344Whether the line is visible (if `selective-display' is t) has no effect; 344Whether the line is visible (if `selective-display' is t) has no effect;
345however, ^M is treated as end of line when `selective-display' is t. */) 345however, ^M is treated as end of line when `selective-display' is t.
346Text that has an invisible property is considered as having width 0, unless
347`buffer-invisibility-spec' specifies that it is replaced by an ellipsis. */)
346 () 348 ()
347{ 349{
348 Lisp_Object temp; 350 Lisp_Object temp;
@@ -2073,6 +2075,7 @@ whether or not it is currently displayed in some window. */)
2073 else 2075 else
2074 { 2076 {
2075 int it_start; 2077 int it_start;
2078 int oselective;
2076 2079
2077 SET_TEXT_POS (pt, PT, PT_BYTE); 2080 SET_TEXT_POS (pt, PT, PT_BYTE);
2078 start_display (&it, w, pt); 2081 start_display (&it, w, pt);
@@ -2086,7 +2089,11 @@ whether or not it is currently displayed in some window. */)
2086 it_start = IT_CHARPOS (it); 2089 it_start = IT_CHARPOS (it);
2087 reseat_at_previous_visible_line_start (&it); 2090 reseat_at_previous_visible_line_start (&it);
2088 it.current_x = it.hpos = 0; 2091 it.current_x = it.hpos = 0;
2092 /* Temporarily disable selective display so we don't move too far */
2093 oselective = it.selective;
2094 it.selective = 0;
2089 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 2095 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
2096 it.selective = oselective;
2090 2097
2091 /* Move back if we got too far. This may happen if 2098 /* Move back if we got too far. This may happen if
2092 truncate-lines is on and PT is beyond right margin. */ 2099 truncate-lines is on and PT is beyond right margin. */
diff --git a/src/insdel.c b/src/insdel.c
index 7f10c2f523d..ad6623c6693 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1,5 +1,5 @@
1/* Buffer insertion/deletion and gap motion for GNU Emacs. 1/* Buffer insertion/deletion and gap motion for GNU Emacs.
2 Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003 2 Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003, 2005
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -1745,17 +1745,21 @@ replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers)
1745 1745
1746 /* Adjust markers for the deletion and the insertion. */ 1746 /* Adjust markers for the deletion and the insertion. */
1747 if (markers 1747 if (markers
1748 && ! (nchars_del == 1 && inschars == 1)) 1748 && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
1749 adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, 1749 adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
1750 inschars, insbytes); 1750 inschars, insbytes);
1751 1751
1752 offset_intervals (current_buffer, from, inschars - nchars_del); 1752 offset_intervals (current_buffer, from, inschars - nchars_del);
1753 1753
1754 /* Relocate point as if it were a marker. */ 1754 /* Relocate point as if it were a marker. */
1755 if (from < PT && nchars_del != inschars) 1755 if (from < PT && (nchars_del != inschars || nbytes_del != insbytes))
1756 adjust_point ((from + inschars - (PT < to ? PT : to)), 1756 {
1757 (from_byte + insbytes 1757 if (PT < to)
1758 - (PT_BYTE < to_byte ? PT_BYTE : to_byte))); 1758 /* PT was within the deleted text. Move it to FROM. */
1759 adjust_point (from - PT, from_byte - PT_BYTE);
1760 else
1761 adjust_point (inschars - nchars_del, insbytes - nbytes_del);
1762 }
1759 1763
1760 if (insbytes == 0) 1764 if (insbytes == 0)
1761 evaporate_overlays (from); 1765 evaporate_overlays (from);
diff --git a/src/keyboard.c b/src/keyboard.c
index 5c2fbf29cae..5e0ffb14942 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -634,14 +634,17 @@ static EMACS_TIME timer_last_idleness_start_time;
634 634
635/* Global variable declarations. */ 635/* Global variable declarations. */
636 636
637/* Flags for readable_events. */
638#define READABLE_EVENTS_DO_TIMERS_NOW (1 << 0)
639#define READABLE_EVENTS_FILTER_EVENTS (1 << 1)
640#define READABLE_EVENTS_IGNORE_SQUEEZABLES (1 << 2)
641
637/* Function for init_keyboard to call with no args (if nonzero). */ 642/* Function for init_keyboard to call with no args (if nonzero). */
638void (*keyboard_init_hook) (); 643void (*keyboard_init_hook) ();
639 644
640static int read_avail_input P_ ((int)); 645static int read_avail_input P_ ((int));
641static void get_input_pending P_ ((int *, int)); 646static void get_input_pending P_ ((int *, int));
642static void get_filtered_input_pending P_ ((int *, int, int));
643static int readable_events P_ ((int)); 647static int readable_events P_ ((int));
644static int readable_filtered_events P_ ((int, int));
645static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *, 648static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
646 Lisp_Object, int *)); 649 Lisp_Object, int *));
647static Lisp_Object read_char_x_menu_prompt (); 650static Lisp_Object read_char_x_menu_prompt ();
@@ -3435,10 +3438,11 @@ tracking_off (old_value)
3435 input has been processed. If the only input available was 3438 input has been processed. If the only input available was
3436 the sort that we have just disabled, then we need to call 3439 the sort that we have just disabled, then we need to call
3437 redisplay. */ 3440 redisplay. */
3438 if (!readable_events (1)) 3441 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
3439 { 3442 {
3440 redisplay_preserve_echo_area (6); 3443 redisplay_preserve_echo_area (6);
3441 get_input_pending (&input_pending, 1); 3444 get_input_pending (&input_pending,
3445 READABLE_EVENTS_DO_TIMERS_NOW);
3442 } 3446 }
3443 } 3447 }
3444 return Qnil; 3448 return Qnil;
@@ -3490,20 +3494,19 @@ some_mouse_moved ()
3490/* Return true iff there are any events in the queue that read-char 3494/* Return true iff there are any events in the queue that read-char
3491 would return. If this returns false, a read-char would block. */ 3495 would return. If this returns false, a read-char would block. */
3492static int 3496static int
3493readable_filtered_events (do_timers_now, filter_events) 3497readable_events (flags)
3494 int do_timers_now; 3498 int flags;
3495 int filter_events;
3496{ 3499{
3497 if (do_timers_now) 3500 if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
3498 timer_check (do_timers_now); 3501 timer_check (1);
3499 3502
3500 /* If the buffer contains only FOCUS_IN_EVENT events, 3503 /* If the buffer contains only FOCUS_IN_EVENT events, and
3501 and FILTER_EVENTS is nonzero, report it as empty. */ 3504 READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */
3502 if (kbd_fetch_ptr != kbd_store_ptr) 3505 if (kbd_fetch_ptr != kbd_store_ptr)
3503 { 3506 {
3504 int have_live_event = 1; 3507 int have_live_event = 1;
3505 3508
3506 if (filter_events) 3509 if (flags & READABLE_EVENTS_FILTER_EVENTS)
3507 { 3510 {
3508 struct input_event *event; 3511 struct input_event *event;
3509 3512
@@ -3524,7 +3527,8 @@ readable_filtered_events (do_timers_now, filter_events)
3524 } 3527 }
3525 3528
3526#ifdef HAVE_MOUSE 3529#ifdef HAVE_MOUSE
3527 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 3530 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
3531 && !NILP (do_mouse_tracking) && some_mouse_moved ())
3528 return 1; 3532 return 1;
3529#endif 3533#endif
3530 if (single_kboard) 3534 if (single_kboard)
@@ -3542,15 +3546,6 @@ readable_filtered_events (do_timers_now, filter_events)
3542 return 0; 3546 return 0;
3543} 3547}
3544 3548
3545/* Return true iff there are any events in the queue that read-char
3546 would return. If this returns false, a read-char would block. */
3547static int
3548readable_events (do_timers_now)
3549 int do_timers_now;
3550{
3551 return readable_filtered_events (do_timers_now, 0);
3552}
3553
3554/* Set this for debugging, to have a way to get out */ 3549/* Set this for debugging, to have a way to get out */
3555int stop_character; 3550int stop_character;
3556 3551
@@ -4225,7 +4220,7 @@ swallow_events (do_display)
4225 } 4220 }
4226 4221
4227 old_timers_run = timers_run; 4222 old_timers_run = timers_run;
4228 get_input_pending (&input_pending, 1); 4223 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
4229 4224
4230 if (timers_run != old_timers_run && do_display) 4225 if (timers_run != old_timers_run && do_display)
4231 redisplay_preserve_echo_area (7); 4226 redisplay_preserve_echo_area (7);
@@ -6517,18 +6512,20 @@ lucid_event_type_list_p (object)
6517 but works even if FIONREAD does not exist. 6512 but works even if FIONREAD does not exist.
6518 (In fact, this may actually read some input.) 6513 (In fact, this may actually read some input.)
6519 6514
6520 If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. 6515 If READABLE_EVENTS_DO_TIMERS_NOW is set in FLAGS, actually run
6521 If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */ 6516 timer events that are ripe.
6517 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
6518 events (FOCUS_IN_EVENT).
6519 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6520 movements. */
6522 6521
6523static void 6522static void
6524get_filtered_input_pending (addr, do_timers_now, filter_events) 6523get_input_pending (addr, flags)
6525 int *addr; 6524 int *addr;
6526 int do_timers_now; 6525 int flags;
6527 int filter_events;
6528{ 6526{
6529 /* First of all, have we already counted some input? */ 6527 /* First of all, have we already counted some input? */
6530 *addr = (!NILP (Vquit_flag) 6528 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6531 || readable_filtered_events (do_timers_now, filter_events));
6532 6529
6533 /* If input is being read as it arrives, and we have none, there is none. */ 6530 /* If input is being read as it arrives, and we have none, there is none. */
6534 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) 6531 if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
@@ -6536,23 +6533,7 @@ get_filtered_input_pending (addr, do_timers_now, filter_events)
6536 6533
6537 /* Try to read some input and see how much we get. */ 6534 /* Try to read some input and see how much we get. */
6538 gobble_input (0); 6535 gobble_input (0);
6539 *addr = (!NILP (Vquit_flag) 6536 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6540 || readable_filtered_events (do_timers_now, filter_events));
6541}
6542
6543/* Store into *addr a value nonzero if terminal input chars are available.
6544 Serves the purpose of ioctl (0, FIONREAD, addr)
6545 but works even if FIONREAD does not exist.
6546 (In fact, this may actually read some input.)
6547
6548 If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. */
6549
6550static void
6551get_input_pending (addr, do_timers_now)
6552 int *addr;
6553 int do_timers_now;
6554{
6555 get_filtered_input_pending (addr, do_timers_now, 0);
6556} 6537}
6557 6538
6558/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ 6539/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
@@ -6915,7 +6896,7 @@ input_available_signal (signo)
6915#else 6896#else
6916 SIGNAL_THREAD_CHECK (signo); 6897 SIGNAL_THREAD_CHECK (signo);
6917#endif 6898#endif
6918 6899
6919 if (input_available_clear_time) 6900 if (input_available_clear_time)
6920 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); 6901 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
6921 6902
@@ -9940,6 +9921,18 @@ detect_input_pending ()
9940 return input_pending; 9921 return input_pending;
9941} 9922}
9942 9923
9924/* Return nonzero if input events other than mouse movements are
9925 pending. */
9926
9927int
9928detect_input_pending_ignore_squeezables ()
9929{
9930 if (!input_pending)
9931 get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
9932
9933 return input_pending;
9934}
9935
9943/* Return nonzero if input events are pending, and run any pending timers. */ 9936/* Return nonzero if input events are pending, and run any pending timers. */
9944 9937
9945int 9938int
@@ -9949,7 +9942,7 @@ detect_input_pending_run_timers (do_display)
9949 int old_timers_run = timers_run; 9942 int old_timers_run = timers_run;
9950 9943
9951 if (!input_pending) 9944 if (!input_pending)
9952 get_input_pending (&input_pending, 1); 9945 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
9953 9946
9954 if (old_timers_run != timers_run && do_display) 9947 if (old_timers_run != timers_run && do_display)
9955 { 9948 {
@@ -10002,7 +9995,9 @@ if there is a doubt, the value is t. */)
10002 if (!NILP (Vunread_command_events) || unread_command_char != -1) 9995 if (!NILP (Vunread_command_events) || unread_command_char != -1)
10003 return (Qt); 9996 return (Qt);
10004 9997
10005 get_filtered_input_pending (&input_pending, 1, 1); 9998 get_input_pending (&input_pending,
9999 READABLE_EVENTS_DO_TIMERS_NOW
10000 | READABLE_EVENTS_FILTER_EVENTS);
10006 return input_pending > 0 ? Qt : Qnil; 10001 return input_pending > 0 ? Qt : Qnil;
10007} 10002}
10008 10003
@@ -10644,17 +10639,19 @@ The elements of this list correspond to the arguments of
10644 return Flist (sizeof (val) / sizeof (val[0]), val); 10639 return Flist (sizeof (val) / sizeof (val[0]), val);
10645} 10640}
10646 10641
10647DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 3, 0, 10642DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,
10648 doc: /* Return position information for pixel coordinates X and Y. 10643 doc: /* Return position information for pixel coordinates X and Y.
10649By default, X and Y are relative to text area of the selected window. 10644By default, X and Y are relative to text area of the selected window.
10650Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window. 10645Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window.
10646If optional fourth arg WHOLE is non-nil, X is relative to the left
10647edge of the window.
10651 10648
10652The return value is similar to a mouse click position: 10649The return value is similar to a mouse click position:
10653 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) 10650 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
10654 IMAGE (DX . DY) (WIDTH . HEIGHT)) 10651 IMAGE (DX . DY) (WIDTH . HEIGHT))
10655The `posn-' functions access elements of such lists. */) 10652The `posn-' functions access elements of such lists. */)
10656 (x, y, frame_or_window) 10653 (x, y, frame_or_window, whole)
10657 Lisp_Object x, y, frame_or_window; 10654 Lisp_Object x, y, frame_or_window, whole;
10658{ 10655{
10659 if (NILP (frame_or_window)) 10656 if (NILP (frame_or_window))
10660 frame_or_window = selected_window; 10657 frame_or_window = selected_window;
@@ -10667,7 +10664,10 @@ The `posn-' functions access elements of such lists. */)
10667 10664
10668 w = XWINDOW (frame_or_window); 10665 w = XWINDOW (frame_or_window);
10669 XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x)) 10666 XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x))
10670 + window_box_left_offset (w, TEXT_AREA))); 10667 + (NILP (whole)
10668 ? window_box_left_offset (w, TEXT_AREA)
10669 : - (WINDOW_LEFT_SCROLL_BAR_COLS (w)
10670 * WINDOW_FRAME_COLUMN_WIDTH (w)))));
10671 XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); 10671 XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
10672 frame_or_window = w->frame; 10672 frame_or_window = w->frame;
10673 } 10673 }
@@ -10695,7 +10695,7 @@ The `posn-' functions access elements of such lists. */)
10695 10695
10696 tem = Fpos_visible_in_window_p (pos, window, Qt); 10696 tem = Fpos_visible_in_window_p (pos, window, Qt);
10697 if (!NILP (tem)) 10697 if (!NILP (tem))
10698 tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window); 10698 tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil);
10699 return tem; 10699 return tem;
10700} 10700}
10701 10701
@@ -11401,14 +11401,15 @@ The elements of the list are event types that may have menu bar bindings. */);
11401 doc: /* Per-terminal keymap that overrides all other local keymaps. 11401 doc: /* Per-terminal keymap that overrides all other local keymaps.
11402If this variable is non-nil, it is used as a keymap instead of the 11402If this variable is non-nil, it is used as a keymap instead of the
11403buffer's local map, and the minor mode keymaps and text property keymaps. 11403buffer's local map, and the minor mode keymaps and text property keymaps.
11404It also overrides `overriding-local-map'. 11404It also replaces `overriding-local-map'.
11405
11405This variable is intended to let commands such as `universal-argument' 11406This variable is intended to let commands such as `universal-argument'
11406set up a different keymap for reading the next command. */); 11407set up a different keymap for reading the next command. */);
11407 11408
11408 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, 11409 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
11409 doc: /* Keymap that overrides all other local keymaps. 11410 doc: /* Keymap that overrides all other local keymaps.
11410If this variable is non-nil, it is used as a keymap instead of the 11411If this variable is non-nil, it is used as a keymap--replacing the
11411buffer's local map, and the minor mode keymaps and text property keymaps. */); 11412buffer's local map, the minor mode keymaps, and char property keymaps. */);
11412 Voverriding_local_map = Qnil; 11413 Voverriding_local_map = Qnil;
11413 11414
11414 DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag, 11415 DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag,
diff --git a/src/keymap.c b/src/keymap.c
index 4375b2e3a51..f28032d0f82 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,6 +1,6 @@
1/* Manipulation of keymaps 1/* Manipulation of keymaps
2 Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 01, 2004 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 1999, 2000,
3 Free Software Foundation, Inc. 3 2001, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -529,6 +529,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
529 struct gcpro gcpro1; 529 struct gcpro gcpro1;
530 Lisp_Object meta_map; 530 Lisp_Object meta_map;
531 GCPRO1 (map); 531 GCPRO1 (map);
532 /* A strange value in which Meta is set would cause
533 infinite recursion. Protect against that. */
534 if (XINT (meta_prefix_char) & CHAR_META)
535 meta_prefix_char = make_number (27);
532 meta_map = get_keymap (access_keymap (map, meta_prefix_char, 536 meta_map = get_keymap (access_keymap (map, meta_prefix_char,
533 t_ok, noinherit, autoload), 537 t_ok, noinherit, autoload),
534 0, autoload); 538 0, autoload);
@@ -1487,10 +1491,13 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and
1487 1491
1488 if (!NILP (olp)) 1492 if (!NILP (olp))
1489 { 1493 {
1490 if (!NILP (Voverriding_local_map))
1491 keymaps = Fcons (Voverriding_local_map, keymaps);
1492 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 1494 if (!NILP (current_kboard->Voverriding_terminal_local_map))
1493 keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); 1495 keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps);
1496 /* The doc said that overriding-terminal-local-map should
1497 override overriding-local-map. The code used them both,
1498 but it seems clearer to use just one. rms, jan 2005. */
1499 else if (!NILP (Voverriding_local_map))
1500 keymaps = Fcons (Voverriding_local_map, keymaps);
1494 } 1501 }
1495 if (NILP (XCDR (keymaps))) 1502 if (NILP (XCDR (keymaps)))
1496 { 1503 {
@@ -1498,16 +1505,20 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and
1498 Lisp_Object *maps; 1505 Lisp_Object *maps;
1499 int nmaps, i; 1506 int nmaps, i;
1500 1507
1508 /* This usually returns the buffer's local map,
1509 but that can be overridden by a `local-map' property. */
1501 local = get_local_map (PT, current_buffer, Qlocal_map); 1510 local = get_local_map (PT, current_buffer, Qlocal_map);
1502 if (!NILP (local)) 1511 if (!NILP (local))
1503 keymaps = Fcons (local, keymaps); 1512 keymaps = Fcons (local, keymaps);
1504 1513
1514 /* Now put all the minor mode keymaps on the list. */
1505 nmaps = current_minor_maps (0, &maps); 1515 nmaps = current_minor_maps (0, &maps);
1506 1516
1507 for (i = --nmaps; i >= 0; i--) 1517 for (i = --nmaps; i >= 0; i--)
1508 if (!NILP (maps[i])) 1518 if (!NILP (maps[i]))
1509 keymaps = Fcons (maps[i], keymaps); 1519 keymaps = Fcons (maps[i], keymaps);
1510 1520
1521 /* This returns nil unless there is a `keymap' property. */
1511 local = get_local_map (PT, current_buffer, Qkeymap); 1522 local = get_local_map (PT, current_buffer, Qkeymap);
1512 if (!NILP (local)) 1523 if (!NILP (local))
1513 keymaps = Fcons (local, keymaps); 1524 keymaps = Fcons (local, keymaps);
diff --git a/src/lisp.h b/src/lisp.h
index b3220f43f34..cff80f1d090 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2464,7 +2464,7 @@ extern void syms_of_xdisp P_ ((void));
2464extern void init_xdisp P_ ((void)); 2464extern void init_xdisp P_ ((void));
2465extern Lisp_Object safe_eval P_ ((Lisp_Object)); 2465extern Lisp_Object safe_eval P_ ((Lisp_Object));
2466extern int pos_visible_p P_ ((struct window *, int, int *, 2466extern int pos_visible_p P_ ((struct window *, int, int *,
2467 int *, int *, int)); 2467 int *, int *, int *, int));
2468 2468
2469/* Defined in vm-limit.c. */ 2469/* Defined in vm-limit.c. */
2470extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ())); 2470extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
@@ -2906,6 +2906,7 @@ EXFUN (Fevent_convert_list, 1);
2906EXFUN (Fread_key_sequence, 5); 2906EXFUN (Fread_key_sequence, 5);
2907EXFUN (Fset_input_mode, 4); 2907EXFUN (Fset_input_mode, 4);
2908extern int detect_input_pending P_ ((void)); 2908extern int detect_input_pending P_ ((void));
2909extern int detect_input_pending_ignore_squeezables P_ ((void));
2909extern int detect_input_pending_run_timers P_ ((int)); 2910extern int detect_input_pending_run_timers P_ ((int));
2910extern void safe_run_hooks P_ ((Lisp_Object)); 2911extern void safe_run_hooks P_ ((Lisp_Object));
2911extern void cmd_error_internal P_ ((Lisp_Object, char *)); 2912extern void cmd_error_internal P_ ((Lisp_Object, char *));
diff --git a/src/macfns.c b/src/macfns.c
index f40e8354f35..416522b49b9 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -55,6 +55,7 @@ static unsigned char gray_bits[] = {
55#include <ctype.h> 55#include <ctype.h>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/stat.h> 57#include <sys/stat.h>
58#include <sys/param.h>
58 59
59#include <stdlib.h> 60#include <stdlib.h>
60#include <string.h> 61#include <string.h>
@@ -1384,6 +1385,7 @@ x_set_foreground_color (f, arg, oldval)
1384 struct frame *f; 1385 struct frame *f;
1385 Lisp_Object arg, oldval; 1386 Lisp_Object arg, oldval;
1386{ 1387{
1388 struct mac_output *mac = f->output_data.mac;
1387 unsigned long fg, old_fg; 1389 unsigned long fg, old_fg;
1388 1390
1389 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); 1391 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
@@ -1392,10 +1394,28 @@ x_set_foreground_color (f, arg, oldval)
1392 1394
1393 if (FRAME_MAC_WINDOW (f) != 0) 1395 if (FRAME_MAC_WINDOW (f) != 0)
1394 { 1396 {
1397 Display *dpy = FRAME_MAC_DISPLAY (f);
1398
1399 BLOCK_INPUT;
1400 XSetForeground (dpy, mac->normal_gc, fg);
1401 XSetBackground (dpy, mac->reverse_gc, fg);
1402
1403 if (mac->cursor_pixel == old_fg)
1404 {
1405 unload_color (f, mac->cursor_pixel);
1406 mac->cursor_pixel = fg;
1407 XSetBackground (dpy, mac->cursor_gc, mac->cursor_pixel);
1408 }
1409
1410 UNBLOCK_INPUT;
1411
1395 update_face_from_frame_parameter (f, Qforeground_color, arg); 1412 update_face_from_frame_parameter (f, Qforeground_color, arg);
1413
1396 if (FRAME_VISIBLE_P (f)) 1414 if (FRAME_VISIBLE_P (f))
1397 redraw_frame (f); 1415 redraw_frame (f);
1398 } 1416 }
1417
1418 unload_color (f, old_fg);
1399} 1419}
1400 1420
1401void 1421void
@@ -1403,11 +1423,24 @@ x_set_background_color (f, arg, oldval)
1403 struct frame *f; 1423 struct frame *f;
1404 Lisp_Object arg, oldval; 1424 Lisp_Object arg, oldval;
1405{ 1425{
1406 FRAME_BACKGROUND_PIXEL (f) 1426 struct mac_output *mac = f->output_data.mac;
1407 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); 1427 unsigned long bg;
1428
1429 bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
1430 unload_color (f, FRAME_BACKGROUND_PIXEL (f));
1431 FRAME_BACKGROUND_PIXEL (f) = bg;
1408 1432
1409 if (FRAME_MAC_WINDOW (f) != 0) 1433 if (FRAME_MAC_WINDOW (f) != 0)
1410 { 1434 {
1435 Display *dpy = FRAME_MAC_DISPLAY (f);
1436
1437 BLOCK_INPUT;
1438 XSetBackground (dpy, mac->normal_gc, bg);
1439 XSetForeground (dpy, mac->reverse_gc, bg);
1440 XSetWindowBackground (dpy, FRAME_MAC_WINDOW (f), bg);
1441 XSetForeground (dpy, mac->cursor_gc, bg);
1442
1443 UNBLOCK_INPUT;
1411 update_face_from_frame_parameter (f, Qbackground_color, arg); 1444 update_face_from_frame_parameter (f, Qbackground_color, arg);
1412 1445
1413 if (FRAME_VISIBLE_P (f)) 1446 if (FRAME_VISIBLE_P (f))
@@ -2296,6 +2329,10 @@ mac_window (f)
2296 /* so that update events can find this mac_output struct */ 2329 /* so that update events can find this mac_output struct */
2297 f->output_data.mac->mFP = f; /* point back to emacs frame */ 2330 f->output_data.mac->mFP = f; /* point back to emacs frame */
2298 2331
2332 if (FRAME_MAC_WINDOW (f))
2333 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f),
2334 FRAME_BACKGROUND_PIXEL (f));
2335
2299 validate_x_resource_name (); 2336 validate_x_resource_name ();
2300 2337
2301 /* x_set_name normally ignores requests to set the name if the 2338 /* x_set_name normally ignores requests to set the name if the
@@ -2490,9 +2527,11 @@ unwind_create_frame (frame)
2490 2527
2491 x_free_frame_resources (f); 2528 x_free_frame_resources (f);
2492 2529
2530#if GLYPH_DEBUG
2493 /* Check that reference counts are indeed correct. */ 2531 /* Check that reference counts are indeed correct. */
2494 xassert (dpyinfo->reference_count == dpyinfo_refcount); 2532 xassert (dpyinfo->reference_count == dpyinfo_refcount);
2495 xassert (dpyinfo->image_cache->refcount == image_cache_refcount); 2533 xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
2534#endif
2496 return Qt; 2535 return Qt;
2497 } 2536 }
2498 2537
@@ -3855,6 +3894,8 @@ x_create_tip_frame (dpyinfo, parms, text)
3855#endif 3894#endif
3856 { 3895 {
3857 FRAME_MAC_WINDOW (f) = tip_window; 3896 FRAME_MAC_WINDOW (f) = tip_window;
3897 XSetWindowBackground (FRAME_MAC_DISPLAY(f), tip_window,
3898 FRAME_BACKGROUND_PIXEL (f));
3858 SetWRefCon (tip_window, (long) f->output_data.mac); 3899 SetWRefCon (tip_window, (long) f->output_data.mac);
3859 /* so that update events can find this mac_output struct */ 3900 /* so that update events can find this mac_output struct */
3860 f->output_data.mac->mFP = f; 3901 f->output_data.mac->mFP = f;
@@ -4237,6 +4278,9 @@ Value is t if tooltip was open, nil otherwise. */)
4237 File selection dialog 4278 File selection dialog
4238 ***********************************************************************/ 4279 ***********************************************************************/
4239 4280
4281static pascal void mac_nav_event_callback P_ ((NavEventCallbackMessage,
4282 NavCBRecPtr, void *));
4283
4240/** 4284/**
4241 There is a relatively standard way to do this using applescript to run 4285 There is a relatively standard way to do this using applescript to run
4242 a (choose file) method. However, this doesn't do "the right thing" 4286 a (choose file) method. However, this doesn't do "the right thing"
@@ -4261,8 +4305,9 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4261 Lisp_Object file = Qnil; 4305 Lisp_Object file = Qnil;
4262 int count = SPECPDL_INDEX (); 4306 int count = SPECPDL_INDEX ();
4263 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 4307 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
4264 char filename[1001]; 4308 char filename[MAXPATHLEN];
4265 int default_filter_index = 1; /* 1: All Files, 2: Directories only */ 4309 int default_filter_index = 1; /* 1: All Files, 2: Directories only */
4310 static NavEventUPP mac_nav_event_callbackUPP = NULL;
4266 4311
4267 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); 4312 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
4268 CHECK_STRING (prompt); 4313 CHECK_STRING (prompt);
@@ -4290,16 +4335,20 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4290 options.optionFlags |= kNavSelectAllReadableItem; 4335 options.optionFlags |= kNavSelectAllReadableItem;
4291 if (!NILP(prompt)) 4336 if (!NILP(prompt))
4292 { 4337 {
4293 message = cfstring_create_with_utf8_cstring (SDATA (prompt)); 4338 message =
4339 cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8 (prompt)));
4294 options.message = message; 4340 options.message = message;
4295 } 4341 }
4296 /* Don't set the application, let it use default. 4342 /* Don't set the application, let it use default.
4297 options.clientName = CFSTR ("Emacs"); 4343 options.clientName = CFSTR ("Emacs");
4298 */ 4344 */
4299 4345
4346 if (mac_nav_event_callbackUPP == NULL)
4347 mac_nav_event_callbackUPP = NewNavEventUPP (mac_nav_event_callback);
4348
4300 if (!NILP (only_dir_p)) 4349 if (!NILP (only_dir_p))
4301 status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL, 4350 status = NavCreateChooseFolderDialog(&options, mac_nav_event_callbackUPP,
4302 &dialogRef); 4351 NULL, NULL, &dialogRef);
4303 else if (NILP (mustmatch)) 4352 else if (NILP (mustmatch))
4304 { 4353 {
4305 /* This is a save dialog */ 4354 /* This is a save dialog */
@@ -4309,21 +4358,26 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4309 4358
4310 if (!NILP(default_filename)) 4359 if (!NILP(default_filename))
4311 { 4360 {
4312 saveName = 4361 Lisp_Object utf8 = ENCODE_UTF_8 (default_filename);
4313 cfstring_create_with_utf8_cstring (SDATA (default_filename)); 4362 char *begPtr = SDATA(utf8);
4363 char *filePtr = begPtr + SBYTES(utf8);
4364 while (filePtr != begPtr && !IS_DIRECTORY_SEP(filePtr[-1]))
4365 filePtr--;
4366 saveName = cfstring_create_with_utf8_cstring (filePtr);
4314 options.saveFileName = saveName; 4367 options.saveFileName = saveName;
4315 options.optionFlags |= kNavSelectDefaultLocation; 4368 options.optionFlags |= kNavSelectDefaultLocation;
4316 } 4369 }
4317 status = NavCreatePutFileDialog(&options, 4370 status = NavCreatePutFileDialog(&options,
4318 'TEXT', kNavGenericSignature, 4371 'TEXT', kNavGenericSignature,
4319 NULL, NULL, &dialogRef); 4372 mac_nav_event_callbackUPP, NULL,
4373 &dialogRef);
4320 } 4374 }
4321 else 4375 else
4322 { 4376 {
4323 /* This is an open dialog*/ 4377 /* This is an open dialog*/
4324 status = NavCreateChooseFileDialog(&options, fileTypes, 4378 status = NavCreateChooseFileDialog(&options, fileTypes,
4325 NULL, NULL, NULL, NULL, 4379 mac_nav_event_callbackUPP, NULL,
4326 &dialogRef); 4380 NULL, NULL, &dialogRef);
4327 } 4381 }
4328 4382
4329 /* Set the default location and continue*/ 4383 /* Set the default location and continue*/
@@ -4331,13 +4385,13 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4331 if (!NILP(dir)) { 4385 if (!NILP(dir)) {
4332 FSRef defLoc; 4386 FSRef defLoc;
4333 AEDesc defLocAed; 4387 AEDesc defLocAed;
4334 status = FSPathMakeRef(SDATA(dir), &defLoc, NULL); 4388 status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL);
4335 if (status == noErr) 4389 if (status == noErr)
4336 { 4390 {
4337 AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed); 4391 AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
4338 NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed); 4392 NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
4393 AEDisposeDesc(&defLocAed);
4339 } 4394 }
4340 AEDisposeDesc(&defLocAed);
4341 } 4395 }
4342 4396
4343 status = NavDialogRun(dialogRef); 4397 status = NavDialogRun(dialogRef);
@@ -4363,7 +4417,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4363 status = NavDialogGetReply(dialogRef, &reply); 4417 status = NavDialogGetReply(dialogRef, &reply);
4364 AECoerceDesc(&reply.selection, typeFSRef, &aed); 4418 AECoerceDesc(&reply.selection, typeFSRef, &aed);
4365 AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef)); 4419 AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
4366 FSRefMakePath(&fsRef, (UInt8 *) filename, 1000); 4420 FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename));
4367 AEDisposeDesc(&aed); 4421 AEDisposeDesc(&aed);
4368 if (reply.saveFileName) 4422 if (reply.saveFileName)
4369 { 4423 {
@@ -4372,9 +4426,11 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4372 if (len && filename[len-1] != '/') 4426 if (len && filename[len-1] != '/')
4373 filename[len++] = '/'; 4427 filename[len++] = '/';
4374 CFStringGetCString(reply.saveFileName, filename+len, 4428 CFStringGetCString(reply.saveFileName, filename+len,
4375 1000-len, kCFStringEncodingUTF8); 4429 sizeof (filename) - len,
4430 kCFStringEncodingUTF8);
4376 } 4431 }
4377 file = DECODE_FILE(build_string (filename)); 4432 file = DECODE_FILE (make_unibyte_string (filename,
4433 strlen (filename)));
4378 NavDisposeReply(&reply); 4434 NavDisposeReply(&reply);
4379 } 4435 }
4380 break; 4436 break;
@@ -4400,6 +4456,15 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4400} 4456}
4401 4457
4402 4458
4459/* Need to register some event callback function for enabling drag and
4460 drop in Navigation Service dialogs. */
4461static pascal void
4462mac_nav_event_callback (selector, parms, data)
4463 NavEventCallbackMessage selector;
4464 NavCBRecPtr parms;
4465 void *data ;
4466{
4467}
4403#endif 4468#endif
4404 4469
4405/*********************************************************************** 4470/***********************************************************************
diff --git a/src/macgui.h b/src/macgui.h
index 1e1447dfaa8..cb157bb8c25 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -92,6 +92,13 @@ typedef struct _XCharStruct
92 int descent; 92 int descent;
93} XCharStruct; 93} XCharStruct;
94 94
95#define STORE_XCHARSTRUCT(xcs, w, bds) \
96 ((xcs).width = (w), \
97 (xcs).lbearing = (bds).left, \
98 (xcs).rbearing = (bds).right, \
99 (xcs).ascent = -(bds).top, \
100 (xcs).descent = (bds).bottom)
101
95struct MacFontStruct { 102struct MacFontStruct {
96 char *fontname; 103 char *fontname;
97 104
diff --git a/src/macterm.c b/src/macterm.c
index fad69ce6944..16878f9a45a 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -1,5 +1,5 @@
1/* Implementation of GUI terminal on the Mac OS. 1/* Implementation of GUI terminal on the Mac OS.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -69,6 +69,7 @@ Boston, MA 02111-1307, USA. */
69#include <errno.h> 69#include <errno.h>
70#include <setjmp.h> 70#include <setjmp.h>
71#include <sys/stat.h> 71#include <sys/stat.h>
72#include <sys/param.h>
72 73
73#include "keyboard.h" 74#include "keyboard.h"
74#include "frame.h" 75#include "frame.h"
@@ -100,6 +101,10 @@ Boston, MA 02111-1307, USA. */
100 101
101Lisp_Object Vx_toolkit_scroll_bars; 102Lisp_Object Vx_toolkit_scroll_bars;
102 103
104/* If Non-nil, the text will be rendered using Core Graphics text rendering which may anti-alias the text. */
105Lisp_Object Vmac_use_core_graphics;
106
107
103/* Non-zero means that a HELP_EVENT has been generated since Emacs 108/* Non-zero means that a HELP_EVENT has been generated since Emacs
104 start. */ 109 start. */
105 110
@@ -724,6 +729,13 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
724 int nchars, mode, bytes_per_char; 729 int nchars, mode, bytes_per_char;
725{ 730{
726 SetPortWindowPort (w); 731 SetPortWindowPort (w);
732#ifdef MAC_OS_X_VERSION_10_2
733 UInt32 textFlags, savedFlags;
734 if (!NILP(Vmac_use_core_graphics)) {
735 textFlags = kQDUseCGTextRendering;
736 savedFlags = SwapQDTextFlags(textFlags);
737 }
738#endif
727 739
728 mac_set_colors (gc); 740 mac_set_colors (gc);
729 741
@@ -734,6 +746,10 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
734 746
735 MoveTo (x, y); 747 MoveTo (x, y);
736 DrawText (buf, 0, nchars * bytes_per_char); 748 DrawText (buf, 0, nchars * bytes_per_char);
749#ifdef MAC_OS_X_VERSION_10_2
750 if (!NILP(Vmac_use_core_graphics))
751 SwapQDTextFlags(savedFlags);
752#endif
737} 753}
738 754
739 755
@@ -1090,6 +1106,62 @@ XSetForeground (display, gc, color)
1090} 1106}
1091 1107
1092 1108
1109/* Mac replacement for XSetBackground. */
1110
1111void
1112XSetBackground (display, gc, color)
1113 Display *display;
1114 GC gc;
1115 unsigned long color;
1116{
1117 gc->background = color;
1118}
1119
1120
1121/* Mac replacement for XSetWindowBackground. */
1122
1123void
1124XSetWindowBackground (display, w, color)
1125 Display *display;
1126 WindowPtr w;
1127 unsigned long color;
1128{
1129#if !TARGET_API_MAC_CARBON
1130 AuxWinHandle aw_handle;
1131 CTabHandle ctab_handle;
1132 ColorSpecPtr ct_table;
1133 short ct_size;
1134#endif
1135 RGBColor bg_color;
1136
1137 bg_color.red = RED16_FROM_ULONG (color);
1138 bg_color.green = GREEN16_FROM_ULONG (color);
1139 bg_color.blue = BLUE16_FROM_ULONG (color);
1140
1141#if TARGET_API_MAC_CARBON
1142 SetWindowContentColor (w, &bg_color);
1143#else
1144 if (GetAuxWin (w, &aw_handle))
1145 {
1146 ctab_handle = (*aw_handle)->awCTable;
1147 HandToHand ((Handle *) &ctab_handle);
1148 ct_table = (*ctab_handle)->ctTable;
1149 ct_size = (*ctab_handle)->ctSize;
1150 while (ct_size > -1)
1151 {
1152 if (ct_table->value == 0)
1153 {
1154 ct_table->rgb = bg_color;
1155 CTabChanged (ctab_handle);
1156 SetWinColor (w, (WCTabHandle) ctab_handle);
1157 }
1158 ct_size--;
1159 }
1160 }
1161#endif
1162}
1163
1164
1093/* Mac replacement for XSetFont. */ 1165/* Mac replacement for XSetFont. */
1094 1166
1095static void 1167static void
@@ -1919,20 +1991,33 @@ static void
1919mac_compute_glyph_string_overhangs (s) 1991mac_compute_glyph_string_overhangs (s)
1920 struct glyph_string *s; 1992 struct glyph_string *s;
1921{ 1993{
1922#if 0 1994 Rect r;
1923 /* MAC_TODO: XTextExtents16 does nothing yet... */ 1995 MacFontStruct *font = s->font;
1996
1997 TextFont (font->mac_fontnum);
1998 TextSize (font->mac_fontsize);
1999 TextFace (font->mac_fontface);
1924 2000
1925 if (s->cmp == NULL 2001 if (s->two_byte_p)
1926 && s->first_glyph->type == CHAR_GLYPH) 2002 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
2003 else
1927 { 2004 {
1928 XCharStruct cs; 2005 int i;
1929 int direction, font_ascent, font_descent; 2006 char *buf = xmalloc (s->nchars);
1930 XTextExtents16 (s->font, s->char2b, s->nchars, &direction, 2007
1931 &font_ascent, &font_descent, &cs); 2008 if (buf == NULL)
1932 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; 2009 SetRect (&r, 0, 0, 0, 0);
1933 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; 2010 else
2011 {
2012 for (i = 0; i < s->nchars; ++i)
2013 buf[i] = s->char2b[i].byte2;
2014 QDTextBounds (s->nchars, buf, &r);
2015 xfree (buf);
2016 }
1934 } 2017 }
1935#endif 2018
2019 s->right_overhang = r.right > s->width ? r.right - s->width : 0;
2020 s->left_overhang = r.left < 0 ? -r.left : 0;
1936} 2021}
1937 2022
1938 2023
@@ -2570,15 +2655,9 @@ x_draw_glyph_string_box (s)
2570 struct glyph *last_glyph; 2655 struct glyph *last_glyph;
2571 Rect clip_rect; 2656 Rect clip_rect;
2572 2657
2573 last_x = window_box_right (s->w, s->area); 2658 last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
2574 if (s->row->full_width_p 2659 ? WINDOW_RIGHT_EDGE_X (s->w)
2575 && !s->w->pseudo_window_p) 2660 : window_box_right (s->w, s->area));
2576 {
2577 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
2578 if (s->area != RIGHT_MARGIN_AREA
2579 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2580 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
2581 }
2582 2661
2583 /* The glyph that may have a right box line. */ 2662 /* The glyph that may have a right box line. */
2584 last_glyph = (s->cmp || s->img 2663 last_glyph = (s->cmp || s->img
@@ -3006,10 +3085,12 @@ x_draw_glyph_string (s)
3006{ 3085{
3007 int relief_drawn_p = 0; 3086 int relief_drawn_p = 0;
3008 3087
3009 /* If S draws into the background of its successor, draw the 3088 /* If S draws into the background of its successor that does not
3010 background of the successor first so that S can draw into it. 3089 draw a cursor, draw the background of the successor first so that
3011 This makes S->next use XDrawString instead of XDrawImageString. */ 3090 S can draw into it. This makes S->next use XDrawString instead
3012 if (s->next && s->right_overhang && !s->for_overlaps_p) 3091 of XDrawImageString. */
3092 if (s->next && s->right_overhang && !s->for_overlaps_p
3093 && s->next->hl != DRAW_CURSOR)
3013 { 3094 {
3014 xassert (s->next->img == NULL); 3095 xassert (s->next->img == NULL);
3015 x_set_glyph_string_gc (s->next); 3096 x_set_glyph_string_gc (s->next);
@@ -4650,29 +4731,10 @@ x_draw_hollow_cursor (w, row)
4650 if (cursor_glyph == NULL) 4731 if (cursor_glyph == NULL)
4651 return; 4732 return;
4652 4733
4653 /* Compute the width of the rectangle to draw. If on a stretch 4734 /* Compute frame-relative coordinates for phys cursor. */
4654 glyph, and `x-stretch-block-cursor' is nil, don't draw a
4655 rectangle as wide as the glyph, but use a canonical character
4656 width instead. */
4657 wd = cursor_glyph->pixel_width - 1;
4658 if (cursor_glyph->type == STRETCH_GLYPH
4659 && !x_stretch_cursor_p)
4660 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4661 w->phys_cursor_width = wd;
4662
4663 /* Compute frame-relative coordinates from window-relative
4664 coordinates. */
4665 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4735 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4666 y = WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y); 4736 y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
4667 4737 wd = w->phys_cursor_width;
4668 /* Compute the proper height and ascent of the rectangle, based
4669 on the actual glyph. Using the full height of the row looks
4670 bad when there are tall images on that row. */
4671 h = max (min (FRAME_LINE_HEIGHT (f), row->height),
4672 cursor_glyph->ascent + cursor_glyph->descent);
4673 if (h < row->height)
4674 y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
4675 h--;
4676 4738
4677 /* The foreground of cursor_gc is typically the same as the normal 4739 /* The foreground of cursor_gc is typically the same as the normal
4678 background color, which can cause the cursor box to be invisible. */ 4740 background color, which can cause the cursor box to be invisible. */
@@ -4952,7 +5014,8 @@ x_new_font (f, fontname)
4952 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; 5014 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
4953 FRAME_FONTSET (f) = -1; 5015 FRAME_FONTSET (f) = -1;
4954 5016
4955 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); 5017 FRAME_COLUMN_WIDTH (f) = fontp->average_width;
5018 FRAME_SPACE_WIDTH (f) = fontp->space_width;
4956 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); 5019 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
4957 5020
4958 compute_fringe_widths (f, 1); 5021 compute_fringe_widths (f, 1);
@@ -5857,7 +5920,7 @@ decode_mac_font_name (name, size, scriptcode)
5857 5920
5858 5921
5859static char * 5922static char *
5860mac_to_x_fontname (name, size, style, scriptcode, encoding_base) 5923mac_to_x_fontname (name, size, style, scriptcode)
5861 char *name; 5924 char *name;
5862 int size; 5925 int size;
5863 Style style; 5926 Style style;
@@ -6475,12 +6538,8 @@ x_font_min_bounds (font, w, h)
6475 MacFontStruct *font; 6538 MacFontStruct *font;
6476 int *w, *h; 6539 int *w, *h;
6477{ 6540{
6478 /*
6479 * TODO: Windows does not appear to offer min bound, only
6480 * average and maximum width, and maximum height.
6481 */
6482 *h = FONT_HEIGHT (font); 6541 *h = FONT_HEIGHT (font);
6483 *w = FONT_WIDTH (font); 6542 *w = font->min_bounds.width;
6484} 6543}
6485 6544
6486 6545
@@ -6693,29 +6752,66 @@ XLoadQueryFont (Display *dpy, char *fontname)
6693 returns 15 for 12-point Monaco! */ 6752 returns 15 for 12-point Monaco! */
6694 char_width = CharWidth ('m'); 6753 char_width = CharWidth ('m');
6695 6754
6696 font->max_bounds.rbearing = char_width; 6755 if (is_two_byte_font)
6697 font->max_bounds.lbearing = 0; 6756 {
6698 font->max_bounds.width = char_width; 6757 font->per_char = NULL;
6699 font->max_bounds.ascent = the_fontinfo.ascent;
6700 font->max_bounds.descent = the_fontinfo.descent;
6701 6758
6702 font->min_bounds = font->max_bounds; 6759 if (fontface & italic)
6760 font->max_bounds.rbearing = char_width + 1;
6761 else
6762 font->max_bounds.rbearing = char_width;
6763 font->max_bounds.lbearing = 0;
6764 font->max_bounds.width = char_width;
6765 font->max_bounds.ascent = the_fontinfo.ascent;
6766 font->max_bounds.descent = the_fontinfo.descent;
6703 6767
6704 if (is_two_byte_font || CharWidth ('m') == CharWidth ('i')) 6768 font->min_bounds = font->max_bounds;
6705 font->per_char = NULL; 6769 }
6706 else 6770 else
6707 { 6771 {
6708 font->per_char = (XCharStruct *) 6772 font->per_char = (XCharStruct *)
6709 xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); 6773 xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
6710 { 6774 {
6711 int c; 6775 int c, min_width, max_width;
6776 Rect char_bounds, min_bounds, max_bounds;
6777 char ch;
6712 6778
6779 min_width = max_width = char_width;
6780 SetRect (&min_bounds, -32767, -32767, 32767, 32767);
6781 SetRect (&max_bounds, 0, 0, 0, 0);
6713 for (c = 0x20; c <= 0xff; c++) 6782 for (c = 0x20; c <= 0xff; c++)
6714 { 6783 {
6715 font->per_char[c - 0x20] = font->max_bounds; 6784 ch = c;
6716 font->per_char[c - 0x20].width = 6785 char_width = CharWidth (ch);
6717 font->per_char[c - 0x20].rbearing = CharWidth (c); 6786 QDTextBounds (1, &ch, &char_bounds);
6718 } 6787 STORE_XCHARSTRUCT (font->per_char[c - 0x20],
6788 char_width, char_bounds);
6789 /* Some Japanese fonts (in SJIS encoding) return 0 as the
6790 character width of 0x7f. */
6791 if (char_width > 0)
6792 {
6793 min_width = min (min_width, char_width);
6794 max_width = max (max_width, char_width);
6795 }
6796 if (!EmptyRect (&char_bounds))
6797 {
6798 SetRect (&min_bounds,
6799 max (min_bounds.left, char_bounds.left),
6800 max (min_bounds.top, char_bounds.top),
6801 min (min_bounds.right, char_bounds.right),
6802 min (min_bounds.bottom, char_bounds.bottom));
6803 UnionRect (&max_bounds, &char_bounds, &max_bounds);
6804 }
6805 }
6806 STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
6807 STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
6808 if (min_width == max_width
6809 && max_bounds.left >= 0 && max_bounds.right <= max_width)
6810 {
6811 /* Fixed width and no overhangs. */
6812 xfree (font->per_char);
6813 font->per_char = NULL;
6814 }
6719 } 6815 }
6720 } 6816 }
6721 6817
@@ -6823,6 +6919,35 @@ x_load_font (f, fontname, size)
6823 fontp->name = (char *) xmalloc (strlen (font->fontname) + 1); 6919 fontp->name = (char *) xmalloc (strlen (font->fontname) + 1);
6824 bcopy (font->fontname, fontp->name, strlen (font->fontname) + 1); 6920 bcopy (font->fontname, fontp->name, strlen (font->fontname) + 1);
6825 6921
6922 if (font->min_bounds.width == font->max_bounds.width)
6923 {
6924 /* Fixed width font. */
6925 fontp->average_width = fontp->space_width = font->min_bounds.width;
6926 }
6927 else
6928 {
6929 XChar2b char2b;
6930 XCharStruct *pcm;
6931
6932 char2b.byte1 = 0x00, char2b.byte2 = 0x20;
6933 pcm = mac_per_char_metric (font, &char2b, 0);
6934 if (pcm)
6935 fontp->space_width = pcm->width;
6936 else
6937 fontp->space_width = FONT_WIDTH (font);
6938
6939 if (pcm)
6940 {
6941 int width = pcm->width;
6942 for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
6943 if ((pcm = mac_per_char_metric (font, &char2b, 0)) != NULL)
6944 width += pcm->width;
6945 fontp->average_width = width / 95;
6946 }
6947 else
6948 fontp->average_width = FONT_WIDTH (font);
6949 }
6950
6826 fontp->full_name = fontp->name; 6951 fontp->full_name = fontp->name;
6827 6952
6828 fontp->size = font->max_bounds.width; 6953 fontp->size = font->max_bounds.width;
@@ -7835,6 +7960,14 @@ mac_handle_window_event (next_handler, event, data)
7835 7960
7836 switch (GetEventKind (event)) 7961 switch (GetEventKind (event))
7837 { 7962 {
7963 case kEventWindowUpdate:
7964 result = CallNextEventHandler (next_handler, event);
7965 if (result != eventNotHandledErr)
7966 return result;
7967
7968 do_window_update (wp);
7969 break;
7970
7838 case kEventWindowBoundsChanging: 7971 case kEventWindowBoundsChanging:
7839 result = CallNextEventHandler (next_handler, event); 7972 result = CallNextEventHandler (next_handler, event);
7840 if (result != eventNotHandledErr) 7973 if (result != eventNotHandledErr)
@@ -7892,7 +8025,8 @@ install_window_handler (window)
7892{ 8025{
7893 OSErr err = noErr; 8026 OSErr err = noErr;
7894#if USE_CARBON_EVENTS 8027#if USE_CARBON_EVENTS
7895 EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowBoundsChanging}}; 8028 EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowUpdate},
8029 {kEventClassWindow, kEventWindowBoundsChanging}};
7896 static EventHandlerUPP handle_window_event_UPP = NULL; 8030 static EventHandlerUPP handle_window_event_UPP = NULL;
7897 8031
7898 if (handle_window_event_UPP == NULL) 8032 if (handle_window_event_UPP == NULL)
@@ -7987,24 +8121,28 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon)
7987 int i; 8121 int i;
7988 8122
7989 /* AE file list is one based so just use that for indexing here. */ 8123 /* AE file list is one based so just use that for indexing here. */
7990 for (i = 1; (err == noErr) && (i <= num_files_to_open); i++) 8124 for (i = 1; i <= num_files_to_open; i++)
7991 { 8125 {
7992 FSSpec fs;
7993 Str255 path_name, unix_path_name;
7994#ifdef MAC_OSX 8126#ifdef MAC_OSX
7995 FSRef fref; 8127 FSRef fref;
7996#endif 8128 char unix_path_name[MAXPATHLEN];
8129
8130 err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
8131 &actual_type, &fref, sizeof (FSRef),
8132 &actual_size);
8133 if (err != noErr || actual_type != typeFSRef)
8134 continue;
8135
8136 if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name))
8137 == noErr)
8138#else
8139 FSSpec fs;
8140 Str255 path_name, unix_path_name;
7997 8141
7998 err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type, 8142 err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
7999 (Ptr) &fs, sizeof (fs), &actual_size); 8143 (Ptr) &fs, sizeof (fs), &actual_size);
8000 if (err != noErr) break; 8144 if (err != noErr) continue;
8001 8145
8002#ifdef MAC_OSX
8003 err = FSpMakeFSRef (&fs, &fref);
8004 if (err != noErr) break;
8005
8006 if (FSRefMakePath (&fref, unix_path_name, 255) == noErr)
8007#else
8008 if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID, 8146 if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID,
8009 fs.name) && 8147 fs.name) &&
8010 mac_to_posix_pathname (path_name, unix_path_name, 255)) 8148 mac_to_posix_pathname (path_name, unix_path_name, 255))
@@ -8040,18 +8178,21 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window,
8040 FlavorFlags theFlags; 8178 FlavorFlags theFlags;
8041 OSErr result; 8179 OSErr result;
8042 8180
8181 if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
8182 return dragNotAcceptedErr;
8183
8043 switch (message) 8184 switch (message)
8044 { 8185 {
8045 case kDragTrackingEnterHandler: 8186 case kDragTrackingEnterHandler:
8046 CountDragItems (theDrag, &items); 8187 CountDragItems (theDrag, &items);
8047 can_accept = 1; 8188 can_accept = 0;
8048 for (index = 1; index <= items; index++) 8189 for (index = 1; index <= items; index++)
8049 { 8190 {
8050 GetDragItemReferenceNumber (theDrag, index, &theItem); 8191 GetDragItemReferenceNumber (theDrag, index, &theItem);
8051 result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); 8192 result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags);
8052 if (result != noErr) 8193 if (result == noErr)
8053 { 8194 {
8054 can_accept = 0; 8195 can_accept = 1;
8055 break; 8196 break;
8056 } 8197 }
8057 } 8198 }
@@ -8062,7 +8203,9 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window,
8062 { 8203 {
8063 RgnHandle hilite_rgn = NewRgn (); 8204 RgnHandle hilite_rgn = NewRgn ();
8064 Rect r; 8205 Rect r;
8206 struct frame *f = mac_window_to_frame (window);
8065 8207
8208 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
8066 GetWindowPortBounds (window, &r); 8209 GetWindowPortBounds (window, &r);
8067 OffsetRect (&r, -r.left, -r.top); 8210 OffsetRect (&r, -r.left, -r.top);
8068 RectRgn (hilite_rgn, &r); 8211 RectRgn (hilite_rgn, &r);
@@ -8078,6 +8221,9 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window,
8078 case kDragTrackingLeaveWindow: 8221 case kDragTrackingLeaveWindow:
8079 if (can_accept) 8222 if (can_accept)
8080 { 8223 {
8224 struct frame *f = mac_window_to_frame (window);
8225
8226 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
8081 HideDragHilite (theDrag); 8227 HideDragHilite (theDrag);
8082 SetThemeCursor (kThemeArrowCursor); 8228 SetThemeCursor (kThemeArrowCursor);
8083 } 8229 }
@@ -8101,9 +8247,11 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
8101 OSErr result; 8247 OSErr result;
8102 ItemReference theItem; 8248 ItemReference theItem;
8103 HFSFlavor data; 8249 HFSFlavor data;
8104 FSRef fref;
8105 Size size = sizeof (HFSFlavor); 8250 Size size = sizeof (HFSFlavor);
8106 8251
8252 if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
8253 return dragNotAcceptedErr;
8254
8107 drag_and_drop_file_list = Qnil; 8255 drag_and_drop_file_list = Qnil;
8108 GetDragMouse (theDrag, &mouse, 0L); 8256 GetDragMouse (theDrag, &mouse, 0L);
8109 CountDragItems (theDrag, &items); 8257 CountDragItems (theDrag, &items);
@@ -8115,11 +8263,11 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
8115 if (result == noErr) 8263 if (result == noErr)
8116 { 8264 {
8117#ifdef MAC_OSX 8265#ifdef MAC_OSX
8118 FSRef frref; 8266 FSRef fref;
8267 char unix_path_name[MAXPATHLEN];
8119#else 8268#else
8120 Str255 path_name; 8269 Str255 path_name, unix_path_name;
8121#endif 8270#endif
8122 Str255 unix_path_name;
8123 GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L); 8271 GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L);
8124#ifdef MAC_OSX 8272#ifdef MAC_OSX
8125 /* Use Carbon routines, otherwise it converts the file name 8273 /* Use Carbon routines, otherwise it converts the file name
@@ -8137,8 +8285,6 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
8137 strlen (unix_path_name)), 8285 strlen (unix_path_name)),
8138 drag_and_drop_file_list); 8286 drag_and_drop_file_list);
8139 } 8287 }
8140 else
8141 continue;
8142 } 8288 }
8143 /* If there are items in the list, construct an event and post it to 8289 /* If there are items in the list, construct an event and post it to
8144 the queue like an interrupt using kbd_buffer_store_event. */ 8290 the queue like an interrupt using kbd_buffer_store_event. */
@@ -8698,8 +8844,9 @@ XTread_socket (sd, expected, hold_quit)
8698 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) 8844 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8699 != eventNotHandledErr) 8845 != eventNotHandledErr)
8700 break; 8846 break;
8701#endif 8847#else
8702 do_window_update ((WindowPtr) er.message); 8848 do_window_update ((WindowPtr) er.message);
8849#endif
8703 break; 8850 break;
8704 8851
8705 case osEvt: 8852 case osEvt:
@@ -9568,7 +9715,7 @@ static struct redisplay_interface x_redisplay_interface =
9568 0, /* destroy_fringe_bitmap */ 9715 0, /* destroy_fringe_bitmap */
9569 mac_per_char_metric, 9716 mac_per_char_metric,
9570 mac_encode_char, 9717 mac_encode_char,
9571 NULL, /* mac_compute_glyph_string_overhangs */ 9718 mac_compute_glyph_string_overhangs,
9572 x_draw_glyph_string, 9719 x_draw_glyph_string,
9573 mac_define_frame_cursor, 9720 mac_define_frame_cursor,
9574 mac_clear_frame_area, 9721 mac_clear_frame_area,
@@ -9756,18 +9903,18 @@ nil then the key will act as the normal Mac option modifier. */);
9756 9903
9757 DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta, 9904 DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta,
9758 doc: /* Non-nil means that the control and meta keys are reversed. This is 9905 doc: /* Non-nil means that the control and meta keys are reversed. This is
9759 useful for non-standard keyboard layouts. */); 9906useful for non-standard keyboard layouts. */);
9760 Vmac_reverse_ctrl_meta = Qnil; 9907 Vmac_reverse_ctrl_meta = Qnil;
9761 9908
9762 DEFVAR_LISP ("mac-emulate-three-button-mouse", 9909 DEFVAR_LISP ("mac-emulate-three-button-mouse",
9763 &Vmac_emulate_three_button_mouse, 9910 &Vmac_emulate_three_button_mouse,
9764 doc: /* t means that when the option-key is held down while pressing the 9911 doc: /* t means that when the option-key is held down while pressing the
9765 mouse button, the click will register as mouse-2 and while the 9912mouse button, the click will register as mouse-2 and while the
9766 command-key is held down, the click will register as mouse-3. 9913command-key is held down, the click will register as mouse-3.
9767 'reverse means that the the option-key will register for mouse-3 9914'reverse means that the the option-key will register for mouse-3
9768 and the command-key will register for mouse-2. nil means that 9915and the command-key will register for mouse-2. nil means that
9769 not emulation should be done and the modifiers should be placed 9916no emulation should be done and the modifiers should be placed
9770 on the mouse-1 event. */); 9917on the mouse-1 event. */);
9771 Vmac_emulate_three_button_mouse = Qnil; 9918 Vmac_emulate_three_button_mouse = Qnil;
9772 9919
9773#if USE_CARBON_EVENTS 9920#if USE_CARBON_EVENTS
@@ -9786,8 +9933,19 @@ Toolbox for processing before Emacs sees it. */);
9786 doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac 9933 doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
9787Toolbox for processing before Emacs sees it. */); 9934Toolbox for processing before Emacs sees it. */);
9788 Vmac_pass_control_to_system = Qt; 9935 Vmac_pass_control_to_system = Qt;
9936
9937 DEFVAR_LISP ("mac-pass-control-to-system", &Vmac_pass_control_to_system,
9938 doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
9939Toolbox for processing before Emacs sees it. */);
9940 Vmac_pass_control_to_system = Qt;
9789#endif 9941#endif
9790 9942
9943 DEFVAR_LISP ("mac-allow-anti-aliasing", &Vmac_use_core_graphics,
9944 doc: /* If non-nil, allow anti-aliasing.
9945The text will be rendered using Core Graphics text rendering which
9946may anti-alias the text. */);
9947 Vmac_use_core_graphics = Qnil;
9948
9791 DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, 9949 DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding,
9792 doc: /* One of the Text Encoding Base constant values defined in the 9950 doc: /* One of the Text Encoding Base constant values defined in the
9793Basic Text Constants section of Inside Macintosh - Text Encoding 9951Basic Text Constants section of Inside Macintosh - Text Encoding
diff --git a/src/macterm.h b/src/macterm.h
index 7c7d55c3790..c1aa61e962b 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -599,6 +599,8 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
599 unsigned int)); 599 unsigned int));
600extern void XFreePixmap P_ ((Display *, Pixmap)); 600extern void XFreePixmap P_ ((Display *, Pixmap));
601extern void XSetForeground P_ ((Display *, GC, unsigned long)); 601extern void XSetForeground P_ ((Display *, GC, unsigned long));
602extern void XSetBackground P_ ((Display *, GC, unsigned long));
603extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
602extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, 604extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int,
603 int, int)); 605 int, int));
604extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); 606extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
diff --git a/src/process.c b/src/process.c
index c17b32eb3c5..2d7dd6b3e8d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -187,6 +187,7 @@ extern Lisp_Object QCfilter;
187#include "syswait.h" 187#include "syswait.h"
188 188
189extern void set_waiting_for_input P_ ((EMACS_TIME *)); 189extern void set_waiting_for_input P_ ((EMACS_TIME *));
190extern char *get_operating_system_release ();
190 191
191#ifndef USE_CRT_DLL 192#ifndef USE_CRT_DLL
192extern int errno; 193extern int errno;
@@ -6701,6 +6702,19 @@ init_process ()
6701 Fprovide (intern ("make-network-process"), subfeatures); 6702 Fprovide (intern ("make-network-process"), subfeatures);
6702 } 6703 }
6703#endif /* HAVE_SOCKETS */ 6704#endif /* HAVE_SOCKETS */
6705
6706#ifdef DARWIN
6707 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
6708 processes. As such, we only change the default value. */
6709 if (initialized)
6710 {
6711 char *release = get_operating_system_release();
6712 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
6713 && release[1] == '.')) {
6714 Vprocess_connection_type = Qnil;
6715 }
6716 }
6717#endif
6704} 6718}
6705 6719
6706void 6720void
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 9f78405a43c..5b162ea08a3 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -37,6 +37,10 @@ Boston, MA 02111-1307, USA. */
37#define BSD_SYSTEM 37#define BSD_SYSTEM
38/* #define VMS */ 38/* #define VMS */
39 39
40#ifndef DARWIN
41#define DARWIN 1
42#endif
43
40/* MAC_OS is used to conditionally compile code common to both MAC_OS8 44/* MAC_OS is used to conditionally compile code common to both MAC_OS8
41 and MAC_OSX. */ 45 and MAC_OSX. */
42#ifdef MAC_OSX 46#ifdef MAC_OSX
@@ -103,10 +107,18 @@ Boston, MA 02111-1307, USA. */
103 107
104/* 108/*
105 * Define HAVE_PTYS if the system supports pty devices. 109 * Define HAVE_PTYS if the system supports pty devices.
110 * Note: PTYs are broken on darwin <6. Use at your own risk.
106 */ 111 */
107 112
108#define HAVE_PTYS 113#define HAVE_PTYS
109 114
115/**
116 * PTYs only work correctly on Darwin 7 or higher. So make the
117 * default for process-connection-type dependent on the kernel
118 * version.
119 */
120#define MIN_PTY_KERNEL_VERSION '7'
121
110/* 122/*
111 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate 123 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
112 * The 4.2 opendir, etc., library functions. 124 * The 4.2 opendir, etc., library functions.
diff --git a/src/term.c b/src/term.c
index fc60b993ea4..274e453a9d8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1,5 +1,5 @@
1/* Terminal control module for terminals described by TERMCAP 1/* Terminal control module for terminals described by TERMCAP
2 Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002 2 Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002, 2005
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -690,7 +690,7 @@ encode_terminal_code (src, src_len, coding)
690 if (! STRING_MULTIBYTE (string)) 690 if (! STRING_MULTIBYTE (string))
691 string = string_to_multibyte (string); 691 string = string_to_multibyte (string);
692 nbytes = buf - encode_terminal_buf; 692 nbytes = buf - encode_terminal_buf;
693 if (nbytes + SBYTES (string) < encode_terminal_bufsize) 693 if (encode_terminal_bufsize < nbytes + SBYTES (string))
694 { 694 {
695 encode_terminal_bufsize = nbytes + SBYTES (string); 695 encode_terminal_bufsize = nbytes + SBYTES (string);
696 encode_terminal_buf = xrealloc (encode_terminal_buf, 696 encode_terminal_buf = xrealloc (encode_terminal_buf,
diff --git a/src/undo.c b/src/undo.c
index df4b8d08cd6..eaf312be676 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -40,6 +40,10 @@ Lisp_Object last_undo_buffer;
40 40
41Lisp_Object Qinhibit_read_only; 41Lisp_Object Qinhibit_read_only;
42 42
43/* Marker for function call undo list elements. */
44
45Lisp_Object Qapply;
46
43/* The first time a command records something for undo. 47/* The first time a command records something for undo.
44 it also allocates the undo-boundary object 48 it also allocates the undo-boundary object
45 which will be added to the list at the end of the command. 49 which will be added to the list at the end of the command.
@@ -519,7 +523,7 @@ Return what remains of the list. */)
519 } 523 }
520 else if (EQ (car, Qnil)) 524 else if (EQ (car, Qnil))
521 { 525 {
522 /* Element (nil prop val beg . end) is property change. */ 526 /* Element (nil PROP VAL BEG . END) is property change. */
523 Lisp_Object beg, end, prop, val; 527 Lisp_Object beg, end, prop, val;
524 528
525 prop = Fcar (cdr); 529 prop = Fcar (cdr);
@@ -543,6 +547,27 @@ Return what remains of the list. */)
543 Fgoto_char (car); 547 Fgoto_char (car);
544 Fdelete_region (car, cdr); 548 Fdelete_region (car, cdr);
545 } 549 }
550 else if (EQ (car, Qapply))
551 {
552 Lisp_Object oldlist = current_buffer->undo_list;
553 /* Element (apply FUNNAME . ARGS) means call FUNNAME to undo. */
554 car = Fcar (cdr);
555 if (INTEGERP (car))
556 {
557 /* Long format: (apply DELTA START END FUNNAME . ARGS). */
558 cdr = Fcdr (Fcdr (Fcdr (cdr)));
559 car = Fcar (cdr);
560 }
561 cdr = Fcdr (cdr);
562 apply1 (car, cdr);
563
564 /* Make sure this produces at least one undo entry,
565 so the test in `undo' for continuing an undo series
566 will work right. */
567 if (EQ (oldlist, current_buffer->undo_list))
568 current_buffer->undo_list
569 = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
570 }
546 else if (STRINGP (car) && INTEGERP (cdr)) 571 else if (STRINGP (car) && INTEGERP (cdr))
547 { 572 {
548 /* Element (STRING . POS) means STRING was deleted. */ 573 /* Element (STRING . POS) means STRING was deleted. */
@@ -589,13 +614,16 @@ Return what remains of the list. */)
589 UNGCPRO; 614 UNGCPRO;
590 return unbind_to (count, list); 615 return unbind_to (count, list);
591} 616}
592 617
593void 618void
594syms_of_undo () 619syms_of_undo ()
595{ 620{
596 Qinhibit_read_only = intern ("inhibit-read-only"); 621 Qinhibit_read_only = intern ("inhibit-read-only");
597 staticpro (&Qinhibit_read_only); 622 staticpro (&Qinhibit_read_only);
598 623
624 Qapply = intern ("apply");
625 staticpro (&Qapply);
626
599 pending_boundary = Qnil; 627 pending_boundary = Qnil;
600 staticpro (&pending_boundary); 628 staticpro (&pending_boundary);
601 629
@@ -627,17 +655,19 @@ which includes both saved text and other data. */);
627 DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit, 655 DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit,
628 doc: /* Outer limit on size of undo information for one command. 656 doc: /* Outer limit on size of undo information for one command.
629At garbage collection time, if the current command has produced 657At garbage collection time, if the current command has produced
630more than this much undo information, it asks you whether to delete 658more than this much undo information, it discards the info and displays
631the information. This is a last-ditch limit to prevent memory overflow. 659a warning. This is a last-ditch limit to prevent memory overflow.
632 660
633The size is counted as the number of bytes occupied, 661The size is counted as the number of bytes occupied, which includes
634which includes both saved text and other data. 662both saved text and other data. A value of nil means no limit. In
663this case, accumulating one huge undo entry could make Emacs crash as
664a result of memory overflow.
635 665
636In fact, this calls the function which is the value of 666In fact, this calls the function which is the value of
637`undo-outer-limit-function' with one argument, the size. 667`undo-outer-limit-function' with one argument, the size.
638The text above describes the behavior of the function 668The text above describes the behavior of the function
639that variable usually specifies. */); 669that variable usually specifies. */);
640 Vundo_outer_limit = make_number (300000); 670 Vundo_outer_limit = make_number (3000000);
641 671
642 DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function, 672 DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function,
643 doc: /* Function to call when an undo list exceeds `undo-outer-limit'. 673 doc: /* Function to call when an undo list exceeds `undo-outer-limit'.
diff --git a/src/w32bdf.c b/src/w32bdf.c
index 04739b8e846..092aff306dc 100644
--- a/src/w32bdf.c
+++ b/src/w32bdf.c
@@ -774,7 +774,10 @@ struct font_info *w32_load_bdf_font (struct frame *f, char *fontname,
774 fontp->name = (char *) xmalloc (strlen (fontname) + 1); 774 fontp->name = (char *) xmalloc (strlen (fontname) + 1);
775 bcopy (fontname, fontp->name, strlen (fontname) + 1); 775 bcopy (fontname, fontp->name, strlen (fontname) + 1);
776 fontp->full_name = fontp->name; 776 fontp->full_name = fontp->name;
777 fontp->size = FONT_WIDTH (font); 777 /* FIXME: look at BDF spec to see if there are better ways of finding
778 average_width and space_width, hopefully that don't involve working out
779 the values for ourselves from the data. */
780 fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font);
778 fontp->height = FONT_HEIGHT (font); 781 fontp->height = FONT_HEIGHT (font);
779 782
780 /* The slot `encoding' specifies how to map a character 783 /* The slot `encoding' specifies how to map a character
diff --git a/src/w32fns.c b/src/w32fns.c
index 08780e05b1f..b7115601553 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -64,6 +64,7 @@ extern double atof ();
64extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); 64extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object));
65extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); 65extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT));
66extern void w32_free_menu_strings P_ ((HWND)); 66extern void w32_free_menu_strings P_ ((HWND));
67extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int));
67 68
68extern int quit_char; 69extern int quit_char;
69 70
@@ -4544,7 +4545,7 @@ w32_load_system_font (f,fontname,size)
4544 /* Fill out details in lf according to the font that was 4545 /* Fill out details in lf according to the font that was
4545 actually loaded. */ 4546 actually loaded. */
4546 lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight; 4547 lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight;
4547 lf.lfWidth = font->tm.tmAveCharWidth; 4548 lf.lfWidth = font->tm.tmMaxCharWidth;
4548 lf.lfWeight = font->tm.tmWeight; 4549 lf.lfWeight = font->tm.tmWeight;
4549 lf.lfItalic = font->tm.tmItalic; 4550 lf.lfItalic = font->tm.tmItalic;
4550 lf.lfCharSet = font->tm.tmCharSet; 4551 lf.lfCharSet = font->tm.tmCharSet;
@@ -4592,6 +4593,24 @@ w32_load_system_font (f,fontname,size)
4592 fontp->name = (char *) xmalloc (strlen (fontname) + 1); 4593 fontp->name = (char *) xmalloc (strlen (fontname) + 1);
4593 bcopy (fontname, fontp->name, strlen (fontname) + 1); 4594 bcopy (fontname, fontp->name, strlen (fontname) + 1);
4594 4595
4596 if (lf.lfPitchAndFamily == FIXED_PITCH)
4597 {
4598 /* Fixed width font. */
4599 fontp->average_width = fontp->space_width = FONT_WIDTH (font);
4600 }
4601 else
4602 {
4603 wchar_t space = 32;
4604 XCharStruct* pcm;
4605 pcm = w32_per_char_metric (font, &space, ANSI_FONT);
4606 if (pcm)
4607 fontp->space_width = pcm->width;
4608 else
4609 fontp->space_width = FONT_WIDTH (font);
4610
4611 fontp->average_width = font->tm.tmAveCharWidth;
4612 }
4613
4595 charset = xlfd_charset_of_font (fontname); 4614 charset = xlfd_charset_of_font (fontname);
4596 4615
4597 /* Cache the W32 codepage for a font. This makes w32_encode_char 4616 /* Cache the W32 codepage for a font. This makes w32_encode_char
diff --git a/src/w32term.c b/src/w32term.c
index e02019f45b9..93eabd9d0ad 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -819,8 +819,7 @@ w32_reset_terminal_modes (void)
819 819
820/* Function prototypes of this page. */ 820/* Function prototypes of this page. */
821 821
822static XCharStruct *w32_per_char_metric P_ ((XFontStruct *, 822XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int));
823 wchar_t *, int));
824static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, int *)); 823static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, int *));
825 824
826 825
@@ -957,7 +956,7 @@ w32_native_per_char_metric (font, char2b, font_type, pcm)
957} 956}
958 957
959 958
960static XCharStruct * 959XCharStruct *
961w32_per_char_metric (font, char2b, font_type) 960w32_per_char_metric (font, char2b, font_type)
962 XFontStruct *font; 961 XFontStruct *font;
963 wchar_t *char2b; 962 wchar_t *char2b;
@@ -1922,15 +1921,9 @@ x_draw_glyph_string_box (s)
1922 struct glyph *last_glyph; 1921 struct glyph *last_glyph;
1923 RECT clip_rect; 1922 RECT clip_rect;
1924 1923
1925 last_x = window_box_right (s->w, s->area); 1924 last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
1926 if (s->row->full_width_p 1925 ? WINDOW_RIGHT_EDGE_X (s->w)
1927 && !s->w->pseudo_window_p) 1926 : window_box_right (s->w, s->area));
1928 {
1929 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
1930 if (s->area != RIGHT_MARGIN_AREA
1931 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
1932 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
1933 }
1934 1927
1935 /* The glyph that may have a right box line. */ 1928 /* The glyph that may have a right box line. */
1936 last_glyph = (s->cmp || s->img 1929 last_glyph = (s->cmp || s->img
@@ -4944,7 +4937,7 @@ x_draw_hollow_cursor (w, row)
4944 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4937 struct frame *f = XFRAME (WINDOW_FRAME (w));
4945 HDC hdc; 4938 HDC hdc;
4946 RECT rect; 4939 RECT rect;
4947 int wd, h; 4940 int h;
4948 struct glyph *cursor_glyph; 4941 struct glyph *cursor_glyph;
4949 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); 4942 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
4950 4943
@@ -4954,34 +4947,12 @@ x_draw_hollow_cursor (w, row)
4954 if (cursor_glyph == NULL) 4947 if (cursor_glyph == NULL)
4955 return; 4948 return;
4956 4949
4957 /* Compute frame-relative coordinates from window-relative 4950 /* Compute frame-relative coordinates for phys cursor. */
4958 coordinates. */
4959 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4951 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4960 rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) 4952 rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
4961 + row->ascent - w->phys_cursor_ascent);
4962
4963 /* Compute the proper height and ascent of the rectangle, based
4964 on the actual glyph. Using the full height of the row looks
4965 bad when there are tall images on that row. */
4966 h = max (min (FRAME_LINE_HEIGHT (f), row->height),
4967 cursor_glyph->ascent + cursor_glyph->descent);
4968 if (h < row->height)
4969 rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
4970 h--;
4971
4972 rect.bottom = rect.top + h; 4953 rect.bottom = rect.top + h;
4954 rect.right = rect.left + w->phys_cursor_width;
4973 4955
4974 /* Compute the width of the rectangle to draw. If on a stretch
4975 glyph, and `x-stretch-block-cursor' is nil, don't draw a
4976 rectangle as wide as the glyph, but use a canonical character
4977 width instead. */
4978 wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
4979 if (cursor_glyph->type == STRETCH_GLYPH
4980 && !x_stretch_cursor_p)
4981 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4982 w->phys_cursor_width = wd;
4983
4984 rect.right = rect.left + wd;
4985 hdc = get_frame_dc (f); 4956 hdc = get_frame_dc (f);
4986 /* Set clipping, draw the rectangle, and reset clipping again. */ 4957 /* Set clipping, draw the rectangle, and reset clipping again. */
4987 w32_clip_to_row (w, row, TEXT_AREA, hdc); 4958 w32_clip_to_row (w, row, TEXT_AREA, hdc);
@@ -5290,7 +5261,8 @@ x_new_font (f, fontname)
5290 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; 5261 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
5291 FRAME_FONTSET (f) = -1; 5262 FRAME_FONTSET (f) = -1;
5292 5263
5293 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); 5264 FRAME_COLUMN_WIDTH (f) = fontp->average_width;
5265 FRAME_SPACE_WIDTH (f) = fontp->space_width;
5294 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); 5266 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
5295 5267
5296 compute_fringe_widths (f, 1); 5268 compute_fringe_widths (f, 1);
diff --git a/src/window.c b/src/window.c
index ff536be55aa..f49e6cccbb7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -126,6 +126,11 @@ Lisp_Object Vother_window_scroll_buffer;
126 126
127Lisp_Object Vtemp_buffer_show_function; 127Lisp_Object Vtemp_buffer_show_function;
128 128
129/* Non-zero means line and page scrolling on tall lines (with images)
130 does partial scrolling by modifying window-vscroll. */
131
132int auto_window_vscroll_p;
133
129/* Non-zero means to use mode-line-inactive face in all windows but the 134/* Non-zero means to use mode-line-inactive face in all windows but the
130 selected-window and the minibuffer-scroll-window when the 135 selected-window and the minibuffer-scroll-window when the
131 minibuffer is active. */ 136 minibuffer is active. */
@@ -330,9 +335,10 @@ If POS is only out of view because of horizontal scrolling, return non-nil.
330POS defaults to point in WINDOW; WINDOW defaults to the selected window. 335POS defaults to point in WINDOW; WINDOW defaults to the selected window.
331 336
332If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 337If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
333return value is a list (X Y FULLY) where X and Y are the pixel coordinates 338return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates
334relative to the top left corner of the window, and FULLY is t if the 339relative to the top left corner of the window. PARTIAL is nil if the character
335character after POS is fully visible and nil otherwise. */) 340after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP
341and RBOT are the number of pixels invisible at the top and bottom of the row. */)
336 (pos, window, partially) 342 (pos, window, partially)
337 Lisp_Object pos, window, partially; 343 Lisp_Object pos, window, partially;
338{ 344{
@@ -341,7 +347,7 @@ character after POS is fully visible and nil otherwise. */)
341 register struct buffer *buf; 347 register struct buffer *buf;
342 struct text_pos top; 348 struct text_pos top;
343 Lisp_Object in_window = Qnil; 349 Lisp_Object in_window = Qnil;
344 int fully_p = 1; 350 int rtop, rbot, fully_p = 1;
345 int x, y; 351 int x, y;
346 352
347 w = decode_window (window); 353 w = decode_window (window);
@@ -364,14 +370,17 @@ character after POS is fully visible and nil otherwise. */)
364 && posint <= BUF_ZV (buf) 370 && posint <= BUF_ZV (buf)
365 && CHARPOS (top) >= BUF_BEGV (buf) 371 && CHARPOS (top) >= BUF_BEGV (buf)
366 && CHARPOS (top) <= BUF_ZV (buf) 372 && CHARPOS (top) <= BUF_ZV (buf)
367 && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially)) 373 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially))
368 && (!NILP (partially) || fully_p)) 374 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
369 in_window = Qt; 375 in_window = Qt;
370 376
371 if (!NILP (in_window) && !NILP (partially)) 377 if (!NILP (in_window) && !NILP (partially))
372 in_window = Fcons (make_number (x), 378 in_window = Fcons (make_number (x),
373 Fcons (make_number (y), 379 Fcons (make_number (y),
374 Fcons (fully_p ? Qt : Qnil, Qnil))); 380 Fcons ((fully_p ? Qnil
381 : Fcons (make_number (rtop),
382 make_number (rbot))),
383 Qnil)));
375 return in_window; 384 return in_window;
376} 385}
377 386
@@ -4566,6 +4575,33 @@ window_scroll_pixel_based (window, n, whole, noerror)
4566 4575
4567 start = it.current.pos; 4576 start = it.current.pos;
4568 } 4577 }
4578 else if (auto_window_vscroll_p)
4579 {
4580 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem))
4581 {
4582 int px;
4583 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4584 if (whole)
4585 dy = max ((window_box_height (w)
4586 - next_screen_context_lines * dy),
4587 dy);
4588 dy *= n;
4589
4590 if (n < 0 && (px = XINT (XCAR (tem))) > 0)
4591 {
4592 px = max (0, -w->vscroll - min (px, -dy));
4593 Fset_window_vscroll (window, make_number (px), Qt);
4594 return;
4595 }
4596 if (n > 0 && (px = XINT (XCDR (tem))) > 0)
4597 {
4598 px = max (0, -w->vscroll + min (px, dy));
4599 Fset_window_vscroll (window, make_number (px), Qt);
4600 return;
4601 }
4602 }
4603 Fset_window_vscroll (window, make_number (0), Qt);
4604 }
4569 4605
4570 /* If scroll_preserve_screen_position is non-nil, we try to set 4606 /* If scroll_preserve_screen_position is non-nil, we try to set
4571 point in the same window line as it is now, so get that line. */ 4607 point in the same window line as it is now, so get that line. */
@@ -4583,18 +4619,34 @@ window_scroll_pixel_based (window, n, whole, noerror)
4583 start_display (&it, w, start); 4619 start_display (&it, w, start);
4584 if (whole) 4620 if (whole)
4585 { 4621 {
4586 int screen_full = (window_box_height (w) 4622 int start_pos = IT_CHARPOS (it);
4587 - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f)); 4623 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4588 int dy = n * screen_full; 4624 dy = max ((window_box_height (w)
4625 - next_screen_context_lines * dy),
4626 dy) * n;
4589 4627
4590 /* Note that move_it_vertically always moves the iterator to the 4628 /* Note that move_it_vertically always moves the iterator to the
4591 start of a line. So, if the last line doesn't have a newline, 4629 start of a line. So, if the last line doesn't have a newline,
4592 we would end up at the start of the line ending at ZV. */ 4630 we would end up at the start of the line ending at ZV. */
4593 if (dy <= 0) 4631 if (dy <= 0)
4594 move_it_vertically_backward (&it, -dy); 4632 {
4633 move_it_vertically_backward (&it, -dy);
4634 /* Ensure we actually does move, e.g. in case we are currently
4635 looking at an image that is taller that the window height. */
4636 while (start_pos == IT_CHARPOS (it)
4637 && start_pos > BEGV)
4638 move_it_by_lines (&it, -1, 1);
4639 }
4595 else if (dy > 0) 4640 else if (dy > 0)
4596 move_it_to (&it, ZV, -1, it.current_y + dy, -1, 4641 {
4597 MOVE_TO_POS | MOVE_TO_Y); 4642 move_it_to (&it, ZV, -1, it.current_y + dy, -1,
4643 MOVE_TO_POS | MOVE_TO_Y);
4644 /* Ensure we actually does move, e.g. in case we are currently
4645 looking at an image that is taller that the window height. */
4646 while (start_pos == IT_CHARPOS (it)
4647 && start_pos < ZV)
4648 move_it_by_lines (&it, 1, 1);
4649 }
4598 } 4650 }
4599 else 4651 else
4600 move_it_by_lines (&it, n, 1); 4652 move_it_by_lines (&it, n, 1);
@@ -4690,7 +4742,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4690 ; 4742 ;
4691 else if (preserve_y >= 0) 4743 else if (preserve_y >= 0)
4692 { 4744 {
4693 /* If we have a header line, take account of it. */ 4745 /* If we have a header line, take account of it.
4746 This is necessary because we set it.current_y to 0, above. */
4694 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4747 if (WINDOW_WANTS_HEADER_LINE_P (w))
4695 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4748 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4696 4749
@@ -4730,9 +4783,14 @@ window_scroll_pixel_based (window, n, whole, noerror)
4730 { 4783 {
4731 SET_TEXT_POS_FROM_MARKER (start, w->start); 4784 SET_TEXT_POS_FROM_MARKER (start, w->start);
4732 start_display (&it, w, start); 4785 start_display (&it, w, start);
4786#if 0 /* It's wrong to subtract this here
4787 because we called start_display again
4788 and did not alter it.current_y this time. */
4789
4733 /* If we have a header line, take account of it. */ 4790 /* If we have a header line, take account of it. */
4734 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4791 if (WINDOW_WANTS_HEADER_LINE_P (w))
4735 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4792 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4793#endif
4736 4794
4737 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4795 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4738 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4796 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
@@ -6331,13 +6389,16 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6331 : XFLOATINT (vscroll)); 6389 : XFLOATINT (vscroll));
6332 w->vscroll = min (w->vscroll, 0); 6390 w->vscroll = min (w->vscroll, 0);
6333 6391
6334 /* Adjust glyph matrix of the frame if the virtual display 6392 if (w->vscroll != old_dy)
6335 area becomes larger than before. */ 6393 {
6336 if (w->vscroll < 0 && w->vscroll < old_dy) 6394 /* Adjust glyph matrix of the frame if the virtual display
6337 adjust_glyphs (f); 6395 area becomes larger than before. */
6396 if (w->vscroll < 0 && w->vscroll < old_dy)
6397 adjust_glyphs (f);
6338 6398
6339 /* Prevent redisplay shortcuts. */ 6399 /* Prevent redisplay shortcuts. */
6340 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 6400 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
6401 }
6341 } 6402 }
6342 6403
6343 return Fwindow_vscroll (window, pixels_p); 6404 return Fwindow_vscroll (window, pixels_p);
@@ -6649,6 +6710,10 @@ is displayed in the `mode-line' face. */);
6649 doc: /* *Non-nil means `display-buffer' should make a separate frame. */); 6710 doc: /* *Non-nil means `display-buffer' should make a separate frame. */);
6650 pop_up_frames = 0; 6711 pop_up_frames = 0;
6651 6712
6713 DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p,
6714 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
6715 auto_window_vscroll_p = 1;
6716
6652 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, 6717 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
6653 doc: /* *Non-nil means `display-buffer' should reuse frames. 6718 doc: /* *Non-nil means `display-buffer' should reuse frames.
6654If the buffer in question is already displayed in a frame, raise that frame. */); 6719If the buffer in question is already displayed in a frame, raise that frame. */);
diff --git a/src/xdisp.c b/src/xdisp.c
index 88eaedef087..ecbd5398120 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,6 +1,6 @@
1/* Display generation from window structure and buffer text. 1/* Display generation from window structure and buffer text.
2 Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
3 Free Software Foundation, Inc. 3 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -318,6 +318,10 @@ extern Lisp_Object Qcursor;
318 318
319Lisp_Object Vshow_trailing_whitespace; 319Lisp_Object Vshow_trailing_whitespace;
320 320
321/* Non-nil means escape non-break space and hyphens. */
322
323Lisp_Object Vshow_nonbreak_escape;
324
321#ifdef HAVE_WINDOW_SYSTEM 325#ifdef HAVE_WINDOW_SYSTEM
322extern Lisp_Object Voverflow_newline_into_fringe; 326extern Lisp_Object Voverflow_newline_into_fringe;
323 327
@@ -345,7 +349,6 @@ Lisp_Object Qtrailing_whitespace;
345/* Name and number of the face used to highlight escape glyphs. */ 349/* Name and number of the face used to highlight escape glyphs. */
346 350
347Lisp_Object Qescape_glyph; 351Lisp_Object Qescape_glyph;
348int escape_glyph_face;
349 352
350/* The symbol `image' which is the car of the lists used to represent 353/* The symbol `image' which is the car of the lists used to represent
351 images in Lisp. */ 354 images in Lisp. */
@@ -1236,28 +1239,31 @@ line_bottom_y (it)
1236} 1239}
1237 1240
1238 1241
1239/* Return 1 if position CHARPOS is visible in window W. Set *FULLY to 1242/* Return 1 if position CHARPOS is visible in window W.
1240 1 if POS is visible and the line containing POS is fully visible. 1243 If visible, set *X and *Y to pixel coordinates of top left corner.
1244 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
1241 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line 1245 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line
1242 and header-lines heights. */ 1246 and header-lines heights. */
1243 1247
1244int 1248int
1245pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) 1249pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1246 struct window *w; 1250 struct window *w;
1247 int charpos, *fully, *x, *y, exact_mode_line_heights_p; 1251 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p;
1248{ 1252{
1249 struct it it; 1253 struct it it;
1250 struct text_pos top; 1254 struct text_pos top;
1251 int visible_p; 1255 int visible_p = 0;
1252 struct buffer *old_buffer = NULL; 1256 struct buffer *old_buffer = NULL;
1253 1257
1258 if (noninteractive)
1259 return visible_p;
1260
1254 if (XBUFFER (w->buffer) != current_buffer) 1261 if (XBUFFER (w->buffer) != current_buffer)
1255 { 1262 {
1256 old_buffer = current_buffer; 1263 old_buffer = current_buffer;
1257 set_buffer_internal_1 (XBUFFER (w->buffer)); 1264 set_buffer_internal_1 (XBUFFER (w->buffer));
1258 } 1265 }
1259 1266
1260 *fully = visible_p = 0;
1261 SET_TEXT_POS_FROM_MARKER (top, w->start); 1267 SET_TEXT_POS_FROM_MARKER (top, w->start);
1262 1268
1263 /* Compute exact mode line heights, if requested. */ 1269 /* Compute exact mode line heights, if requested. */
@@ -1282,20 +1288,22 @@ pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p)
1282 if (IT_CHARPOS (it) >= charpos) 1288 if (IT_CHARPOS (it) >= charpos)
1283 { 1289 {
1284 int top_y = it.current_y; 1290 int top_y = it.current_y;
1285 int bottom_y = line_bottom_y (&it); 1291 int bottom_y = (last_height = 0, line_bottom_y (&it));
1286 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); 1292 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
1287 1293
1288 if (top_y < window_top_y) 1294 if (top_y < window_top_y)
1289 visible_p = bottom_y > window_top_y; 1295 visible_p = bottom_y > window_top_y;
1290 else if (top_y < it.last_visible_y) 1296 else if (top_y < it.last_visible_y)
1291 {
1292 visible_p = 1; 1297 visible_p = 1;
1293 *fully = bottom_y <= it.last_visible_y;
1294 }
1295 if (visible_p && x) 1298 if (visible_p && x)
1296 { 1299 {
1297 *x = it.current_x; 1300 *x = it.current_x;
1298 *y = max (top_y + it.max_ascent - it.ascent, window_top_y); 1301 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
1302 if (rtop)
1303 {
1304 *rtop = max (0, window_top_y - top_y);
1305 *rbot = max (0, bottom_y - it.last_visible_y);
1306 }
1299 } 1307 }
1300 } 1308 }
1301 else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) 1309 else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y)
@@ -1312,6 +1320,11 @@ pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p)
1312 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); 1320 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
1313 *x = it2.current_x; 1321 *x = it2.current_x;
1314 *y = it2.current_y + it2.max_ascent - it2.ascent; 1322 *y = it2.current_y + it2.max_ascent - it2.ascent;
1323 if (rtop)
1324 {
1325 *rtop = 0;
1326 *rbot = max (0, (it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y);
1327 }
1315 } 1328 }
1316 } 1329 }
1317 } 1330 }
@@ -1769,6 +1782,24 @@ get_glyph_string_clip_rect (s, nr)
1769 r.height = s->row->visible_height; 1782 r.height = s->row->visible_height;
1770 } 1783 }
1771 1784
1785 if (s->clip_head)
1786 if (r.x < s->clip_head->x)
1787 {
1788 if (r.width >= s->clip_head->x - r.x)
1789 r.width -= s->clip_head->x - r.x;
1790 else
1791 r.width = 0;
1792 r.x = s->clip_head->x;
1793 }
1794 if (s->clip_tail)
1795 if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width)
1796 {
1797 if (s->clip_tail->x + s->clip_tail->background_width >= r.x)
1798 r.width = s->clip_tail->x + s->clip_tail->background_width - r.x;
1799 else
1800 r.width = 0;
1801 }
1802
1772 /* If S draws overlapping rows, it's sufficient to use the top and 1803 /* If S draws overlapping rows, it's sufficient to use the top and
1773 bottom of the window for clipping because this glyph string 1804 bottom of the window for clipping because this glyph string
1774 intentionally draws over other lines. */ 1805 intentionally draws over other lines. */
@@ -1802,7 +1833,7 @@ get_glyph_string_clip_rect (s, nr)
1802 if (s->hl == DRAW_CURSOR) 1833 if (s->hl == DRAW_CURSOR)
1803 { 1834 {
1804 struct glyph *glyph = s->first_glyph; 1835 struct glyph *glyph = s->first_glyph;
1805 int height; 1836 int height, max_y;
1806 1837
1807 if (s->x > r.x) 1838 if (s->x > r.x)
1808 { 1839 {
@@ -1811,13 +1842,26 @@ get_glyph_string_clip_rect (s, nr)
1811 } 1842 }
1812 r.width = min (r.width, glyph->pixel_width); 1843 r.width = min (r.width, glyph->pixel_width);
1813 1844
1814 /* Don't draw cursor glyph taller than our actual glyph. */ 1845 /* If r.y is below window bottom, ensure that we still see a cursor. */
1815 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent); 1846 height = min (glyph->ascent + glyph->descent,
1816 if (height < r.height) 1847 min (FRAME_LINE_HEIGHT (s->f), s->row->visible_height));
1848 max_y = window_text_bottom_y (s->w) - height;
1849 max_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, max_y);
1850 if (s->ybase - glyph->ascent > max_y)
1851 {
1852 r.y = max_y;
1853 r.height = height;
1854 }
1855 else
1817 { 1856 {
1818 int max_y = r.y + r.height; 1857 /* Don't draw cursor glyph taller than our actual glyph. */
1819 r.y = min (max_y, s->ybase + glyph->descent - height); 1858 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
1820 r.height = min (max_y - r.y, height); 1859 if (height < r.height)
1860 {
1861 max_y = r.y + r.height;
1862 r.y = min (max_y, max (r.y, s->ybase + glyph->descent - height));
1863 r.height = min (max_y - r.y, height);
1864 }
1821 } 1865 }
1822 } 1866 }
1823 1867
@@ -1828,6 +1872,64 @@ get_glyph_string_clip_rect (s, nr)
1828#endif 1872#endif
1829} 1873}
1830 1874
1875
1876/* EXPORT:
1877 Return the position and height of the phys cursor in window W.
1878 Set w->phys_cursor_width to width of phys cursor.
1879*/
1880
1881int
1882get_phys_cursor_geometry (w, row, glyph, heightp)
1883 struct window *w;
1884 struct glyph_row *row;
1885 struct glyph *glyph;
1886 int *heightp;
1887{
1888 struct frame *f = XFRAME (WINDOW_FRAME (w));
1889 int x, y, wd, h, h0, y0;
1890
1891 /* Compute the width of the rectangle to draw. If on a stretch
1892 glyph, and `x-stretch-block-cursor' is nil, don't draw a
1893 rectangle as wide as the glyph, but use a canonical character
1894 width instead. */
1895 wd = glyph->pixel_width - 1;
1896#ifdef HAVE_NTGUI
1897 wd++; /* Why? */
1898#endif
1899 if (glyph->type == STRETCH_GLYPH
1900 && !x_stretch_cursor_p)
1901 wd = min (FRAME_COLUMN_WIDTH (f), wd);
1902 w->phys_cursor_width = wd;
1903
1904 y = w->phys_cursor.y + row->ascent - glyph->ascent;
1905
1906 /* If y is below window bottom, ensure that we still see a cursor. */
1907 h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height);
1908
1909 h = max (h0, glyph->ascent + glyph->descent);
1910 h0 = min (h0, glyph->ascent + glyph->descent);
1911
1912 y0 = WINDOW_HEADER_LINE_HEIGHT (w);
1913 if (y < y0)
1914 {
1915 h = max (h - (y0 - y) + 1, h0);
1916 y = y0 - 1;
1917 }
1918 else
1919 {
1920 y0 = window_text_bottom_y (w) - h0;
1921 if (y > y0)
1922 {
1923 h += y - y0;
1924 y = y0;
1925 }
1926 }
1927
1928 *heightp = h - 1;
1929 return WINDOW_TO_FRAME_PIXEL_Y (w, y);
1930}
1931
1932
1831#endif /* HAVE_WINDOW_SYSTEM */ 1933#endif /* HAVE_WINDOW_SYSTEM */
1832 1934
1833 1935
@@ -3261,11 +3363,13 @@ setup_for_ellipsis (it, len)
3261 3363
3262 it->dpvec_char_len = len; 3364 it->dpvec_char_len = len;
3263 it->current.dpvec_index = 0; 3365 it->current.dpvec_index = 0;
3366 it->dpvec_face_id = -1;
3264 3367
3265 /* Remember the current face id in case glyphs specify faces. 3368 /* Remember the current face id in case glyphs specify faces.
3266 IT's face is restored in set_iterator_to_next. */ 3369 IT's face is restored in set_iterator_to_next. */
3267 it->saved_face_id = it->face_id; 3370 it->saved_face_id = it->face_id;
3268 it->method = next_element_from_display_vector; 3371 it->method = next_element_from_display_vector;
3372 it->ellipsis_p = 1;
3269} 3373}
3270 3374
3271 3375
@@ -4564,51 +4668,53 @@ static void
4564back_to_previous_visible_line_start (it) 4668back_to_previous_visible_line_start (it)
4565 struct it *it; 4669 struct it *it;
4566{ 4670{
4567 int visible_p = 0; 4671 while (IT_CHARPOS (*it) > BEGV)
4568
4569 /* Go back one newline if not on BEGV already. */
4570 if (IT_CHARPOS (*it) > BEGV)
4571 back_to_previous_line_start (it);
4572
4573 /* Move over lines that are invisible because of selective display
4574 or text properties. */
4575 while (IT_CHARPOS (*it) > BEGV
4576 && !visible_p)
4577 { 4672 {
4578 visible_p = 1; 4673 back_to_previous_line_start (it);
4674 if (IT_CHARPOS (*it) <= BEGV)
4675 break;
4579 4676
4580 /* If selective > 0, then lines indented more than that values 4677 /* If selective > 0, then lines indented more than that values
4581 are invisible. */ 4678 are invisible. */
4582 if (it->selective > 0 4679 if (it->selective > 0
4583 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it), 4680 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
4584 (double) it->selective)) /* iftc */ 4681 (double) it->selective)) /* iftc */
4585 visible_p = 0; 4682 continue;
4586 else
4587 {
4588 Lisp_Object prop;
4589 4683
4590 /* Check the newline before point for invisibility. */ 4684 /* Check the newline before point for invisibility. */
4591 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), 4685 {
4686 Lisp_Object prop;
4687 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
4592 Qinvisible, it->window); 4688 Qinvisible, it->window);
4593 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 4689 if (TEXT_PROP_MEANS_INVISIBLE (prop))
4594 visible_p = 0; 4690 continue;
4595 } 4691 }
4596
4597#if 0
4598 /* Commenting this out fixes the bug described in
4599 http://www.math.ku.dk/~larsh/emacs/emacs-loops-on-large-images/test-case.txt. */
4600 if (visible_p)
4601 {
4602 struct it it2 = *it;
4603
4604 if (handle_display_prop (&it2) == HANDLED_RETURN)
4605 visible_p = 0;
4606 }
4607#endif
4608 4692
4609 /* Back one more newline if the current one is invisible. */ 4693 /* If newline has a display property that replaces the newline with something
4610 if (!visible_p) 4694 else (image or text), find start of overlay or interval and continue search
4611 back_to_previous_line_start (it); 4695 from that point. */
4696 {
4697 struct it it2 = *it;
4698 int pos = IT_CHARPOS (*it);
4699 int beg, end;
4700 Lisp_Object val, overlay;
4701
4702 it2.sp = 0;
4703 if (handle_display_prop (&it2) == HANDLED_RETURN
4704 && !NILP (val = get_char_property_and_overlay
4705 (make_number (pos), Qdisplay, Qnil, &overlay))
4706 && (OVERLAYP (overlay)
4707 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
4708 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil)))
4709 {
4710 if (beg < BEGV)
4711 beg = BEGV;
4712 IT_CHARPOS (*it) = beg;
4713 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
4714 continue;
4715 }
4716 }
4717 break;
4612 } 4718 }
4613 4719
4614 xassert (IT_CHARPOS (*it) >= BEGV); 4720 xassert (IT_CHARPOS (*it) >= BEGV);
@@ -4906,8 +5012,10 @@ get_next_display_element (it)
4906 it->dpvec = v->contents; 5012 it->dpvec = v->contents;
4907 it->dpend = v->contents + v->size; 5013 it->dpend = v->contents + v->size;
4908 it->current.dpvec_index = 0; 5014 it->current.dpvec_index = 0;
5015 it->dpvec_face_id = -1;
4909 it->saved_face_id = it->face_id; 5016 it->saved_face_id = it->face_id;
4910 it->method = next_element_from_display_vector; 5017 it->method = next_element_from_display_vector;
5018 it->ellipsis_p = 0;
4911 } 5019 }
4912 else 5020 else
4913 { 5021 {
@@ -4939,8 +5047,8 @@ get_next_display_element (it)
4939 ? ((it->c >= 127 5047 ? ((it->c >= 127
4940 && it->len == 1) 5048 && it->len == 1)
4941 || !CHAR_PRINTABLE_P (it->c) 5049 || !CHAR_PRINTABLE_P (it->c)
4942 || it->c == 0x8ad 5050 || (!NILP (Vshow_nonbreak_escape)
4943 || it->c == 0x8a0) 5051 && (it->c == 0x8ad || it->c == 0x8a0)))
4944 : (it->c >= 127 5052 : (it->c >= 127
4945 && (!unibyte_display_via_language_environment 5053 && (!unibyte_display_via_language_environment
4946 || it->c == unibyte_char_to_multibyte (it->c))))) 5054 || it->c == unibyte_char_to_multibyte (it->c)))))
@@ -4952,21 +5060,8 @@ get_next_display_element (it)
4952 display. Then, set IT->dpvec to these glyphs. */ 5060 display. Then, set IT->dpvec to these glyphs. */
4953 GLYPH g; 5061 GLYPH g;
4954 int ctl_len; 5062 int ctl_len;
4955 int face_id = escape_glyph_face; 5063 int face_id, lface_id;
4956 5064 GLYPH escape_glyph;
4957 /* Find the face id if `escape-glyph' unless we recently did. */
4958 if (face_id < 0)
4959 {
4960 Lisp_Object tem = Fget (Qescape_glyph, Qface);
4961 if (INTEGERP (tem))
4962 face_id = XINT (tem);
4963 else
4964 face_id = 0;
4965 /* If there's overflow, use 0 instead. */
4966 if (FAST_GLYPH_FACE (FAST_MAKE_GLYPH (0, face_id)) != face_id)
4967 face_id = 0;
4968 escape_glyph_face = face_id;
4969 }
4970 5065
4971 if (it->c < 128 && it->ctl_arrow_p) 5066 if (it->c < 128 && it->ctl_arrow_p)
4972 { 5067 {
@@ -4974,57 +5069,78 @@ get_next_display_element (it)
4974 if (it->dp 5069 if (it->dp
4975 && INTEGERP (DISP_CTRL_GLYPH (it->dp)) 5070 && INTEGERP (DISP_CTRL_GLYPH (it->dp))
4976 && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp)))) 5071 && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp))))
4977 g = XINT (DISP_CTRL_GLYPH (it->dp)); 5072 {
5073 g = XINT (DISP_CTRL_GLYPH (it->dp));
5074 lface_id = FAST_GLYPH_FACE (g);
5075 if (lface_id)
5076 {
5077 g = FAST_GLYPH_CHAR (g);
5078 face_id = merge_faces (it->f, Qt, lface_id,
5079 it->face_id);
5080 }
5081 }
4978 else 5082 else
4979 g = FAST_MAKE_GLYPH ('^', face_id); 5083 {
4980 XSETINT (it->ctl_chars[0], g); 5084 /* Merge the escape-glyph face into the current face. */
5085 face_id = merge_faces (it->f, Qescape_glyph, 0,
5086 it->face_id);
5087 g = '^';
5088 }
4981 5089
4982 g = FAST_MAKE_GLYPH (it->c ^ 0100, face_id); 5090 XSETINT (it->ctl_chars[0], g);
5091 g = it->c ^ 0100;
4983 XSETINT (it->ctl_chars[1], g); 5092 XSETINT (it->ctl_chars[1], g);
4984 ctl_len = 2; 5093 ctl_len = 2;
5094 goto display_control;
4985 } 5095 }
4986 else if (it->c == 0x8a0 || it->c == 0x8ad) 5096
5097 if (it->dp
5098 && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
5099 && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
4987 { 5100 {
4988 /* Set IT->ctl_chars[0] to the glyph for `\\'. */ 5101 escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
4989 if (it->dp 5102 lface_id = FAST_GLYPH_FACE (escape_glyph);
4990 && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) 5103 if (lface_id)
4991 && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (it->dp)))) 5104 {
4992 g = XINT (DISP_ESCAPE_GLYPH (it->dp)); 5105 escape_glyph = FAST_GLYPH_CHAR (escape_glyph);
4993 else 5106 face_id = merge_faces (it->f, Qt, lface_id,
4994 g = FAST_MAKE_GLYPH ('\\', face_id); 5107 it->face_id);
4995 XSETINT (it->ctl_chars[0], g); 5108 }
5109 }
5110 else
5111 {
5112 /* Merge the escape-glyph face into the current face. */
5113 face_id = merge_faces (it->f, Qescape_glyph, 0,
5114 it->face_id);
5115 escape_glyph = '\\';
5116 }
4996 5117
4997 g = FAST_MAKE_GLYPH (it->c == 0x8ad ? '-' : ' ', face_id); 5118 if (it->c == 0x8a0 || it->c == 0x8ad)
5119 {
5120 XSETINT (it->ctl_chars[0], escape_glyph);
5121 g = it->c == 0x8ad ? '-' : ' ';
4998 XSETINT (it->ctl_chars[1], g); 5122 XSETINT (it->ctl_chars[1], g);
4999 ctl_len = 2; 5123 ctl_len = 2;
5124 goto display_control;
5000 } 5125 }
5001 else
5002 {
5003 unsigned char str[MAX_MULTIBYTE_LENGTH];
5004 int len;
5005 int i;
5006 GLYPH escape_glyph;
5007 5126
5008 /* Set IT->ctl_chars[0] to the glyph for `\\'. */ 5127 {
5009 if (it->dp 5128 unsigned char str[MAX_MULTIBYTE_LENGTH];
5010 && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) 5129 int len;
5011 && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) 5130 int i;
5012 escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
5013 else
5014 escape_glyph = FAST_MAKE_GLYPH ('\\', face_id);
5015 5131
5016 if (SINGLE_BYTE_CHAR_P (it->c)) 5132 /* Set IT->ctl_chars[0] to the glyph for `\\'. */
5017 str[0] = it->c, len = 1; 5133 if (SINGLE_BYTE_CHAR_P (it->c))
5018 else 5134 str[0] = it->c, len = 1;
5019 { 5135 else
5020 len = CHAR_STRING_NO_SIGNAL (it->c, str); 5136 {
5021 if (len < 0) 5137 len = CHAR_STRING_NO_SIGNAL (it->c, str);
5022 { 5138 if (len < 0)
5023 /* It's an invalid character, which 5139 {
5024 shouldn't happen actually, but due to 5140 /* It's an invalid character, which shouldn't
5025 bugs it may happen. Let's print the char 5141 happen actually, but due to bugs it may
5026 as is, there's not much meaningful we can 5142 happen. Let's print the char as is, there's
5027 do with it. */ 5143 not much meaningful we can do with it. */
5028 str[0] = it->c; 5144 str[0] = it->c;
5029 str[1] = it->c >> 8; 5145 str[1] = it->c >> 8;
5030 str[2] = it->c >> 16; 5146 str[2] = it->c >> 16;
@@ -5033,31 +5149,31 @@ get_next_display_element (it)
5033 } 5149 }
5034 } 5150 }
5035 5151
5036 for (i = 0; i < len; i++) 5152 for (i = 0; i < len; i++)
5037 { 5153 {
5038 XSETINT (it->ctl_chars[i * 4], escape_glyph); 5154 XSETINT (it->ctl_chars[i * 4], escape_glyph);
5039 /* Insert three more glyphs into IT->ctl_chars for 5155 /* Insert three more glyphs into IT->ctl_chars for
5040 the octal display of the character. */ 5156 the octal display of the character. */
5041 g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', 5157 g = ((str[i] >> 6) & 7) + '0';
5042 face_id); 5158 XSETINT (it->ctl_chars[i * 4 + 1], g);
5043 XSETINT (it->ctl_chars[i * 4 + 1], g); 5159 g = ((str[i] >> 3) & 7) + '0';
5044 g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', 5160 XSETINT (it->ctl_chars[i * 4 + 2], g);
5045 face_id); 5161 g = (str[i] & 7) + '0';
5046 XSETINT (it->ctl_chars[i * 4 + 2], g); 5162 XSETINT (it->ctl_chars[i * 4 + 3], g);
5047 g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 5163 }
5048 face_id); 5164 ctl_len = len * 4;
5049 XSETINT (it->ctl_chars[i * 4 + 3], g); 5165 }
5050 }
5051 ctl_len = len * 4;
5052 }
5053 5166
5167 display_control:
5054 /* Set up IT->dpvec and return first character from it. */ 5168 /* Set up IT->dpvec and return first character from it. */
5055 it->dpvec_char_len = it->len; 5169 it->dpvec_char_len = it->len;
5056 it->dpvec = it->ctl_chars; 5170 it->dpvec = it->ctl_chars;
5057 it->dpend = it->dpvec + ctl_len; 5171 it->dpend = it->dpvec + ctl_len;
5058 it->current.dpvec_index = 0; 5172 it->current.dpvec_index = 0;
5173 it->dpvec_face_id = face_id;
5059 it->saved_face_id = it->face_id; 5174 it->saved_face_id = it->face_id;
5060 it->method = next_element_from_display_vector; 5175 it->method = next_element_from_display_vector;
5176 it->ellipsis_p = 0;
5061 goto get_next; 5177 goto get_next;
5062 } 5178 }
5063 } 5179 }
@@ -5180,9 +5296,6 @@ set_iterator_to_next (it, reseat_p)
5180 it->dpvec = NULL; 5296 it->dpvec = NULL;
5181 it->current.dpvec_index = -1; 5297 it->current.dpvec_index = -1;
5182 5298
5183 /* Recheck faces after display vector */
5184 it->stop_charpos = 0;
5185
5186 /* Skip over characters which were displayed via IT->dpvec. */ 5299 /* Skip over characters which were displayed via IT->dpvec. */
5187 if (it->dpvec_char_len < 0) 5300 if (it->dpvec_char_len < 0)
5188 reseat_at_next_visible_line_start (it, 1); 5301 reseat_at_next_visible_line_start (it, 1);
@@ -5191,6 +5304,9 @@ set_iterator_to_next (it, reseat_p)
5191 it->len = it->dpvec_char_len; 5304 it->len = it->dpvec_char_len;
5192 set_iterator_to_next (it, reseat_p); 5305 set_iterator_to_next (it, reseat_p);
5193 } 5306 }
5307
5308 /* Recheck faces after display vector */
5309 it->stop_charpos = IT_CHARPOS (*it);
5194 } 5310 }
5195 } 5311 }
5196 else if (it->method == next_element_from_string) 5312 else if (it->method == next_element_from_string)
@@ -5270,7 +5386,6 @@ next_element_from_display_vector (it)
5270 if (INTEGERP (*it->dpvec) 5386 if (INTEGERP (*it->dpvec)
5271 && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec))) 5387 && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec)))
5272 { 5388 {
5273 int lface_id;
5274 GLYPH g; 5389 GLYPH g;
5275 5390
5276 g = XFASTINT (it->dpvec[it->current.dpvec_index]); 5391 g = XFASTINT (it->dpvec[it->current.dpvec_index]);
@@ -5280,13 +5395,14 @@ next_element_from_display_vector (it)
5280 /* The entry may contain a face id to use. Such a face id is 5395 /* The entry may contain a face id to use. Such a face id is
5281 the id of a Lisp face, not a realized face. A face id of 5396 the id of a Lisp face, not a realized face. A face id of
5282 zero means no face is specified. */ 5397 zero means no face is specified. */
5283 lface_id = FAST_GLYPH_FACE (g); 5398 if (it->dpvec_face_id >= 0)
5284 if (lface_id) 5399 it->face_id = it->dpvec_face_id;
5400 else
5285 { 5401 {
5286 /* The function returns -1 if lface_id is invalid. */ 5402 int lface_id = FAST_GLYPH_FACE (g);
5287 int face_id = ascii_face_of_lisp_face (it->f, lface_id); 5403 if (lface_id > 0)
5288 if (face_id >= 0) 5404 it->face_id = merge_faces (it->f, Qt, lface_id,
5289 it->face_id = face_id; 5405 it->saved_face_id);
5290 } 5406 }
5291 } 5407 }
5292 else 5408 else
@@ -5699,10 +5815,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op)
5699 saved_glyph_row = it->glyph_row; 5815 saved_glyph_row = it->glyph_row;
5700 it->glyph_row = NULL; 5816 it->glyph_row = NULL;
5701 5817
5702#define BUFFER_POS_REACHED_P() \ 5818#define BUFFER_POS_REACHED_P() \
5703 ((op & MOVE_TO_POS) != 0 \ 5819 ((op & MOVE_TO_POS) != 0 \
5704 && BUFFERP (it->object) \ 5820 && BUFFERP (it->object) \
5705 && IT_CHARPOS (*it) >= to_charpos) 5821 && IT_CHARPOS (*it) >= to_charpos \
5822 && it->method == next_element_from_buffer)
5706 5823
5707 while (1) 5824 while (1)
5708 { 5825 {
@@ -6364,11 +6481,15 @@ move_it_by_lines (it, dvpos, need_y_p)
6364 it->current_y -= it2.current_y; 6481 it->current_y -= it2.current_y;
6365 it->current_x = it->hpos = 0; 6482 it->current_x = it->hpos = 0;
6366 6483
6367 /* If we moved too far, move IT some lines forward. */ 6484 /* If we moved too far back, move IT some lines forward. */
6368 if (it2.vpos > -dvpos) 6485 if (it2.vpos > -dvpos)
6369 { 6486 {
6370 int delta = it2.vpos + dvpos; 6487 int delta = it2.vpos + dvpos;
6488 it2 = *it;
6371 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); 6489 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS);
6490 /* Move back again if we got too far ahead. */
6491 if (IT_CHARPOS (*it) >= start_charpos)
6492 *it = it2;
6372 } 6493 }
6373 } 6494 }
6374} 6495}
@@ -7960,6 +8081,8 @@ echo_area_display (update_frame_p)
7960 8081
7961 /* Last displayed message is now the current message. */ 8082 /* Last displayed message is now the current message. */
7962 echo_area_buffer[1] = echo_area_buffer[0]; 8083 echo_area_buffer[1] = echo_area_buffer[0];
8084 /* Inform read_char that we're not echoing. */
8085 echo_message_buffer = Qnil;
7963 8086
7964 /* Prevent redisplay optimization in redisplay_internal by resetting 8087 /* Prevent redisplay optimization in redisplay_internal by resetting
7965 this_line_start_pos. This is done because the mini-buffer now 8088 this_line_start_pos. This is done because the mini-buffer now
@@ -10808,6 +10931,18 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
10808 glyph = cursor; 10931 glyph = cursor;
10809 x = cursor_x; 10932 x = cursor_x;
10810 } 10933 }
10934 else if (row->ends_in_ellipsis_p && glyph == end)
10935 {
10936 /* Scan back over the ellipsis glyphs, decrementing positions. */
10937 while (glyph > row->glyphs[TEXT_AREA]
10938 && (glyph - 1)->charpos == last_pos)
10939 glyph--, x -= glyph->pixel_width;
10940 /* That loop always goes one position too far,
10941 including the glyph before the ellipsis.
10942 So scan forward over that one. */
10943 x += glyph->pixel_width;
10944 glyph++;
10945 }
10811 else if (string_start 10946 else if (string_start
10812 && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old)) 10947 && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old))
10813 { 10948 {
@@ -11646,9 +11781,6 @@ redisplay_window (window, just_this_one_p)
11646 *w->desired_matrix->method = 0; 11781 *w->desired_matrix->method = 0;
11647#endif 11782#endif
11648 11783
11649 /* Force this to be looked up again for each redisp of each window. */
11650 escape_glyph_face = -1;
11651
11652 specbind (Qinhibit_point_motion_hooks, Qt); 11784 specbind (Qinhibit_point_motion_hooks, Qt);
11653 11785
11654 reconsider_clip_changes (w, buffer); 11786 reconsider_clip_changes (w, buffer);
@@ -12193,6 +12325,8 @@ redisplay_window (window, just_this_one_p)
12193 /* If centering point failed to make the whole line visible, 12325 /* If centering point failed to make the whole line visible,
12194 put point at the top instead. That has to make the whole line 12326 put point at the top instead. That has to make the whole line
12195 visible, if it can be done. */ 12327 visible, if it can be done. */
12328 if (centering_position == 0)
12329 goto done;
12196 clear_glyph_matrix (w->desired_matrix); 12330 clear_glyph_matrix (w->desired_matrix);
12197 centering_position = 0; 12331 centering_position = 0;
12198 goto point_at_top; 12332 goto point_at_top;
@@ -14614,10 +14748,22 @@ cursor_row_p (w, row)
14614 /* If the row ends with a newline from a string, we don't want 14748 /* If the row ends with a newline from a string, we don't want
14615 the cursor there (if the row is continued it doesn't end in a 14749 the cursor there (if the row is continued it doesn't end in a
14616 newline). */ 14750 newline). */
14617 if (CHARPOS (row->end.string_pos) >= 0 14751 if (CHARPOS (row->end.string_pos) >= 0)
14618 || MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
14619 cursor_row_p = row->continued_p; 14752 cursor_row_p = row->continued_p;
14620 14753 else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
14754 {
14755 /* If the row ends in middle of a real character,
14756 and the line is continued, we want the cursor here.
14757 That's because MATRIX_ROW_END_CHARPOS would equal
14758 PT if PT is before the character. */
14759 if (!row->ends_in_ellipsis_p)
14760 cursor_row_p = row->continued_p;
14761 else
14762 /* If the row ends in an ellipsis, then
14763 MATRIX_ROW_END_CHARPOS will equal point after the invisible text.
14764 We want that position to be displayed after the ellipsis. */
14765 cursor_row_p = 0;
14766 }
14621 /* If the row ends at ZV, display the cursor at the end of that 14767 /* If the row ends at ZV, display the cursor at the end of that
14622 row instead of at the start of the row below. */ 14768 row instead of at the start of the row below. */
14623 else if (row->ends_at_zv_p) 14769 else if (row->ends_at_zv_p)
@@ -15094,6 +15240,11 @@ display_line (it)
15094 /* Remember the position at which this line ends. */ 15240 /* Remember the position at which this line ends. */
15095 row->end = it->current; 15241 row->end = it->current;
15096 15242
15243 /* Record whether this row ends inside an ellipsis. */
15244 row->ends_in_ellipsis_p
15245 = (it->method == next_element_from_display_vector
15246 && it->ellipsis_p);
15247
15097 /* Save fringe bitmaps in this row. */ 15248 /* Save fringe bitmaps in this row. */
15098 row->left_user_fringe_bitmap = it->left_user_fringe_bitmap; 15249 row->left_user_fringe_bitmap = it->left_user_fringe_bitmap;
15099 row->left_user_fringe_face_id = it->left_user_fringe_face_id; 15250 row->left_user_fringe_face_id = it->left_user_fringe_face_id;
@@ -15937,22 +16088,30 @@ store_mode_line_string (string, lisp_string, copy_string, field_width, precision
15937 16088
15938 16089
15939DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, 16090DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
15940 0, 4, 0, 16091 1, 4, 0,
15941 doc: /* Return the mode-line of selected window as a string. 16092 doc: /* Format a string out of a mode line format specification.
15942First optional arg FORMAT specifies a different format string (see 16093First arg FORMAT specifies the mode line format (see `mode-line-format'
15943`mode-line-format' for details) to use. If FORMAT is t, return 16094for details) to use.
15944the buffer's header-line. Second optional arg WINDOW specifies a 16095
15945different window to use as the context for the formatting. 16096Optional second arg FACE specifies the face property to put
15946If third optional arg NO-PROPS is non-nil, string is not propertized. 16097on all characters for which no face is specified.
15947Fourth optional arg BUFFER specifies which buffer to use. */) 16098t means whatever face the window's mode line currently uses
15948 (format, window, no_props, buffer) 16099\(either `mode-line' or `mode-line-inactive', depending).
15949 Lisp_Object format, window, no_props, buffer; 16100nil means the default is no face property.
16101If FACE is an integer, the value string has no text properties.
16102
16103Optional third and fourth args WINDOW and BUFFER specify the window
16104and buffer to use as the context for the formatting (defaults
16105are the selected window and the window's buffer). */)
16106 (format, face, window, buffer)
16107 Lisp_Object format, face, window, buffer;
15950{ 16108{
15951 struct it it; 16109 struct it it;
15952 int len; 16110 int len;
15953 struct window *w; 16111 struct window *w;
15954 struct buffer *old_buffer = NULL; 16112 struct buffer *old_buffer = NULL;
15955 enum face_id face_id = DEFAULT_FACE_ID; 16113 int face_id = -1;
16114 int no_props = INTEGERP (face);
15956 16115
15957 if (NILP (window)) 16116 if (NILP (window))
15958 window = selected_window; 16117 window = selected_window;
@@ -15961,37 +16120,37 @@ Fourth optional arg BUFFER specifies which buffer to use. */)
15961 16120
15962 if (NILP (buffer)) 16121 if (NILP (buffer))
15963 buffer = w->buffer; 16122 buffer = w->buffer;
15964
15965 CHECK_BUFFER (buffer); 16123 CHECK_BUFFER (buffer);
15966 16124
15967 if (XBUFFER (buffer) != current_buffer) 16125 if (NILP (format))
16126 return build_string ("");
16127
16128 if (no_props)
16129 face = Qnil;
16130
16131 if (!NILP (face))
15968 { 16132 {
15969 old_buffer = current_buffer; 16133 if (EQ (face, Qt))
15970 set_buffer_internal_1 (XBUFFER (buffer)); 16134 face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive);
16135 face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0, 0);
15971 } 16136 }
15972 16137
15973 if (NILP (format) || EQ (format, Qt)) 16138 if (face_id < 0)
16139 face_id = DEFAULT_FACE_ID;
16140
16141 if (XBUFFER (buffer) != current_buffer)
15974 { 16142 {
15975 face_id = (NILP (format) 16143 old_buffer = current_buffer;
15976 ? CURRENT_MODE_LINE_FACE_ID (w) 16144 set_buffer_internal_1 (XBUFFER (buffer));
15977 : HEADER_LINE_FACE_ID);
15978 format = (NILP (format)
15979 ? current_buffer->mode_line_format
15980 : current_buffer->header_line_format);
15981 } 16145 }
15982 16146
15983 init_iterator (&it, w, -1, -1, NULL, face_id); 16147 init_iterator (&it, w, -1, -1, NULL, face_id);
15984 16148
15985 if (NILP (no_props)) 16149 if (!no_props)
15986 { 16150 {
15987 mode_line_string_face 16151 mode_line_string_face = face;
15988 = (face_id == MODE_LINE_FACE_ID ? Qmode_line
15989 : face_id == MODE_LINE_INACTIVE_FACE_ID ? Qmode_line_inactive
15990 : face_id == HEADER_LINE_FACE_ID ? Qheader_line : Qnil);
15991
15992 mode_line_string_face_prop 16152 mode_line_string_face_prop
15993 = (NILP (mode_line_string_face) ? Qnil 16153 = (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil)));
15994 : Fcons (Qface, Fcons (mode_line_string_face, Qnil)));
15995 16154
15996 /* We need a dummy last element in mode_line_string_list to 16155 /* We need a dummy last element in mode_line_string_list to
15997 indicate we are building the propertized mode-line string. 16156 indicate we are building the propertized mode-line string.
@@ -16014,7 +16173,7 @@ Fourth optional arg BUFFER specifies which buffer to use. */)
16014 if (old_buffer) 16173 if (old_buffer)
16015 set_buffer_internal_1 (old_buffer); 16174 set_buffer_internal_1 (old_buffer);
16016 16175
16017 if (NILP (no_props)) 16176 if (!no_props)
16018 { 16177 {
16019 Lisp_Object str; 16178 Lisp_Object str;
16020 mode_line_string_list = Fnreverse (mode_line_string_list); 16179 mode_line_string_list = Fnreverse (mode_line_string_list);
@@ -18171,6 +18330,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18171{ 18330{
18172 struct glyph_string *head, *tail; 18331 struct glyph_string *head, *tail;
18173 struct glyph_string *s; 18332 struct glyph_string *s;
18333 struct glyph_string *clip_head = NULL, *clip_tail = NULL;
18174 int last_x, area_width; 18334 int last_x, area_width;
18175 int x_reached; 18335 int x_reached;
18176 int i, j; 18336 int i, j;
@@ -18239,6 +18399,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18239 start = i; 18399 start = i;
18240 compute_overhangs_and_x (t, head->x, 1); 18400 compute_overhangs_and_x (t, head->x, 1);
18241 prepend_glyph_string_lists (&head, &tail, h, t); 18401 prepend_glyph_string_lists (&head, &tail, h, t);
18402 clip_head = head;
18242 } 18403 }
18243 18404
18244 /* Prepend glyph strings for glyphs in front of the first glyph 18405 /* Prepend glyph strings for glyphs in front of the first glyph
@@ -18251,6 +18412,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18251 i = left_overwriting (head); 18412 i = left_overwriting (head);
18252 if (i >= 0) 18413 if (i >= 0)
18253 { 18414 {
18415 clip_head = head;
18254 BUILD_GLYPH_STRINGS (i, start, h, t, 18416 BUILD_GLYPH_STRINGS (i, start, h, t,
18255 DRAW_NORMAL_TEXT, dummy_x, last_x); 18417 DRAW_NORMAL_TEXT, dummy_x, last_x);
18256 for (s = h; s; s = s->next) 18418 for (s = h; s; s = s->next)
@@ -18270,6 +18432,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18270 DRAW_NORMAL_TEXT, x, last_x); 18432 DRAW_NORMAL_TEXT, x, last_x);
18271 compute_overhangs_and_x (h, tail->x + tail->width, 0); 18433 compute_overhangs_and_x (h, tail->x + tail->width, 0);
18272 append_glyph_string_lists (&head, &tail, h, t); 18434 append_glyph_string_lists (&head, &tail, h, t);
18435 clip_tail = tail;
18273 } 18436 }
18274 18437
18275 /* Append glyph strings for glyphs following the last glyph 18438 /* Append glyph strings for glyphs following the last glyph
@@ -18280,6 +18443,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18280 i = right_overwriting (tail); 18443 i = right_overwriting (tail);
18281 if (i >= 0) 18444 if (i >= 0)
18282 { 18445 {
18446 clip_tail = tail;
18283 BUILD_GLYPH_STRINGS (end, i, h, t, 18447 BUILD_GLYPH_STRINGS (end, i, h, t,
18284 DRAW_NORMAL_TEXT, x, last_x); 18448 DRAW_NORMAL_TEXT, x, last_x);
18285 for (s = h; s; s = s->next) 18449 for (s = h; s; s = s->next)
@@ -18287,6 +18451,12 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18287 compute_overhangs_and_x (h, tail->x + tail->width, 0); 18451 compute_overhangs_and_x (h, tail->x + tail->width, 0);
18288 append_glyph_string_lists (&head, &tail, h, t); 18452 append_glyph_string_lists (&head, &tail, h, t);
18289 } 18453 }
18454 if (clip_head || clip_tail)
18455 for (s = head; s; s = s->next)
18456 {
18457 s->clip_head = clip_head;
18458 s->clip_tail = clip_tail;
18459 }
18290 } 18460 }
18291 18461
18292 /* Draw all strings. */ 18462 /* Draw all strings. */
@@ -18300,8 +18470,9 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
18300 completely. */ 18470 completely. */
18301 && !overlaps_p) 18471 && !overlaps_p)
18302 { 18472 {
18303 int x0 = head ? head->x : x; 18473 int x0 = clip_head ? clip_head->x : (head ? head->x : x);
18304 int x1 = tail ? tail->x + tail->background_width : x; 18474 int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width
18475 : (tail ? tail->x + tail->background_width : x));
18305 18476
18306 int text_left = window_box_left (w, TEXT_AREA); 18477 int text_left = window_box_left (w, TEXT_AREA);
18307 x0 -= text_left; 18478 x0 -= text_left;
@@ -20553,6 +20724,28 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop)
20553 past_end = 1; 20724 past_end = 1;
20554 } 20725 }
20555 20726
20727 /* If whole rows or last part of a row came from a display overlay,
20728 row_containing_pos will skip over such rows because their end pos
20729 equals the start pos of the overlay or interval. Backtrack if we
20730 have a STOP object and previous row's end glyph came from STOP. */
20731 if (!NILP (stop))
20732 {
20733 struct glyph_row *prev = row-1;
20734 while ((prev = row - 1, prev >= first)
20735 && MATRIX_ROW_END_CHARPOS (prev) == charpos
20736 && prev->used[TEXT_AREA] > 0)
20737 {
20738 end = prev->glyphs[TEXT_AREA];
20739 glyph = end + prev->used[TEXT_AREA];
20740 while (--glyph >= end
20741 && INTEGERP (glyph->object));
20742 if (glyph >= end
20743 && !EQ (stop, glyph->object))
20744 break;
20745 row = prev;
20746 }
20747 }
20748
20556 *x = row->x; 20749 *x = row->x;
20557 *y = row->y; 20750 *y = row->y;
20558 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix); 20751 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix);
@@ -21013,9 +21206,9 @@ note_mode_line_or_margin_highlight (w, x, y, area)
21013 help_echo_pos = charpos; 21206 help_echo_pos = charpos;
21014 } 21207 }
21015 } 21208 }
21016 if (NILP (pointer))
21017 pointer = Fsafe_plist_get (XCDR (object), QCpointer);
21018 } 21209 }
21210 if (NILP (pointer))
21211 pointer = Fsafe_plist_get (XCDR (object), QCpointer);
21019 } 21212 }
21020 21213
21021 if (STRINGP (string)) 21214 if (STRINGP (string))
@@ -22319,6 +22512,10 @@ wide as that tab on the display. */);
22319The face used for trailing whitespace is `trailing-whitespace'. */); 22512The face used for trailing whitespace is `trailing-whitespace'. */);
22320 Vshow_trailing_whitespace = Qnil; 22513 Vshow_trailing_whitespace = Qnil;
22321 22514
22515 DEFVAR_LISP ("show-nonbreak-escape", &Vshow_nonbreak_escape,
22516 doc: /* *Non-nil means display escape character before non-break space and hyphen. */);
22517 Vshow_nonbreak_escape = Qt;
22518
22322 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, 22519 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
22323 doc: /* *The pointer shape to show in void text areas. 22520 doc: /* *The pointer shape to show in void text areas.
22324Nil means to show the text pointer. Other options are `arrow', `text', 22521Nil means to show the text pointer. Other options are `arrow', `text',
diff --git a/src/xfaces.c b/src/xfaces.c
index a1b6b4bc775..e592357c067 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -7696,6 +7696,69 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
7696} 7696}
7697 7697
7698 7698
7699/* Merge a face into a realized face.
7700
7701 F is frame where faces are (to be) realized.
7702
7703 FACE_NAME is named face to merge.
7704
7705 If FACE_NAME is nil, FACE_ID is face_id of realized face to merge.
7706
7707 If FACE_NAME is t, FACE_ID is lface_id of face to merge.
7708
7709 BASE_FACE_ID is realized face to merge into.
7710
7711 Return new face id.
7712*/
7713
7714int
7715merge_faces (f, face_name, face_id, base_face_id)
7716 struct frame *f;
7717 Lisp_Object face_name;
7718 int face_id, base_face_id;
7719{
7720 Lisp_Object attrs[LFACE_VECTOR_SIZE];
7721 struct face *base_face;
7722
7723 base_face = FACE_FROM_ID (f, base_face_id);
7724 if (!base_face)
7725 return base_face_id;
7726
7727 if (EQ (face_name, Qt))
7728 {
7729 if (face_id < 0 || face_id >= lface_id_to_name_size)
7730 return base_face_id;
7731 face_name = lface_id_to_name[face_id];
7732 face_id = lookup_derived_face (f, face_name, 0, base_face_id);
7733 if (face_id >= 0)
7734 return face_id;
7735 return base_face_id;
7736 }
7737
7738 /* Begin with attributes from the base face. */
7739 bcopy (base_face->lface, attrs, sizeof attrs);
7740
7741 if (!NILP (face_name))
7742 {
7743 if (!merge_named_face (f, face_name, attrs, 0))
7744 return base_face_id;
7745 }
7746 else
7747 {
7748 struct face *face;
7749 if (face_id < 0)
7750 return base_face_id;
7751 face = FACE_FROM_ID (f, face_id);
7752 if (!face)
7753 return base_face_id;
7754 merge_face_vectors (f, face->lface, attrs, 0);
7755 }
7756
7757 /* Look up a realized face with the given face attributes,
7758 or realize a new one for ASCII characters. */
7759 return lookup_face (f, attrs, 0, NULL);
7760}
7761
7699 7762
7700/*********************************************************************** 7763/***********************************************************************
7701 Tests 7764 Tests
diff --git a/src/xfns.c b/src/xfns.c
index 6a99dbf8e5b..cafa36ae11c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4358,11 +4358,15 @@ show_hourglass (timer)
4358 { 4358 {
4359 unsigned long mask = CWCursor; 4359 unsigned long mask = CWCursor;
4360 XSetWindowAttributes attrs; 4360 XSetWindowAttributes attrs;
4361 4361#ifdef USE_GTK
4362 Window parent = FRAME_X_WINDOW (f);
4363#else
4364 Window parent = FRAME_OUTER_WINDOW (f);
4365#endif
4362 attrs.cursor = f->output_data.x->hourglass_cursor; 4366 attrs.cursor = f->output_data.x->hourglass_cursor;
4363 4367
4364 f->output_data.x->hourglass_window 4368 f->output_data.x->hourglass_window
4365 = XCreateWindow (dpy, FRAME_OUTER_WINDOW (f), 4369 = XCreateWindow (dpy, parent,
4366 0, 0, 32000, 32000, 0, 0, 4370 0, 0, 32000, 32000, 0, 0,
4367 InputOnly, 4371 InputOnly,
4368 CopyFromParent, 4372 CopyFromParent,
diff --git a/src/xmenu.c b/src/xmenu.c
index 774f404fd42..f6e0523378f 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -2454,10 +2454,6 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2454 G_CALLBACK (menu_highlight_callback)); 2454 G_CALLBACK (menu_highlight_callback));
2455 xg_crazy_callback_abort = 0; 2455 xg_crazy_callback_abort = 0;
2456 2456
2457 for (i = 0; i < 5; i++)
2458 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
2459 break;
2460
2461 if (! for_click) 2457 if (! for_click)
2462 { 2458 {
2463 /* Not invoked by a click. pop up at x/y. */ 2459 /* Not invoked by a click. pop up at x/y. */
@@ -2470,8 +2466,16 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2470 popup_x_y.x = x; 2466 popup_x_y.x = x;
2471 popup_x_y.y = y; 2467 popup_x_y.y = y;
2472 popup_x_y.f = f; 2468 popup_x_y.f = f;
2473 }
2474 2469
2470 i = 0; /* gtk_menu_popup needs this to be 0 for a non-button popup. */
2471 }
2472 else
2473 {
2474 for (i = 0; i < 5; i++)
2475 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
2476 break;
2477 }
2478
2475 /* Display the menu. */ 2479 /* Display the menu. */
2476 gtk_widget_show_all (menu); 2480 gtk_widget_show_all (menu);
2477 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); 2481 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
diff --git a/src/xselect.c b/src/xselect.c
index 1a033f1d973..f26014746ba 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1400,7 +1400,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1400 else if (INTEGERP (time_stamp)) 1400 else if (INTEGERP (time_stamp))
1401 requestor_time = (Time) XUINT (time_stamp); 1401 requestor_time = (Time) XUINT (time_stamp);
1402 else if (FLOATP (time_stamp)) 1402 else if (FLOATP (time_stamp))
1403 requestor_time = (Time) XFLOAT (time_stamp); 1403 requestor_time = (Time) XFLOAT_DATA (time_stamp);
1404 else 1404 else
1405 error ("TIME_STAMP must be cons or number"); 1405 error ("TIME_STAMP must be cons or number");
1406 } 1406 }
@@ -2500,7 +2500,7 @@ x_check_property_data (data)
2500 DPY is the display use to look up X atoms. 2500 DPY is the display use to look up X atoms.
2501 DATA is a Lisp list of values to be converted. 2501 DATA is a Lisp list of values to be converted.
2502 RET is the C array that contains the converted values. It is assumed 2502 RET is the C array that contains the converted values. It is assumed
2503 it is big enough to hol all values. 2503 it is big enough to hold all values.
2504 FORMAT is 8, 16 or 32 and gives the size in bits for each C value to 2504 FORMAT is 8, 16 or 32 and gives the size in bits for each C value to
2505 be stored in RET. */ 2505 be stored in RET. */
2506 2506
@@ -2524,7 +2524,7 @@ x_fill_property_data (dpy, data, ret, format)
2524 if (INTEGERP (o)) 2524 if (INTEGERP (o))
2525 val = (CARD32) XFASTINT (o); 2525 val = (CARD32) XFASTINT (o);
2526 else if (FLOATP (o)) 2526 else if (FLOATP (o))
2527 val = (CARD32) XFLOAT (o); 2527 val = (CARD32) XFLOAT_DATA (o);
2528 else if (CONSP (o)) 2528 else if (CONSP (o))
2529 val = (CARD32) cons_to_long (o); 2529 val = (CARD32) cons_to_long (o);
2530 else if (STRINGP (o)) 2530 else if (STRINGP (o))
@@ -2629,7 +2629,7 @@ If the value is 0 or the atom is not known, return the empty string. */)
2629 if (INTEGERP (value)) 2629 if (INTEGERP (value))
2630 atom = (Atom) XUINT (value); 2630 atom = (Atom) XUINT (value);
2631 else if (FLOATP (value)) 2631 else if (FLOATP (value))
2632 atom = (Atom) XFLOAT (value); 2632 atom = (Atom) XFLOAT_DATA (value);
2633 else if (CONSP (value)) 2633 else if (CONSP (value))
2634 atom = (Atom) cons_to_long (value); 2634 atom = (Atom) cons_to_long (value);
2635 else 2635 else
@@ -2761,7 +2761,7 @@ are ignored. */)
2761 else if (INTEGERP (dest)) 2761 else if (INTEGERP (dest))
2762 wdest = (Window) XFASTINT (dest); 2762 wdest = (Window) XFASTINT (dest);
2763 else if (FLOATP (dest)) 2763 else if (FLOATP (dest))
2764 wdest = (Window) XFLOAT (dest); 2764 wdest = (Window) XFLOAT_DATA (dest);
2765 else if (CONSP (dest)) 2765 else if (CONSP (dest))
2766 { 2766 {
2767 if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest))) 2767 if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest)))
diff --git a/src/xterm.c b/src/xterm.c
index 766f0ed0b75..367b7741fa6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,6 +1,6 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000,01,02,03,04 2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -2129,15 +2129,9 @@ x_draw_glyph_string_box (s)
2129 struct glyph *last_glyph; 2129 struct glyph *last_glyph;
2130 XRectangle clip_rect; 2130 XRectangle clip_rect;
2131 2131
2132 last_x = window_box_right (s->w, s->area); 2132 last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
2133 if (s->row->full_width_p 2133 ? WINDOW_RIGHT_EDGE_X (s->w)
2134 && !s->w->pseudo_window_p) 2134 : window_box_right (s->w, s->area));
2135 {
2136 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
2137 if (s->area != RIGHT_MARGIN_AREA
2138 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2139 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
2140 }
2141 2135
2142 /* The glyph that may have a right box line. */ 2136 /* The glyph that may have a right box line. */
2143 last_glyph = (s->cmp || s->img 2137 last_glyph = (s->cmp || s->img
@@ -4332,7 +4326,7 @@ xg_scroll_callback (widget, data)
4332 } 4326 }
4333 4327
4334 if (part >= 0) 4328 if (part >= 0)
4335 { 4329 {
4336 window_being_scrolled = bar->window; 4330 window_being_scrolled = bar->window;
4337 last_scroll_bar_part = part; 4331 last_scroll_bar_part = part;
4338 x_send_scroll_bar_event (bar->window, part, portion, whole); 4332 x_send_scroll_bar_event (bar->window, part, portion, whole);
@@ -7159,7 +7153,7 @@ x_clip_to_row (w, row, area, gc)
7159 window_box (w, area, &window_x, &window_y, &window_width, 0); 7153 window_box (w, area, &window_x, &window_y, &window_width, 0);
7160 7154
7161 clip_rect.x = window_x; 7155 clip_rect.x = window_x;
7162 clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 7156 clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
7163 clip_rect.y = max (clip_rect.y, window_y); 7157 clip_rect.y = max (clip_rect.y, window_y);
7164 clip_rect.width = window_width; 7158 clip_rect.width = window_width;
7165 clip_rect.height = row->visible_height; 7159 clip_rect.height = row->visible_height;
@@ -7189,29 +7183,10 @@ x_draw_hollow_cursor (w, row)
7189 if (cursor_glyph == NULL) 7183 if (cursor_glyph == NULL)
7190 return; 7184 return;
7191 7185
7192 /* Compute the width of the rectangle to draw. If on a stretch 7186 /* Compute frame-relative coordinates for phys cursor. */
7193 glyph, and `x-stretch-block-cursor' is nil, don't draw a
7194 rectangle as wide as the glyph, but use a canonical character
7195 width instead. */
7196 wd = cursor_glyph->pixel_width - 1;
7197 if (cursor_glyph->type == STRETCH_GLYPH
7198 && !x_stretch_cursor_p)
7199 wd = min (FRAME_COLUMN_WIDTH (f), wd);
7200 w->phys_cursor_width = wd;
7201
7202 /* Compute frame-relative coordinates from window-relative
7203 coordinates. */
7204 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 7187 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
7205 y = WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y); 7188 y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
7206 7189 wd = w->phys_cursor_width;
7207 /* Compute the proper height and ascent of the rectangle, based
7208 on the actual glyph. Using the full height of the row looks
7209 bad when there are tall images on that row. */
7210 h = max (min (FRAME_LINE_HEIGHT (f), row->height),
7211 cursor_glyph->ascent + cursor_glyph->descent);
7212 if (h < row->height)
7213 y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
7214 h--;
7215 7190
7216 /* The foreground of cursor_gc is typically the same as the normal 7191 /* The foreground of cursor_gc is typically the same as the normal
7217 background color, which can cause the cursor box to be invisible. */ 7192 background color, which can cause the cursor box to be invisible. */
@@ -7779,12 +7754,41 @@ x_connection_closed (dpy, error_message)
7779 error ("%s", error_msg); 7754 error ("%s", error_msg);
7780} 7755}
7781 7756
7757/* We specifically use it before defining it, so that gcc doesn't inline it,
7758 otherwise gdb doesn't know how to properly put a breakpoint on it. */
7759static void x_error_quitter (Display *display, XErrorEvent *error);
7760
7761/* This is the first-level handler for X protocol errors.
7762 It calls x_error_quitter or x_error_catcher. */
7763
7764static int
7765x_error_handler (display, error)
7766 Display *display;
7767 XErrorEvent *error;
7768{
7769 if (! NILP (x_error_message_string))
7770 x_error_catcher (display, error);
7771 else
7772 x_error_quitter (display, error);
7773 return 0;
7774}
7782 7775
7783/* This is the usual handler for X protocol errors. 7776/* This is the usual handler for X protocol errors.
7784 It kills all frames on the display that we got the error for. 7777 It kills all frames on the display that we got the error for.
7785 If that was the only one, it prints an error message and kills Emacs. */ 7778 If that was the only one, it prints an error message and kills Emacs. */
7786 7779
7787static void 7780/* .gdbinit puts a breakpoint here, so make sure it is not inlined. */
7781
7782#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
7783#define NO_INLINE __attribute__((noinline))
7784#else
7785#define NO_INLINE
7786#endif
7787
7788/* On older GCC versions, just putting x_error_quitter
7789 after x_error_handler prevents inlining into the former. */
7790
7791static void NO_INLINE
7788x_error_quitter (display, error) 7792x_error_quitter (display, error)
7789 Display *display; 7793 Display *display;
7790 XErrorEvent *error; 7794 XErrorEvent *error;
@@ -7801,21 +7805,6 @@ x_error_quitter (display, error)
7801} 7805}
7802 7806
7803 7807
7804/* This is the first-level handler for X protocol errors.
7805 It calls x_error_quitter or x_error_catcher. */
7806
7807static int
7808x_error_handler (display, error)
7809 Display *display;
7810 XErrorEvent *error;
7811{
7812 if (! NILP (x_error_message_string))
7813 x_error_catcher (display, error);
7814 else
7815 x_error_quitter (display, error);
7816 return 0;
7817}
7818
7819/* This is the handler for X IO errors, always. 7808/* This is the handler for X IO errors, always.
7820 It kills all frames on the display that we lost touch with. 7809 It kills all frames on the display that we lost touch with.
7821 If that was the only one, it prints an error message and kills Emacs. */ 7810 If that was the only one, it prints an error message and kills Emacs. */
diff --git a/src/xterm.h b/src/xterm.h
index a5a4f88a7d4..5f568af935a 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -502,6 +502,8 @@ struct x_output
502 GtkWidget *toolbar_widget; 502 GtkWidget *toolbar_widget;
503 /* The handle box that makes the tool bar detachable. */ 503 /* The handle box that makes the tool bar detachable. */
504 GtkWidget *handlebox_widget; 504 GtkWidget *handlebox_widget;
505 /* Non-zero if the tool bar is detached. */
506 int toolbar_detached;
505 507
506 /* The last size hints set. */ 508 /* The last size hints set. */
507 GdkGeometry size_hints; 509 GdkGeometry size_hints;