aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-09-20 06:04:23 +0000
committerMiles Bader2006-09-20 06:04:23 +0000
commit465384748f74266cec1e2b9c9308eb82efb462b1 (patch)
tree28b11f0a737ad1add652e84c1f193843322be702 /src
parent863153c57b164f79f030f34dba6953a3d0d60097 (diff)
parent0327a4644bffc9570fe50dbb7a13a54726c4ff8b (diff)
downloademacs-465384748f74266cec1e2b9c9308eb82efb462b1.tar.gz
emacs-465384748f74266cec1e2b9c9308eb82efb462b1.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 437-446) - Update from CVS - lisp/url/url-methods.el: Fix format error when http_proxy is empty string - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 137-140) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-111
Diffstat (limited to 'src')
-rw-r--r--src/COPYING25
-rw-r--r--src/ChangeLog182
-rw-r--r--src/Makefile.in3
-rw-r--r--src/dispnew.c5
-rw-r--r--src/emacs.c2
-rw-r--r--src/gmalloc.c64
-rw-r--r--src/gtkutil.c87
-rw-r--r--src/indent.c8
-rw-r--r--src/keyboard.c15
-rw-r--r--src/keymap.c191
-rw-r--r--src/keymap.h4
-rw-r--r--src/mac.c8
-rw-r--r--src/macmenu.c63
-rw-r--r--src/macterm.c46
-rw-r--r--src/macterm.h10
-rw-r--r--src/md5.c8
-rw-r--r--src/md5.h8
-rw-r--r--src/print.c20
-rw-r--r--src/regex.c4
-rw-r--r--src/search.c23
-rw-r--r--src/strftime.c8
-rw-r--r--src/syntax.c5
-rw-r--r--src/window.c142
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xfns.c16
25 files changed, 720 insertions, 238 deletions
diff --git a/src/COPYING b/src/COPYING
index 3912109b5cd..d511905c164 100644
--- a/src/COPYING
+++ b/src/COPYING
@@ -1,8 +1,8 @@
1 GNU GENERAL PUBLIC LICENSE 1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991 2 Version 2, June 1991
3 3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies 6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed. 7 of this license document, but changing it is not allowed.
8 8
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software 15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to 16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by 17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to 18the GNU Lesser General Public License instead.) You can apply it to
19your programs, too. 19your programs, too.
20 20
21 When we speak of free software, we are referring to freedom, not 21 When we speak of free software, we are referring to freedom, not
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
55 55
56 The precise terms and conditions for copying, distribution and 56 The precise terms and conditions for copying, distribution and
57modification follow. 57modification follow.
58 58
59 GNU GENERAL PUBLIC LICENSE 59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 61
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
110 License. (Exception: if the Program itself is interactive but 110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on 111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.) 112 the Program is not required to print an announcement.)
113 113
114These requirements apply to the modified work as a whole. If 114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program, 115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in 116and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as 168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not 169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code. 170compelled to copy the source along with the object code.
171 171
172 4. You may not copy, modify, sublicense, or distribute the Program 172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt 173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is 174otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
225 225
226This section is intended to make thoroughly clear what is believed to 226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License. 227be a consequence of the rest of this License.
228 228
229 8. If the distribution and/or use of the Program is restricted in 229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the 230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License 231original copyright holder who places the Program under this License
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES. 278POSSIBILITY OF SUCH DAMAGES.
279 279
280 END OF TERMS AND CONDITIONS 280 END OF TERMS AND CONDITIONS
281 281
282 How to Apply These Terms to Your New Programs 282 How to Apply These Terms to Your New Programs
283 283
284 If you develop a new program, and you want it to be of the greatest 284 If you develop a new program, and you want it to be of the greatest
@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details. 304 GNU General Public License for more details.
305 305
306 You should have received a copy of the GNU General Public License 306 You should have received a copy of the GNU General Public License along
307 along with this program; if not, write to the Free Software 307 with this program; if not, write to the Free Software Foundation, Inc.,
308 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 308 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
310 309
311Also add information on how to contact you by electronic and paper mail. 310Also add information on how to contact you by electronic and paper mail.
312 311
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
336This General Public License does not permit incorporating your program into 335This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may 336proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the 337consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General 338library. If this is what you want to do, use the GNU Lesser General
340Public License instead of this License. 339Public License instead of this License.
diff --git a/src/ChangeLog b/src/ChangeLog
index 51c496b773b..4b22c5d5dc0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,157 @@
12006-09-19 Chong Yidong <cyd@stupidchicken.com>
2
3 * search.c (struct regexp_cache): New entry syntax_table.
4 (compile_pattern_1): Set it.
5 (syms_of_search): Initialize it.
6 (compile_pattern): Require the syntax_table entry of the cache
7 element to match the current syntax table entry.
8
92006-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
10
11 * window.c (Fwindow_end): Fix recent change.
12
132006-09-19 Kim F. Storm <storm@cua.dk>
14
15 * window.c (Fset_window_hscroll, Fpos_visible_in_window_p):
16 Doc fix. Use "off-screen" instead of "invisible".
17 (Fwindow_line_height): Make line numbers 0-based. Make line arg
18 optional; if nil, use current cursor row. Handle text terminals
19 properly. Return nil if non-interactive or pseudo-window.
20
212006-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * keymap.c: Include alloca.h if available.
24 (Fkey_binding): Only use AREF after checking it's a vector.
25 Remove unused var `window'.
26
272006-09-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
28
29 * emacs.c (shut_down_emacs) [!subprocesses]: Don't set
30 inhibit_sentinels.
31
32 * mac.c [!MAC_OSX] (select): Fix argument name.
33
34 * macmenu.c (enum mac_menu_kind, min_menu_id): New enumerator and
35 menu ID for Apple menu.
36 (menubar_selection_callback): Remove function.
37 (find_and_call_menu_selection): New function from xmenu.c.
38 (x_activate_menubar): Use it.
39 (set_frame_menubar): Don't use f->output_data.mac->menubar_active.
40
41 * macterm.c (menubar_selection_callback): Remove extern.
42 (M_APPLE): Change to 234.
43 (do_apple_menu) [!TARGET_API_MAC_CARBON]: Make non-static.
44 (do_menu_choice): Remove function.
45
46 * macterm.h (struct mac_output): Remove member menubar_active.
47 (do_menu_choice): Remove extern.
48 (do_apple_menu) [!TARGET_API_MAC_CARBON]: Add extern.
49
502006-09-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
51
52 * xfns.c (syms_of_xfns): Rename x_gtk_show_chooser_help_text to
53 x_gtk_file_dialog_help_text.
54
55 * gtkutil.c (xg_uses_old_file_dialog): Rename x-use-old-gtk-file-dialog
56 to x-gtk-use-old-file-dialog.
57 (xg_get_file_with_chooser): Rename x_gtk_show_chooser_help_text to
58 x_gtk_file_dialog_help_text.
59
60 * xfns.c (syms_of_xfns): Ditto.
61
622006-09-18 Kim F. Storm <storm@cua.dk>
63
64 * window.c (Fwindow_line_visibility): Remove.
65 (Fwindow_line_height): New defun replacing it.
66 (syms_of_window): Defsubr it.
67
682006-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
69
70 * mac.c (SELECT_USE_CFSOCKET) [MAC_OSX]: Set default to 1.
71 [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Fix pointer type.
72
732006-09-17 Jay Belanger <belanger@truman.edu>
74
75 * gmalloc.c:
76 * md5.c:
77 * md5.h:
78 * strftime.c: Replace "GNU Library General Public License" by "GNU
79 General Public License" throughout.
80
812006-09-17 Kim F. Storm <storm@cua.dk>
82
83 * dispnew.c (update_text_area): Undo 2000-07-18 change.
84 Always redrawing whole row if line has mouse-face in it causes
85 excessive flickering of the mode line.
86
872006-09-17 Chong Yidong <cyd@stupidchicken.com>
88
89 * search.c (clear_regexp_cache): New function.
90
91 * syntax.c (Fmodify_syntax_entry): Clear regexp cache.
92
932006-09-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
94
95 * gtkutil.c (xg_get_file_with_chooser):
96 Check x-gtk-show-chooser-help-text before adding the help text.
97
98 * xfns.c (syms_of_xfns): New variable: x-gtk-show-chooser-help-text.
99
100 * gtkutil.c (get_utf8_string): Try harder to convert to UTF8. Gtk+
101 will simply crash if we fail.
102
1032006-09-16 Richard Stallman <rms@gnu.org>
104
105 * regex.c (re_compile_pattern): Set gl_state.current_syntax_table.
106
1072006-09-15 Kim F. Storm <storm@cua.dk>
108
109 * window.c (Fwindow_line_visibility): New defun for line-move-partial.
110 (syms_of_window): Defsubr it.
111 (Fwindow_end): Use window's buffer rather than current buffer.
112
1132006-09-15 Jay Belanger <belanger@truman.edu>
114
115 * COPYING: Replace "Library Public License" by "Lesser Public
116 License" throughout.
117
1182006-09-15 David Kastrup <dak@gnu.org>
119
120 * Makefile.in (keymap.o): Add "keymap.h" and "window.h"
121 dependencies.
122
123 * keymap.c: include "window.h".
124 (Fcommand_remapping): New optional POSITION argument.
125 (Fkey_binding): New optional POSITION argument. Completely rework
126 handling of mouse clicks to get the same order of keymaps as
127 `read-key-sequence' and heed POSITION. Also temporarily switch
128 buffers to location of mouse click and back.
129
130 * keyboard.c (command_loop_1): Adjust call of `Fcommand_remapping'
131 for additional argument.
132 (parse_menu_item): Adjust call of `Fkey_binding' for additional
133 argument.
134 (read_key_sequence): If there are both `local-map' and `keymap'
135 text properties at some buffer position, heed both.
136
137 * keymap.h: Declare additional optional arguments of
138 `Fcommand_remapping' and `Fkey_binding'.
139
1402006-09-15 Juanma Barranquero <lekktu@gmail.com>
141
142 * indent.c (Fcurrent_column, Findent_to): Fix typos in docstring.
143
1442006-09-14 Andreas Schwab <schwab@suse.de>
145
146 * print.c: Whitespace fixup.
147
1482006-09-14 Kim F. Storm <storm@cua.dk>
149
150 * xdisp.c (produce_image_glyph): Automatically crop wide images at
151 right window edge so we can draw the cursor on the same row to
152 avoid confusing redisplay by placing the cursor outside the visible
153 window area.
154
12006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 1552006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 156
3 * xterm.c (x_initialize): Don't install Xt event timer here. 157 * xterm.c (x_initialize): Don't install Xt event timer here.
@@ -67,12 +221,12 @@
67 * mac.c [MAC_OSX] (sys_select): Check argument `nfds' more rigidly. 221 * mac.c [MAC_OSX] (sys_select): Check argument `nfds' more rigidly.
68 Make variable `ofds' static. Remove variable `maxfd'. 222 Make variable `ofds' static. Remove variable `maxfd'.
69 223
70 * macfns.c (Fx_file_dialog): Remove unused variable `f'. Call 224 * macfns.c (Fx_file_dialog): Remove unused variable `f'.
71 check_mac. 225 Call check_mac.
72 226
73 * macmenu.c (Vmenu_updating_frame, syms_of_macmenu): 227 * macmenu.c (Vmenu_updating_frame, syms_of_macmenu):
74 * w32menu.c (Vmenu_updating_frame, syms_of_w32menu): Apply 228 * w32menu.c (Vmenu_updating_frame, syms_of_w32menu):
75 2006-09-08 change for xmenu.c. 229 Apply 2006-09-08 change for xmenu.c.
76 230
77 * xfns.c (Fx_file_dialog): Call check_x. 231 * xfns.c (Fx_file_dialog): Call check_x.
78 232
@@ -332,11 +486,11 @@
332 * mac.c (create_apple_event_from_event_ref, select) 486 * mac.c (create_apple_event_from_event_ref, select)
333 (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) 487 (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator)
334 (Fmac_set_file_type, cfstring_create_normalized) 488 (Fmac_set_file_type, cfstring_create_normalized)
335 (mac_get_system_locale, select_and_poll_event, sys_select): Use 489 (mac_get_system_locale, select_and_poll_event, sys_select):
336 OSStatus instead of OSErr. 490 Use OSStatus instead of OSErr.
337 491
338 * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't 492 * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon):
339 use FRAME_FILE_NAME. Use (FS)UpdateAlias. 493 Don't use FRAME_FILE_NAME. Use (FS)UpdateAlias.
340 (Fx_create_frame): Apply 2006-07-03 for xfns.c. 494 (Fx_create_frame): Apply 2006-07-03 for xfns.c.
341 495
342 * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string) 496 * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string)
@@ -505,7 +659,6 @@
505 659
506 * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* 660 * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms*
507 661
508
5092006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 6622006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
510 663
511 * keyboard.c: Define in_sighandler. 664 * keyboard.c: Define in_sighandler.
@@ -699,7 +852,7 @@
699 (FletX, Flet, grow_specpdl): Use signal_error. 852 (FletX, Flet, grow_specpdl): Use signal_error.
700 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2. 853 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2.
701 854
702 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop. 855 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop.
703 (list1): New function. 856 (list1): New function.
704 857
705 * lisp.h (list1): Add EXFUN. 858 * lisp.h (list1): Add EXFUN.
@@ -10251,7 +10404,6 @@
10251 10404
10252 * xterm.c (xim_destroy_callback): Ditto. 10405 * xterm.c (xim_destroy_callback): Ditto.
10253 10406
10254
102552004-10-20 B. Anyos <banyos@freemail.hu> (tiny change) 104072004-10-20 B. Anyos <banyos@freemail.hu> (tiny change)
10256 10408
10257 * w32term.c (x_draw_glyph_string): Use overline_color for overlines. 10409 * w32term.c (x_draw_glyph_string): Use overline_color for overlines.
@@ -18741,6 +18893,14 @@
18741 18893
18742 * Makefile.in (fns.o): Depend on coding.h. 18894 * Makefile.in (fns.o): Depend on coding.h.
18743 18895
188962003-01-06 Dave Love <fx@gnu.org>
18897
18898 * fns.c: Include coding.h. Use POINTER_TYPE*, not void*.
18899 (Vlocale_coding_system): Declare.
18900 (Qcodeset, Qdays, Qmonths, Qpaper): New.
18901 (Flanginfo): New.
18902 (syms_of_fns): Initialize new stuff.
18903
187442003-01-07 Markus Rost <rost@math.ohio-state.edu> 189042003-01-07 Markus Rost <rost@math.ohio-state.edu>
18745 18905
18746 * minibuf.c (Fread_variable): Doc fix. 18906 * minibuf.c (Fread_variable): Doc fix.
diff --git a/src/Makefile.in b/src/Makefile.in
index 3bb6cece33d..b7569b9de2a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1171,7 +1171,8 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
1171 systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ 1171 systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
1172 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h) 1172 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
1173keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 1173keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
1174 atimer.h systime.h puresize.h character.h intervals.h $(config_h) 1174 atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \
1175 $(config_h)
1175lastfile.o: lastfile.c $(config_h) 1176lastfile.o: lastfile.c $(config_h)
1176macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \ 1177macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
1177 dispextern.h $(config_h) 1178 dispextern.h $(config_h)
diff --git a/src/dispnew.c b/src/dispnew.c
index 4880ef7779f..de8f2c1ad38 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4392,7 +4392,12 @@ update_text_area (w, vpos)
4392 || desired_row->phys_height != current_row->phys_height 4392 || desired_row->phys_height != current_row->phys_height
4393 || desired_row->visible_height != current_row->visible_height 4393 || desired_row->visible_height != current_row->visible_height
4394 || current_row->overlapped_p 4394 || current_row->overlapped_p
4395#if 0
4396 /* This causes excessive flickering when mouse is moved across
4397 the mode line. Luckily everything seems to work just fine
4398 without doing this. KFS 2006-09-17. */
4395 || current_row->mouse_face_p 4399 || current_row->mouse_face_p
4400#endif
4396 || current_row->x != desired_row->x) 4401 || current_row->x != desired_row->x)
4397 { 4402 {
4398 rif->cursor_to (vpos, 0, desired_row->y, desired_row->x); 4403 rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
diff --git a/src/emacs.c b/src/emacs.c
index 74cef49926f..4d678696334 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2156,7 +2156,9 @@ shut_down_emacs (sig, no_x, stuff)
2156 2156
2157 stuff_buffered_input (stuff); 2157 stuff_buffered_input (stuff);
2158 2158
2159#ifdef subprocesses
2159 inhibit_sentinels = 1; 2160 inhibit_sentinels = 1;
2161#endif
2160 kill_buffer_processes (Qnil); 2162 kill_buffer_processes (Qnil);
2161 Fdo_auto_save (Qt, Qnil); 2163 Fdo_auto_save (Qt, Qnil);
2162 2164
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 71df287a6b6..646fbbc4e4c 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -10,17 +10,17 @@
10 Written May 1989 by Mike Haertel. 10 Written May 1989 by Mike Haertel.
11 11
12This library is free software; you can redistribute it and/or 12This library is free software; you can redistribute it and/or
13modify it under the terms of the GNU Library General Public License as 13modify it under the terms of the GNU General Public License as
14published by the Free Software Foundation; either version 2 of the 14published by the Free Software Foundation; either version 2 of the
15License, or (at your option) any later version. 15License, or (at your option) any later version.
16 16
17This library is distributed in the hope that it will be useful, 17This library is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of 18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20Library General Public License for more details. 20General Public License for more details.
21 21
22You should have received a copy of the GNU Library General Public 22You should have received a copy of the GNU General Public
23License along with this library; see the file COPYING.LIB. If 23License along with this library; see the file COPYING. If
24not, write to the Free Software Foundation, Inc., 51 Franklin Street, 24not, write to the Free Software Foundation, Inc., 51 Franklin Street,
25Fifth Floor, Boston, MA 02110-1301, USA. 25Fifth Floor, Boston, MA 02110-1301, USA.
26 26
@@ -329,17 +329,17 @@ extern __ptr_t r_re_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size));
329 Written May 1989 by Mike Haertel. 329 Written May 1989 by Mike Haertel.
330 330
331This library is free software; you can redistribute it and/or 331This library is free software; you can redistribute it and/or
332modify it under the terms of the GNU Library General Public License as 332modify it under the terms of the GNU General Public License as
333published by the Free Software Foundation; either version 2 of the 333published by the Free Software Foundation; either version 2 of the
334License, or (at your option) any later version. 334License, or (at your option) any later version.
335 335
336This library is distributed in the hope that it will be useful, 336This library is distributed in the hope that it will be useful,
337but WITHOUT ANY WARRANTY; without even the implied warranty of 337but WITHOUT ANY WARRANTY; without even the implied warranty of
338MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 338MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
339Library General Public License for more details. 339General Public License for more details.
340 340
341You should have received a copy of the GNU Library General Public 341You should have received a copy of the GNU General Public
342License along with this library; see the file COPYING.LIB. If 342License along with this library; see the file COPYING. If
343not, write to the Free Software Foundation, Inc., 51 Franklin Street, 343not, write to the Free Software Foundation, Inc., 51 Franklin Street,
344Fifth Floor, Boston, MA 02110-1301, USA. 344Fifth Floor, Boston, MA 02110-1301, USA.
345 345
@@ -932,17 +932,17 @@ _realloc (ptr, size)
932 Written May 1989 by Mike Haertel. 932 Written May 1989 by Mike Haertel.
933 933
934This library is free software; you can redistribute it and/or 934This library is free software; you can redistribute it and/or
935modify it under the terms of the GNU Library General Public License as 935modify it under the terms of the GNU General Public License as
936published by the Free Software Foundation; either version 2 of the 936published by the Free Software Foundation; either version 2 of the
937License, or (at your option) any later version. 937License, or (at your option) any later version.
938 938
939This library is distributed in the hope that it will be useful, 939This library is distributed in the hope that it will be useful,
940but WITHOUT ANY WARRANTY; without even the implied warranty of 940but WITHOUT ANY WARRANTY; without even the implied warranty of
941MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 941MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
942Library General Public License for more details. 942General Public License for more details.
943 943
944You should have received a copy of the GNU Library General Public 944You should have received a copy of the GNU General Public
945License along with this library; see the file COPYING.LIB. If 945License along with this library; see the file COPYING. If
946not, write to the Free Software Foundation, Inc., 51 Franklin Street, 946not, write to the Free Software Foundation, Inc., 51 Franklin Street,
947Fifth Floor, Boston, MA 02110-1301, USA. 947Fifth Floor, Boston, MA 02110-1301, USA.
948 948
@@ -1251,17 +1251,17 @@ cfree (ptr)
1251 Written May 1989 by Mike Haertel. 1251 Written May 1989 by Mike Haertel.
1252 1252
1253This library is free software; you can redistribute it and/or 1253This library is free software; you can redistribute it and/or
1254modify it under the terms of the GNU Library General Public License as 1254modify it under the terms of the GNU General Public License as
1255published by the Free Software Foundation; either version 2 of the 1255published by the Free Software Foundation; either version 2 of the
1256License, or (at your option) any later version. 1256License, or (at your option) any later version.
1257 1257
1258This library is distributed in the hope that it will be useful, 1258This library is distributed in the hope that it will be useful,
1259but WITHOUT ANY WARRANTY; without even the implied warranty of 1259but WITHOUT ANY WARRANTY; without even the implied warranty of
1260MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1260MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1261Library General Public License for more details. 1261General Public License for more details.
1262 1262
1263You should have received a copy of the GNU Library General Public 1263You should have received a copy of the GNU General Public
1264License along with this library; see the file COPYING.LIB. If 1264License along with this library; see the file COPYING. If
1265not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1265not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1266Fifth Floor, Boston, MA 02110-1301, USA. 1266Fifth Floor, Boston, MA 02110-1301, USA.
1267 1267
@@ -1496,17 +1496,17 @@ realloc (ptr, size)
1496/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. 1496/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
1497 1497
1498This library is free software; you can redistribute it and/or 1498This library is free software; you can redistribute it and/or
1499modify it under the terms of the GNU Library General Public License as 1499modify it under the terms of the GNU General Public License as
1500published by the Free Software Foundation; either version 2 of the 1500published by the Free Software Foundation; either version 2 of the
1501License, or (at your option) any later version. 1501License, or (at your option) any later version.
1502 1502
1503This library is distributed in the hope that it will be useful, 1503This library is distributed in the hope that it will be useful,
1504but WITHOUT ANY WARRANTY; without even the implied warranty of 1504but WITHOUT ANY WARRANTY; without even the implied warranty of
1505MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1505MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1506Library General Public License for more details. 1506General Public License for more details.
1507 1507
1508You should have received a copy of the GNU Library General Public 1508You should have received a copy of the GNU General Public
1509License along with this library; see the file COPYING.LIB. If 1509License along with this library; see the file COPYING. If
1510not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1510not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1511Fifth Floor, Boston, MA 02110-1301, USA. 1511Fifth Floor, Boston, MA 02110-1301, USA.
1512 1512
@@ -1593,17 +1593,17 @@ __default_morecore (increment)
1593/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. 1593/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
1594 1594
1595This library is free software; you can redistribute it and/or 1595This library is free software; you can redistribute it and/or
1596modify it under the terms of the GNU Library General Public License as 1596modify it under the terms of the GNU General Public License as
1597published by the Free Software Foundation; either version 2 of the 1597published by the Free Software Foundation; either version 2 of the
1598License, or (at your option) any later version. 1598License, or (at your option) any later version.
1599 1599
1600This library is distributed in the hope that it will be useful, 1600This library is distributed in the hope that it will be useful,
1601but WITHOUT ANY WARRANTY; without even the implied warranty of 1601but WITHOUT ANY WARRANTY; without even the implied warranty of
1602MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1602MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1603Library General Public License for more details. 1603General Public License for more details.
1604 1604
1605You should have received a copy of the GNU Library General Public 1605You should have received a copy of the GNU General Public
1606License along with this library; see the file COPYING.LIB. If 1606License along with this library; see the file COPYING. If
1607not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1607not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1608Fifth Floor, Boston, MA 02110-1301, USA. */ 1608Fifth Floor, Boston, MA 02110-1301, USA. */
1609 1609
@@ -1693,17 +1693,17 @@ memalign (alignment, size)
1693 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. 1693 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
1694 1694
1695This library is free software; you can redistribute it and/or 1695This library is free software; you can redistribute it and/or
1696modify it under the terms of the GNU Library General Public License as 1696modify it under the terms of the GNU General Public License as
1697published by the Free Software Foundation; either version 2 of the 1697published by the Free Software Foundation; either version 2 of the
1698License, or (at your option) any later version. 1698License, or (at your option) any later version.
1699 1699
1700This library is distributed in the hope that it will be useful, 1700This library is distributed in the hope that it will be useful,
1701but WITHOUT ANY WARRANTY; without even the implied warranty of 1701but WITHOUT ANY WARRANTY; without even the implied warranty of
1702MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1702MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1703Library General Public License for more details. 1703General Public License for more details.
1704 1704
1705You should have received a copy of the GNU Library General Public 1705You should have received a copy of the GNU General Public
1706License along with this library; see the file COPYING.LIB. If 1706License along with this library; see the file COPYING. If
1707not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1707not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1708Fifth Floor, Boston, MA 02110-1301, USA. 1708Fifth Floor, Boston, MA 02110-1301, USA.
1709 1709
@@ -1760,17 +1760,17 @@ valloc (size)
1760 Written May 1989 by Mike Haertel. 1760 Written May 1989 by Mike Haertel.
1761 1761
1762This library is free software; you can redistribute it and/or 1762This library is free software; you can redistribute it and/or
1763modify it under the terms of the GNU Library General Public License as 1763modify it under the terms of the GNU General Public License as
1764published by the Free Software Foundation; either version 2 of the 1764published by the Free Software Foundation; either version 2 of the
1765License, or (at your option) any later version. 1765License, or (at your option) any later version.
1766 1766
1767This library is distributed in the hope that it will be useful, 1767This library is distributed in the hope that it will be useful,
1768but WITHOUT ANY WARRANTY; without even the implied warranty of 1768but WITHOUT ANY WARRANTY; without even the implied warranty of
1769MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1769MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1770Library General Public License for more details. 1770General Public License for more details.
1771 1771
1772You should have received a copy of the GNU Library General Public 1772You should have received a copy of the GNU General Public
1773License along with this library; see the file COPYING.LIB. If 1773License along with this library; see the file COPYING. If
1774not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1774not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1775Fifth Floor, Boston, MA 02110-1301, USA. 1775Fifth Floor, Boston, MA 02110-1301, USA.
1776 1776
diff --git a/src/gtkutil.c b/src/gtkutil.c
index cf6caafa942..cdc87044c81 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -507,10 +507,66 @@ get_utf8_string (str)
507{ 507{
508 char *utf8_str = str; 508 char *utf8_str = str;
509 509
510 if (!str) return NULL;
511
510 /* If not UTF-8, try current locale. */ 512 /* If not UTF-8, try current locale. */
511 if (str && !g_utf8_validate (str, -1, NULL)) 513 if (!g_utf8_validate (str, -1, NULL))
512 utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); 514 utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
513 515
516 if (!utf8_str)
517 {
518 /* Probably some control characters in str. Escape them. */
519 size_t nr_bad = 0;
520 gsize bytes_read;
521 gsize bytes_written;
522 unsigned char *p = (unsigned char *)str;
523 char *cp, *up;
524 GError *error = NULL;
525
526 while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read,
527 &bytes_written, &error))
528 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
529 {
530 ++nr_bad;
531 p += bytes_written+1;
532 g_error_free (error);
533 error = NULL;
534 }
535
536 if (error)
537 {
538 g_error_free (error);
539 error = NULL;
540 }
541 if (cp) g_free (cp);
542
543 up = utf8_str = xmalloc (strlen (str) + nr_bad * 4 + 1);
544 p = str;
545
546 while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read,
547 &bytes_written, &error))
548 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
549 {
550 strncpy (up, p, bytes_written);
551 sprintf (up + bytes_written, "\\%03o", p[bytes_written]);
552 up[bytes_written+4] = '\0';
553 up += bytes_written+4;
554 p += bytes_written+1;
555 g_error_free (error);
556 error = NULL;
557 }
558
559 if (cp)
560 {
561 strcat (utf8_str, cp);
562 g_free (cp);
563 }
564 if (error)
565 {
566 g_error_free (error);
567 error = NULL;
568 }
569 }
514 return utf8_str; 570 return utf8_str;
515} 571}
516 572
@@ -1156,8 +1212,8 @@ int
1156xg_uses_old_file_dialog () 1212xg_uses_old_file_dialog ()
1157{ 1213{
1158#ifdef HAVE_GTK_FILE_BOTH 1214#ifdef HAVE_GTK_FILE_BOTH
1159 extern int x_use_old_gtk_file_dialog; 1215 extern int x_gtk_use_old_file_dialog;
1160 return x_use_old_gtk_file_dialog; 1216 return x_gtk_use_old_file_dialog;
1161#else /* ! HAVE_GTK_FILE_BOTH */ 1217#else /* ! HAVE_GTK_FILE_BOTH */
1162 1218
1163#ifdef HAVE_GTK_FILE_SELECTION_NEW 1219#ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -1294,6 +1350,8 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1294 GTK_FILE_CHOOSER_ACTION_OPEN : 1350 GTK_FILE_CHOOSER_ACTION_OPEN :
1295 GTK_FILE_CHOOSER_ACTION_SAVE); 1351 GTK_FILE_CHOOSER_ACTION_SAVE);
1296 extern int x_gtk_show_hidden_files; 1352 extern int x_gtk_show_hidden_files;
1353 extern int x_gtk_file_dialog_help_text;
1354
1297 1355
1298 if (only_dir_p) 1356 if (only_dir_p)
1299 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; 1357 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
@@ -1321,17 +1379,22 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1321 g_signal_connect (G_OBJECT (filewin), "notify", 1379 g_signal_connect (G_OBJECT (filewin), "notify",
1322 G_CALLBACK (xg_toggle_notify_cb), wtoggle); 1380 G_CALLBACK (xg_toggle_notify_cb), wtoggle);
1323 1381
1324 message[0] = '\0'; 1382 if (x_gtk_file_dialog_help_text)
1325 if (action != GTK_FILE_CHOOSER_ACTION_SAVE) 1383 {
1326 strcat (message, "\nType C-l to display a file name text entry box.\n"); 1384 message[0] = '\0';
1327 strcat (message, "\nIf you don't like this file selector, use the " 1385 if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
1328 "corresponding\nkey binding or customize " 1386 strcat (message, "\nType C-l to display a file name text entry box.\n");
1329 "use-file-dialog to turn it off."); 1387 strcat (message, "\nIf you don't like this file selector, use the "
1388 "corresponding\nkey binding or customize "
1389 "use-file-dialog to turn it off.");
1330 1390
1331 wmessage = gtk_label_new (message); 1391 wmessage = gtk_label_new (message);
1332 gtk_widget_show (wmessage); 1392 gtk_widget_show (wmessage);
1393 }
1394
1333 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0); 1395 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0);
1334 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0); 1396 if (x_gtk_file_dialog_help_text)
1397 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0);
1335 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox); 1398 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox);
1336 1399
1337 if (default_filename) 1400 if (default_filename)
diff --git a/src/indent.c b/src/indent.c
index 2461c156e3c..8ea3ea66c1d 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -335,8 +335,8 @@ DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0,
335 doc: /* Return the horizontal position of point. Beginning of line is column 0. 335 doc: /* Return the horizontal position of point. Beginning of line is column 0.
336This is calculated by adding together the widths of all the displayed 336This is calculated by adding together the widths of all the displayed
337representations of the character between the start of the previous line 337representations of the character between the start of the previous line
338and point. (eg control characters will have a width of 2 or 4, tabs 338and point (eg. control characters will have a width of 2 or 4, tabs
339will have a variable width) 339will have a variable width).
340Ignores finite width of frame, which means that this function may return 340Ignores finite width of frame, which means that this function may return
341values greater than (frame-width). 341values greater than (frame-width).
342Whether the line is visible (if `selective-display' is t) has no effect; 342Whether the line is visible (if `selective-display' is t) has no effect;
@@ -734,8 +734,8 @@ string_display_width (string, beg, end)
734 734
735DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", 735DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ",
736 doc: /* Indent from point with tabs and spaces until COLUMN is reached. 736 doc: /* Indent from point with tabs and spaces until COLUMN is reached.
737Optional second argument MININUM says always do at least MININUM spaces 737Optional second argument MINIMUM says always do at least MINIMUM spaces
738even if that goes past COLUMN; by default, MININUM is zero. */) 738even if that goes past COLUMN; by default, MINIMUM is zero. */)
739 (column, minimum) 739 (column, minimum)
740 Lisp_Object column, minimum; 740 Lisp_Object column, minimum;
741{ 741{
diff --git a/src/keyboard.c b/src/keyboard.c
index 6a1d6e608d2..786b3d9b556 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1674,7 +1674,7 @@ command_loop_1 ()
1674 if (SYMBOLP (cmd)) 1674 if (SYMBOLP (cmd))
1675 { 1675 {
1676 Lisp_Object cmd1; 1676 Lisp_Object cmd1;
1677 if (cmd1 = Fcommand_remapping (cmd), !NILP (cmd1)) 1677 if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1))
1678 cmd = cmd1; 1678 cmd = cmd1;
1679 } 1679 }
1680 1680
@@ -7517,7 +7517,7 @@ parse_menu_item (item, notreal, inmenubar)
7517 Lisp_Object prefix; 7517 Lisp_Object prefix;
7518 7518
7519 if (!NILP (tem)) 7519 if (!NILP (tem))
7520 tem = Fkey_binding (tem, Qnil, Qnil); 7520 tem = Fkey_binding (tem, Qnil, Qnil, Qnil);
7521 7521
7522 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 7522 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
7523 if (CONSP (prefix)) 7523 if (CONSP (prefix))
@@ -9134,16 +9134,19 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9134 if (!EQ (map_here, orig_local_map)) 9134 if (!EQ (map_here, orig_local_map))
9135 { 9135 {
9136 orig_local_map = map_here; 9136 orig_local_map = map_here;
9137 keybuf[t] = key; 9137 ++localized_local_map;
9138 mock_input = t + 1;
9139
9140 goto replay_sequence;
9141 } 9138 }
9139
9142 map_here = get_local_map (XINT (pos), 9140 map_here = get_local_map (XINT (pos),
9143 current_buffer, Qkeymap); 9141 current_buffer, Qkeymap);
9144 if (!EQ (map_here, orig_keymap)) 9142 if (!EQ (map_here, orig_keymap))
9145 { 9143 {
9146 orig_keymap = map_here; 9144 orig_keymap = map_here;
9145 ++localized_local_map;
9146 }
9147
9148 if (localized_local_map > 1)
9149 {
9147 keybuf[t] = key; 9150 keybuf[t] = key;
9148 mock_input = t + 1; 9151 mock_input = t + 1;
9149 9152
diff --git a/src/keymap.c b/src/keymap.c
index 99d49c000e9..9720708ecf9 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -23,6 +23,9 @@ Boston, MA 02110-1301, USA. */
23 23
24#include <config.h> 24#include <config.h>
25#include <stdio.h> 25#include <stdio.h>
26#if HAVE_ALLOCA_H
27# include <alloca.h>
28#endif
26#include "lisp.h" 29#include "lisp.h"
27#include "commands.h" 30#include "commands.h"
28#include "buffer.h" 31#include "buffer.h"
@@ -34,6 +37,7 @@ Boston, MA 02110-1301, USA. */
34#include "puresize.h" 37#include "puresize.h"
35#include "intervals.h" 38#include "intervals.h"
36#include "keymap.h" 39#include "keymap.h"
40#include "window.h"
37 41
38/* The number of elements in keymap vectors. */ 42/* The number of elements in keymap vectors. */
39#define DENSE_TABLE_SIZE (0200) 43#define DENSE_TABLE_SIZE (0200)
@@ -1249,17 +1253,23 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1249 1253
1250/* This function may GC (it calls Fkey_binding). */ 1254/* This function may GC (it calls Fkey_binding). */
1251 1255
1252DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 1, 0, 1256DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0,
1253 doc: /* Return the remapping for command COMMAND in current keymaps. 1257 doc: /* Return the remapping for command COMMAND in current keymaps.
1254Returns nil if COMMAND is not remapped (or not a symbol). */) 1258Returns nil if COMMAND is not remapped (or not a symbol).
1255 (command) 1259
1256 Lisp_Object command; 1260If the optional argument POSITION is non-nil, it specifies a mouse
1261position as returned by `event-start' and `event-end', and the
1262remapping occurs in the keymaps associated with it. It can also be a
1263number or marker, in which case the keymap properties at the specified
1264buffer position instead of point are used. */)
1265 (command, position)
1266 Lisp_Object command, position;
1257{ 1267{
1258 if (!SYMBOLP (command)) 1268 if (!SYMBOLP (command))
1259 return Qnil; 1269 return Qnil;
1260 1270
1261 ASET (command_remapping_vector, 1, command); 1271 ASET (command_remapping_vector, 1, command);
1262 return Fkey_binding (command_remapping_vector, Qnil, Qt); 1272 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1263} 1273}
1264 1274
1265/* Value is number if KEY is too long; nil if valid but has no definition. */ 1275/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1585,7 +1595,7 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and
1585 1595
1586/* GC is possible in this function if it autoloads a keymap. */ 1596/* GC is possible in this function if it autoloads a keymap. */
1587 1597
1588DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 3, 0, 1598DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 4, 0,
1589 doc: /* Return the binding for command KEY in current keymaps. 1599 doc: /* Return the binding for command KEY in current keymaps.
1590KEY is a string or vector, a sequence of keystrokes. 1600KEY is a string or vector, a sequence of keystrokes.
1591The binding is probably a symbol with a function definition. 1601The binding is probably a symbol with a function definition.
@@ -1599,55 +1609,83 @@ recognize the default bindings, just as `read-key-sequence' does.
1599Like the normal command loop, `key-binding' will remap the command 1609Like the normal command loop, `key-binding' will remap the command
1600resulting from looking up KEY by looking up the command in the 1610resulting from looking up KEY by looking up the command in the
1601current keymaps. However, if the optional third argument NO-REMAP 1611current keymaps. However, if the optional third argument NO-REMAP
1602is non-nil, `key-binding' returns the unmapped command. */) 1612is non-nil, `key-binding' returns the unmapped command.
1603 (key, accept_default, no_remap) 1613
1604 Lisp_Object key, accept_default, no_remap; 1614If KEY is a key sequence initiated with the mouse, the used keymaps
1615will depend on the clicked mouse position with regard to the buffer
1616and possible local keymaps on strings.
1617
1618If the optional argument POSITION is non-nil, it specifies a mouse
1619position as returned by `event-start' and `event-end', and the lookup
1620occurs in the keymaps associated with it instead of KEY. It can also
1621be a number or marker, in which case the keymap properties at the
1622specified buffer position instead of point are used.
1623 */)
1624 (key, accept_default, no_remap, position)
1625 Lisp_Object key, accept_default, no_remap, position;
1605{ 1626{
1606 Lisp_Object *maps, value; 1627 Lisp_Object *maps, value;
1607 int nmaps, i; 1628 int nmaps, i;
1608 struct gcpro gcpro1; 1629 struct gcpro gcpro1, gcpro2;
1630 int count = SPECPDL_INDEX ();
1609 1631
1610 GCPRO1 (key); 1632 GCPRO2 (key, position);
1611 1633
1612#ifdef HAVE_MOUSE 1634 if (NILP (position) && VECTORP (key))
1613 if (VECTORP (key) && ASIZE (key) > 0)
1614 { 1635 {
1615 Lisp_Object ev, pos; 1636 Lisp_Object event
1616 if ((ev = AREF (key, 0), CONSP (ev)) 1637 /* mouse events may have a symbolic prefix indicating the
1617 && SYMBOLP (XCAR (ev)) 1638 scrollbar or mode line */
1618 && CONSP (XCDR (ev)) 1639 = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
1619 && (pos = XCAR (XCDR (ev)), CONSP (pos))
1620 && XINT (Flength (pos)) == 10
1621 && INTEGERP (XCAR (XCDR (pos))))
1622 {
1623 Lisp_Object map, object;
1624 1640
1625 object = Fnth (make_number(4), pos); 1641 /* We are not interested in locations without event data */
1626 1642
1627 if (CONSP (object)) 1643 if (EVENT_HAS_PARAMETERS (event)) {
1628 map = Fget_char_property (XCDR (object), Qkeymap, XCAR (object)); 1644 Lisp_Object kind;
1629 else
1630 map = Fget_char_property (XCAR (XCDR (pos)), Qkeymap,
1631 Fwindow_buffer (XCAR (pos)));
1632 1645
1633 if (!NILP (Fkeymapp (map))) 1646 kind = EVENT_HEAD_KIND (EVENT_HEAD (event));
1634 { 1647 if (EQ (kind, Qmouse_click))
1635 value = Flookup_key (map, key, accept_default); 1648 position = EVENT_START (event);
1636 if (! NILP (value) && !INTEGERP (value)) 1649 }
1637 goto done;
1638 }
1639 }
1640 } 1650 }
1641#endif /* HAVE_MOUSE */
1642 1651
1643 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 1652 /* Key sequences beginning with mouse clicks
1653 are read using the keymaps of the buffer clicked on, not
1654 the current buffer. So we may have to switch the buffer
1655 here. */
1656
1657 if (CONSP (position))
1658 {
1659 Lisp_Object window;
1660
1661 window = POSN_WINDOW (position);
1662
1663 if (WINDOWP (window)
1664 && BUFFERP (XWINDOW (window)->buffer)
1665 && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
1666 {
1667 /* Arrange to go back to the original buffer once we're done
1668 processing the key sequence. We don't use
1669 save_excursion_{save,restore} here, in analogy to
1670 `read-key-sequence' to avoid saving point. Maybe this
1671 would not be a problem here, but it is easier to keep
1672 things the same.
1673 */
1674
1675 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
1676
1677 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
1678 }
1679 }
1680
1681 if (! NILP (current_kboard->Voverriding_terminal_local_map))
1644 { 1682 {
1645 value = Flookup_key (current_kboard->Voverriding_terminal_local_map, 1683 value = Flookup_key (current_kboard->Voverriding_terminal_local_map,
1646 key, accept_default); 1684 key, accept_default);
1647 if (! NILP (value) && !INTEGERP (value)) 1685 if (! NILP (value) && !INTEGERP (value))
1648 goto done; 1686 goto done;
1649 } 1687 }
1650 else if (!NILP (Voverriding_local_map)) 1688 else if (! NILP (Voverriding_local_map))
1651 { 1689 {
1652 value = Flookup_key (Voverriding_local_map, key, accept_default); 1690 value = Flookup_key (Voverriding_local_map, key, accept_default);
1653 if (! NILP (value) && !INTEGERP (value)) 1691 if (! NILP (value) && !INTEGERP (value))
@@ -1655,12 +1693,70 @@ is non-nil, `key-binding' returns the unmapped command. */)
1655 } 1693 }
1656 else 1694 else
1657 { 1695 {
1658 Lisp_Object local; 1696 Lisp_Object keymap, local_map;
1697 EMACS_INT pt;
1659 1698
1660 local = get_local_map (PT, current_buffer, Qkeymap); 1699 pt = INTEGERP (position) ? XINT (position)
1661 if (! NILP (local)) 1700 : MARKERP (position) ? marker_position (position)
1701 : PT;
1702
1703 local_map = get_local_map (pt, current_buffer, Qlocal_map);
1704 keymap = get_local_map (pt, current_buffer, Qkeymap);
1705
1706 if (CONSP (position))
1662 { 1707 {
1663 value = Flookup_key (local, key, accept_default); 1708 Lisp_Object string;
1709
1710 /* For a mouse click, get the local text-property keymap
1711 of the place clicked on, rather than point. */
1712
1713 if (POSN_INBUFFER_P (position))
1714 {
1715 Lisp_Object pos;
1716
1717 pos = POSN_BUFFER_POSN (position);
1718 if (INTEGERP (pos)
1719 && XINT (pos) >= BEG && XINT (pos) <= Z)
1720 {
1721 local_map = get_local_map (XINT (pos),
1722 current_buffer, Qlocal_map);
1723
1724 keymap = get_local_map (XINT (pos),
1725 current_buffer, Qkeymap);
1726 }
1727 }
1728
1729 /* If on a mode line string with a local keymap,
1730 or for a click on a string, i.e. overlay string or a
1731 string displayed via the `display' property,
1732 consider `local-map' and `keymap' properties of
1733 that string. */
1734
1735 if (string = POSN_STRING (position),
1736 (CONSP (string) && STRINGP (XCAR (string))))
1737 {
1738 Lisp_Object pos, map;
1739
1740 pos = XCDR (string);
1741 string = XCAR (string);
1742 if (XINT (pos) >= 0
1743 && XINT (pos) < SCHARS (string))
1744 {
1745 map = Fget_text_property (pos, Qlocal_map, string);
1746 if (!NILP (map))
1747 local_map = map;
1748
1749 map = Fget_text_property (pos, Qkeymap, string);
1750 if (!NILP (map))
1751 keymap = map;
1752 }
1753 }
1754
1755 }
1756
1757 if (! NILP (keymap))
1758 {
1759 value = Flookup_key (keymap, key, accept_default);
1664 if (! NILP (value) && !INTEGERP (value)) 1760 if (! NILP (value) && !INTEGERP (value))
1665 goto done; 1761 goto done;
1666 } 1762 }
@@ -1677,10 +1773,9 @@ is non-nil, `key-binding' returns the unmapped command. */)
1677 goto done; 1773 goto done;
1678 } 1774 }
1679 1775
1680 local = get_local_map (PT, current_buffer, Qlocal_map); 1776 if (! NILP (local_map))
1681 if (! NILP (local))
1682 { 1777 {
1683 value = Flookup_key (local, key, accept_default); 1778 value = Flookup_key (local_map, key, accept_default);
1684 if (! NILP (value) && !INTEGERP (value)) 1779 if (! NILP (value) && !INTEGERP (value))
1685 goto done; 1780 goto done;
1686 } 1781 }
@@ -1689,6 +1784,8 @@ is non-nil, `key-binding' returns the unmapped command. */)
1689 value = Flookup_key (current_global_map, key, accept_default); 1784 value = Flookup_key (current_global_map, key, accept_default);
1690 1785
1691 done: 1786 done:
1787 unbind_to (count, Qnil);
1788
1692 UNGCPRO; 1789 UNGCPRO;
1693 if (NILP (value) || INTEGERP (value)) 1790 if (NILP (value) || INTEGERP (value))
1694 return Qnil; 1791 return Qnil;
@@ -1699,7 +1796,7 @@ is non-nil, `key-binding' returns the unmapped command. */)
1699 if (NILP (no_remap) && SYMBOLP (value)) 1796 if (NILP (no_remap) && SYMBOLP (value))
1700 { 1797 {
1701 Lisp_Object value1; 1798 Lisp_Object value1;
1702 if (value1 = Fcommand_remapping (value), !NILP (value1)) 1799 if (value1 = Fcommand_remapping (value, position), !NILP (value1))
1703 value = value1; 1800 value = value1;
1704 } 1801 }
1705 1802
@@ -2449,7 +2546,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2449 if (NILP (no_remap) && SYMBOLP (definition)) 2546 if (NILP (no_remap) && SYMBOLP (definition))
2450 { 2547 {
2451 Lisp_Object tem; 2548 Lisp_Object tem;
2452 if (tem = Fcommand_remapping (definition), !NILP (tem)) 2549 if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
2453 return Qnil; 2550 return Qnil;
2454 } 2551 }
2455 2552
diff --git a/src/keymap.h b/src/keymap.h
index cbd14cf9ba4..b11f630a1fb 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -29,8 +29,8 @@ EXFUN (Fmake_sparse_keymap, 1);
29EXFUN (Fkeymap_prompt, 1); 29EXFUN (Fkeymap_prompt, 1);
30EXFUN (Fdefine_key, 3); 30EXFUN (Fdefine_key, 3);
31EXFUN (Flookup_key, 3); 31EXFUN (Flookup_key, 3);
32EXFUN (Fcommand_remapping, 1); 32EXFUN (Fcommand_remapping, 2);
33EXFUN (Fkey_binding, 3); 33EXFUN (Fkey_binding, 4);
34EXFUN (Fkey_description, 2); 34EXFUN (Fkey_description, 2);
35EXFUN (Fsingle_key_description, 2); 35EXFUN (Fsingle_key_description, 2);
36EXFUN (Fwhere_is_internal, 5); 36EXFUN (Fwhere_is_internal, 5);
diff --git a/src/mac.c b/src/mac.c
index 51b821dcd95..be6953a0d55 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -2416,7 +2416,7 @@ sys_fopen (const char *name, const char *mode)
2416extern Boolean mac_wait_next_event P_ ((EventRecord *, UInt32, Boolean)); 2416extern Boolean mac_wait_next_event P_ ((EventRecord *, UInt32, Boolean));
2417 2417
2418int 2418int
2419select (n, rfds, wfds, efds, timeout) 2419select (nfds, rfds, wfds, efds, timeout)
2420 int nfds; 2420 int nfds;
2421 SELECT_TYPE *rfds, *wfds, *efds; 2421 SELECT_TYPE *rfds, *wfds, *efds;
2422 EMACS_TIME *timeout; 2422 EMACS_TIME *timeout;
@@ -4975,6 +4975,10 @@ extern int noninteractive;
4975 executing `select' with a short timeout 4975 executing `select' with a short timeout
4976 (SELECT_POLLING_PERIOD_USEC microseconds). */ 4976 (SELECT_POLLING_PERIOD_USEC microseconds). */
4977 4977
4978#ifndef SELECT_USE_CFSOCKET
4979#define SELECT_USE_CFSOCKET 1
4980#endif
4981
4978#define SELECT_POLLING_PERIOD_USEC 100000 4982#define SELECT_POLLING_PERIOD_USEC 100000
4979#if SELECT_USE_CFSOCKET 4983#if SELECT_USE_CFSOCKET
4980#define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 4984#define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2
@@ -5115,7 +5119,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
5115 int minfd, fd; 5119 int minfd, fd;
5116 CFRunLoopRef runloop = 5120 CFRunLoopRef runloop =
5117 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); 5121 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ());
5118 static CFSocketContext context = {0, &ofds, NULL, NULL, NULL}; 5122 static CFSocketContext context = {0, ofds, NULL, NULL, NULL};
5119 static CFMutableDictionaryRef sources; 5123 static CFMutableDictionaryRef sources;
5120 5124
5121 if (sources == NULL) 5125 if (sources == NULL)
diff --git a/src/macmenu.c b/src/macmenu.c
index 72ab9f90667..1a1525eafb7 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -64,7 +64,8 @@ Boston, MA 02110-1301, USA. */
64 64
65enum mac_menu_kind { /* Menu ID range */ 65enum mac_menu_kind { /* Menu ID range */
66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */ 66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */
67 MAC_MENU_MENU_BAR, /* 1 .. 234 */ 67 MAC_MENU_MENU_BAR, /* 1 .. 233 */
68 MAC_MENU_M_APPLE, /* 234 (== M_APPLE) */
68 MAC_MENU_POPUP, /* 235 */ 69 MAC_MENU_POPUP, /* 235 */
69 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */ 70 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */
70 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */ 71 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */
@@ -72,7 +73,7 @@ enum mac_menu_kind { /* Menu ID range */
72 MAC_MENU_END /* 32768 */ 73 MAC_MENU_END /* 32768 */
73}; 74};
74 75
75static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768}; 76static const int min_menu_id[] = {0, 1, 234, 235, 236, 256, 16384, 32768};
76 77
77#define DIALOG_WINDOW_RESOURCE 130 78#define DIALOG_WINDOW_RESOURCE 130
78 79
@@ -196,6 +197,8 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
196static void list_of_panes P_ ((Lisp_Object)); 197static void list_of_panes P_ ((Lisp_Object));
197static void list_of_items P_ ((Lisp_Object)); 198static void list_of_items P_ ((Lisp_Object));
198 199
200static void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object,
201 void *));
199static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int)); 202static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int));
200static void fill_menubar P_ ((widget_value *, int)); 203static void fill_menubar P_ ((widget_value *, int));
201static void dispose_menus P_ ((enum mac_menu_kind, int)); 204static void dispose_menus P_ ((enum mac_menu_kind, int));
@@ -1015,39 +1018,63 @@ x_activate_menubar (f)
1015 FRAME_PTR f; 1018 FRAME_PTR f;
1016{ 1019{
1017 SInt32 menu_choice; 1020 SInt32 menu_choice;
1021 SInt16 menu_id, menu_item;
1018 extern Point saved_menu_event_location; 1022 extern Point saved_menu_event_location;
1019 1023
1020 set_frame_menubar (f, 0, 1); 1024 set_frame_menubar (f, 0, 1);
1021 BLOCK_INPUT; 1025 BLOCK_INPUT;
1022 1026
1023 menu_choice = MenuSelect (saved_menu_event_location); 1027 menu_choice = MenuSelect (saved_menu_event_location);
1024 do_menu_choice (menu_choice); 1028 menu_id = HiWord (menu_choice);
1029 menu_item = LoWord (menu_choice);
1030
1031#if !TARGET_API_MAC_CARBON
1032 if (menu_id == min_menu_id[MAC_MENU_M_APPLE])
1033 do_apple_menu (menu_item);
1034 else
1035#endif
1036 if (menu_id)
1037 {
1038 MenuHandle menu = GetMenuHandle (menu_id);
1039
1040 if (menu)
1041 {
1042 UInt32 refcon;
1043
1044 GetMenuItemRefCon (menu, menu_item, &refcon);
1045 find_and_call_menu_selection (f, f->menu_bar_items_used,
1046 f->menu_bar_vector, (void *) refcon);
1047 }
1048 }
1049
1050 HiliteMenu (0);
1025 1051
1026 UNBLOCK_INPUT; 1052 UNBLOCK_INPUT;
1027} 1053}
1028 1054
1029/* This callback is called from the menu bar pulldown menu 1055/* Find the menu selection and store it in the keyboard buffer.
1030 when the user makes a selection. 1056 F is the frame the menu is on.
1031 Figure out what the user chose 1057 MENU_BAR_ITEMS_USED is the length of VECTOR.
1032 and put the appropriate events into the keyboard buffer. */ 1058 VECTOR is an array of menu events for the whole menu. */
1033 1059
1034void 1060static void
1035menubar_selection_callback (FRAME_PTR f, int client_data) 1061find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data)
1062 FRAME_PTR f;
1063 int menu_bar_items_used;
1064 Lisp_Object vector;
1065 void *client_data;
1036{ 1066{
1037 Lisp_Object prefix, entry; 1067 Lisp_Object prefix, entry;
1038 Lisp_Object vector;
1039 Lisp_Object *subprefix_stack; 1068 Lisp_Object *subprefix_stack;
1040 int submenu_depth = 0; 1069 int submenu_depth = 0;
1041 int i; 1070 int i;
1042 1071
1043 if (!f)
1044 return;
1045 entry = Qnil; 1072 entry = Qnil;
1046 subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); 1073 subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object));
1047 vector = f->menu_bar_vector;
1048 prefix = Qnil; 1074 prefix = Qnil;
1049 i = 0; 1075 i = 0;
1050 while (i < f->menu_bar_items_used) 1076
1077 while (i < menu_bar_items_used)
1051 { 1078 {
1052 if (EQ (XVECTOR (vector)->contents[i], Qnil)) 1079 if (EQ (XVECTOR (vector)->contents[i], Qnil))
1053 { 1080 {
@@ -1105,13 +1132,11 @@ menubar_selection_callback (FRAME_PTR f, int client_data)
1105 buf.arg = entry; 1132 buf.arg = entry;
1106 kbd_buffer_store_event (&buf); 1133 kbd_buffer_store_event (&buf);
1107 1134
1108 f->output_data.mac->menubar_active = 0;
1109 return; 1135 return;
1110 } 1136 }
1111 i += MENU_ITEMS_ITEM_LENGTH; 1137 i += MENU_ITEMS_ITEM_LENGTH;
1112 } 1138 }
1113 } 1139 }
1114 f->output_data.mac->menubar_active = 0;
1115} 1140}
1116 1141
1117/* Allocate a widget_value, blocking input. */ 1142/* Allocate a widget_value, blocking input. */
@@ -1508,10 +1533,6 @@ set_frame_menubar (f, first_time, deep_p)
1508 int *submenu_start, *submenu_end; 1533 int *submenu_start, *submenu_end;
1509 int *submenu_top_level_items, *submenu_n_panes; 1534 int *submenu_top_level_items, *submenu_n_panes;
1510 1535
1511 /* We must not change the menubar when actually in use. */
1512 if (f->output_data.mac->menubar_active)
1513 return;
1514
1515 XSETFRAME (Vmenu_updating_frame, f); 1536 XSETFRAME (Vmenu_updating_frame, f);
1516 1537
1517 if (! menubar_widget) 1538 if (! menubar_widget)
diff --git a/src/macterm.c b/src/macterm.c
index 7e8d13fb9f9..03b96ac7f25 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -263,9 +263,6 @@ static int is_emacs_window P_ ((WindowPtr));
263static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); 263static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
264static void XSetFont P_ ((Display *, GC, XFontStruct *)); 264static void XSetFont P_ ((Display *, GC, XFontStruct *));
265 265
266/* Defined in macmenu.h. */
267extern void menubar_selection_callback (FRAME_PTR, int);
268
269#define GC_FORE_COLOR(gc) (&(gc)->fore_color) 266#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
270#define GC_BACK_COLOR(gc) (&(gc)->back_color) 267#define GC_BACK_COLOR(gc) (&(gc)->back_color)
271#define GC_FONT(gc) ((gc)->xgcv.font) 268#define GC_FONT(gc) ((gc)->xgcv.font)
@@ -8513,7 +8510,7 @@ mac_set_font_info_for_selection (f, face_id, c)
8513#endif 8510#endif
8514#endif /* ! TARGET_API_MAC_CARBON */ 8511#endif /* ! TARGET_API_MAC_CARBON */
8515 8512
8516#define M_APPLE 128 8513#define M_APPLE 234
8517#define I_ABOUT 1 8514#define I_ABOUT 1
8518 8515
8519#define WINDOW_RESOURCE 128 8516#define WINDOW_RESOURCE 128
@@ -9103,10 +9100,10 @@ mac_tsm_suspend ()
9103} 9100}
9104#endif 9101#endif
9105 9102
9106static void 9103#if !TARGET_API_MAC_CARBON
9104void
9107do_apple_menu (SInt16 menu_item) 9105do_apple_menu (SInt16 menu_item)
9108{ 9106{
9109#if !TARGET_API_MAC_CARBON
9110 Str255 item_name; 9107 Str255 item_name;
9111 SInt16 da_driver_refnum; 9108 SInt16 da_driver_refnum;
9112 9109
@@ -9117,43 +9114,8 @@ do_apple_menu (SInt16 menu_item)
9117 GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name); 9114 GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name);
9118 da_driver_refnum = OpenDeskAcc (item_name); 9115 da_driver_refnum = OpenDeskAcc (item_name);
9119 } 9116 }
9120#endif /* !TARGET_API_MAC_CARBON */
9121}
9122
9123void
9124do_menu_choice (SInt32 menu_choice)
9125{
9126 SInt16 menu_id, menu_item;
9127
9128 menu_id = HiWord (menu_choice);
9129 menu_item = LoWord (menu_choice);
9130
9131 switch (menu_id)
9132 {
9133 case 0:
9134 break;
9135
9136 case M_APPLE:
9137 do_apple_menu (menu_item);
9138 break;
9139
9140 default:
9141 {
9142 struct frame *f = mac_focus_frame (&one_mac_display_info);
9143 MenuHandle menu = GetMenuHandle (menu_id);
9144 if (menu)
9145 {
9146 UInt32 refcon;
9147
9148 GetMenuItemRefCon (menu, menu_item, &refcon);
9149 menubar_selection_callback (f, refcon);
9150 }
9151 }
9152 }
9153
9154 HiliteMenu (0);
9155} 9117}
9156 9118#endif /* !TARGET_API_MAC_CARBON */
9157 9119
9158/* Handle drags in size box. Based on code contributed by Ben 9120/* Handle drags in size box. Based on code contributed by Ben
9159 Mesander and IM - Window Manager A. */ 9121 Mesander and IM - Window Manager A. */
diff --git a/src/macterm.h b/src/macterm.h
index 945dbf3af57..edd89163e13 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -226,7 +226,8 @@ struct x_output
226}; 226};
227 227
228/* The collection of data describing a window on the Mac. */ 228/* The collection of data describing a window on the Mac. */
229struct mac_output { 229struct mac_output
230{
230 /* Placeholder for things accessed through output_data.x. Must 231 /* Placeholder for things accessed through output_data.x. Must
231 appear first. */ 232 appear first. */
232 struct x_output x_compatible; 233 struct x_output x_compatible;
@@ -316,9 +317,6 @@ struct mac_output {
316 /* Nonzero means tried already to make this frame visible. */ 317 /* Nonzero means tried already to make this frame visible. */
317 char asked_for_visible; 318 char asked_for_visible;
318 319
319 /* Nonzero means menubar is currently active. */
320 char menubar_active;
321
322 /* Relief GCs, colors etc. */ 320 /* Relief GCs, colors etc. */
323 struct relief 321 struct relief
324 { 322 {
@@ -629,8 +627,10 @@ extern OSStatus mac_show_hide_font_panel P_ ((void));
629extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); 627extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int));
630extern OSStatus install_window_handler P_ ((WindowPtr)); 628extern OSStatus install_window_handler P_ ((WindowPtr));
631extern void remove_window_handler P_ ((WindowPtr)); 629extern void remove_window_handler P_ ((WindowPtr));
632extern void do_menu_choice P_ ((SInt32));
633extern OSStatus mac_post_mouse_moved_event P_ ((void)); 630extern OSStatus mac_post_mouse_moved_event P_ ((void));
631#if !TARGET_API_MAC_CARBON
632extern void do_apple_menu P_ ((SInt16));
633#endif
634#if USE_CG_DRAWING 634#if USE_CG_DRAWING
635extern void mac_prepare_for_quickdraw P_ ((struct frame *)); 635extern void mac_prepare_for_quickdraw P_ ((struct frame *));
636#endif 636#endif
diff --git a/src/md5.c b/src/md5.c
index d3c25b04d3e..0daf2c3ef7c 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -5,17 +5,17 @@
5 This file is part of the GNU Emacs. 5 This file is part of the GNU Emacs.
6 6
7 The GNU C Library is free software; you can redistribute it and/or 7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as 8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the 9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. 10 License, or (at your option) any later version.
11 11
12 The GNU C Library is distributed in the hope that it will be useful, 12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public 17 You should have received a copy of the GNU General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not, 18 License along with the GNU C Library; see the file COPYING. If not,
19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
diff --git a/src/md5.h b/src/md5.h
index 09bf02ff753..202b2749504 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -5,17 +5,17 @@
5 This file is part of GNU Emacs. 5 This file is part of GNU Emacs.
6 6
7 The GNU C Library is free software; you can redistribute it and/or 7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as 8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the 9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. 10 License, or (at your option) any later version.
11 11
12 The GNU C Library is distributed in the hope that it will be useful, 12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public 17 You should have received a copy of the GNU General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not, 18 License along with the GNU C Library; see the file COPYING. If not,
19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
diff --git a/src/print.c b/src/print.c
index 1cc85270bc6..f6b64e32e30 100644
--- a/src/print.c
+++ b/src/print.c
@@ -217,7 +217,7 @@ int print_output_debug_flag = 1;
217 if (MARKERP (printcharfun)) \ 217 if (MARKERP (printcharfun)) \
218 { \ 218 { \
219 EMACS_INT marker_pos; \ 219 EMACS_INT marker_pos; \
220 if (!(XMARKER (printcharfun)->buffer)) \ 220 if (! XMARKER (printcharfun)->buffer) \
221 error ("Marker does not point anywhere"); \ 221 error ("Marker does not point anywhere"); \
222 if (XMARKER (printcharfun)->buffer != current_buffer) \ 222 if (XMARKER (printcharfun)->buffer != current_buffer) \
223 set_buffer_internal (XMARKER (printcharfun)->buffer); \ 223 set_buffer_internal (XMARKER (printcharfun)->buffer); \
@@ -290,7 +290,7 @@ int print_output_debug_flag = 1;
290 SET_PT_BOTH (old_point + (old_point >= start_point \ 290 SET_PT_BOTH (old_point + (old_point >= start_point \
291 ? PT - start_point : 0), \ 291 ? PT - start_point : 0), \
292 old_point_byte + (old_point_byte >= start_point_byte \ 292 old_point_byte + (old_point_byte >= start_point_byte \
293 ? PT_BYTE - start_point_byte : 0)); \ 293 ? PT_BYTE - start_point_byte : 0)); \
294 if (old != current_buffer) \ 294 if (old != current_buffer) \
295 set_buffer_internal (old); 295 set_buffer_internal (old);
296 296
@@ -956,7 +956,7 @@ debug_output_compilation_hack (x)
956 print_output_debug_flag = x; 956 print_output_debug_flag = x;
957} 957}
958 958
959#if defined(GNU_LINUX) 959#if defined (GNU_LINUX)
960 960
961/* This functionality is not vitally important in general, so we rely on 961/* This functionality is not vitally important in general, so we rely on
962 non-portable ability to use stderr as lvalue. */ 962 non-portable ability to use stderr as lvalue. */
@@ -976,7 +976,7 @@ append to existing target file. */)
976 Lisp_Object file, append; 976 Lisp_Object file, append;
977{ 977{
978 if (initial_stderr_stream != NULL) 978 if (initial_stderr_stream != NULL)
979 fclose(stderr); 979 fclose (stderr);
980 stderr = initial_stderr_stream; 980 stderr = initial_stderr_stream;
981 initial_stderr_stream = NULL; 981 initial_stderr_stream = NULL;
982 982
@@ -984,7 +984,7 @@ append to existing target file. */)
984 { 984 {
985 file = Fexpand_file_name (file, Qnil); 985 file = Fexpand_file_name (file, Qnil);
986 initial_stderr_stream = stderr; 986 initial_stderr_stream = stderr;
987 stderr = fopen(SDATA (file), NILP (append) ? "w" : "a"); 987 stderr = fopen (SDATA (file), NILP (append) ? "w" : "a");
988 if (stderr == NULL) 988 if (stderr == NULL)
989 { 989 {
990 stderr = initial_stderr_stream; 990 stderr = initial_stderr_stream;
@@ -2150,7 +2150,7 @@ print_object (obj, printcharfun, escapeflag)
2150 /* Do you think this is necessary? */ 2150 /* Do you think this is necessary? */
2151 if (XMARKER (obj)->insertion_type != 0) 2151 if (XMARKER (obj)->insertion_type != 0)
2152 strout ("(moves after insertion) ", -1, -1, printcharfun, 0); 2152 strout ("(moves after insertion) ", -1, -1, printcharfun, 0);
2153 if (!(XMARKER (obj)->buffer)) 2153 if (! XMARKER (obj)->buffer)
2154 strout ("in no buffer", -1, -1, printcharfun, 0); 2154 strout ("in no buffer", -1, -1, printcharfun, 0);
2155 else 2155 else
2156 { 2156 {
@@ -2164,7 +2164,7 @@ print_object (obj, printcharfun, escapeflag)
2164 2164
2165 case Lisp_Misc_Overlay: 2165 case Lisp_Misc_Overlay:
2166 strout ("#<overlay ", -1, -1, printcharfun, 0); 2166 strout ("#<overlay ", -1, -1, printcharfun, 0);
2167 if (!(XMARKER (OVERLAY_START (obj))->buffer)) 2167 if (! XMARKER (OVERLAY_START (obj))->buffer)
2168 strout ("in no buffer", -1, -1, printcharfun, 0); 2168 strout ("in no buffer", -1, -1, printcharfun, 0);
2169 else 2169 else
2170 { 2170 {
@@ -2211,8 +2211,8 @@ print_object (obj, printcharfun, escapeflag)
2211 2211
2212 case Lisp_Misc_Kboard_Objfwd: 2212 case Lisp_Misc_Kboard_Objfwd:
2213 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0); 2213 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0);
2214 print_object (*(Lisp_Object *)((char *) current_kboard 2214 print_object (*(Lisp_Object *) ((char *) current_kboard
2215 + XKBOARD_OBJFWD (obj)->offset), 2215 + XKBOARD_OBJFWD (obj)->offset),
2216 printcharfun, escapeflag); 2216 printcharfun, escapeflag);
2217 PRINTCHAR ('>'); 2217 PRINTCHAR ('>');
2218 break; 2218 break;
@@ -2300,7 +2300,7 @@ print_interval (interval, printcharfun)
2300 print_object (make_number (interval->position), printcharfun, 1); 2300 print_object (make_number (interval->position), printcharfun, 1);
2301 PRINTCHAR (' '); 2301 PRINTCHAR (' ');
2302 print_object (make_number (interval->position + LENGTH (interval)), 2302 print_object (make_number (interval->position + LENGTH (interval)),
2303 printcharfun, 1); 2303 printcharfun, 1);
2304 PRINTCHAR (' '); 2304 PRINTCHAR (' ');
2305 print_object (interval->plist, printcharfun, 1); 2305 print_object (interval->plist, printcharfun, 1);
2306} 2306}
diff --git a/src/regex.c b/src/regex.c
index 48baacd81e2..09776848220 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -6332,6 +6332,10 @@ re_compile_pattern (pattern, length, bufp)
6332{ 6332{
6333 reg_errcode_t ret; 6333 reg_errcode_t ret;
6334 6334
6335#ifdef emacs
6336 gl_state.current_syntax_table = current_buffer->syntax_table;
6337#endif
6338
6335 /* GNU code is written to assume at least RE_NREGS registers will be set 6339 /* GNU code is written to assume at least RE_NREGS registers will be set
6336 (and at least one extra will be -1). */ 6340 (and at least one extra will be -1). */
6337 bufp->regs_allocated = REGS_UNALLOCATED; 6341 bufp->regs_allocated = REGS_UNALLOCATED;
diff --git a/src/search.c b/src/search.c
index ce9fa958910..72ce7e79559 100644
--- a/src/search.c
+++ b/src/search.c
@@ -42,6 +42,9 @@ struct regexp_cache
42{ 42{
43 struct regexp_cache *next; 43 struct regexp_cache *next;
44 Lisp_Object regexp, whitespace_regexp; 44 Lisp_Object regexp, whitespace_regexp;
45 /* Syntax table for which the regexp applies. We need this because
46 of character classes. */
47 Lisp_Object syntax_table;
45 struct re_pattern_buffer buf; 48 struct re_pattern_buffer buf;
46 char fastmap[0400]; 49 char fastmap[0400];
47 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 50 /* Nonzero means regexp was compiled to do full POSIX backtracking. */
@@ -134,6 +137,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
134 cp->buf.multibyte = STRING_MULTIBYTE (pattern); 137 cp->buf.multibyte = STRING_MULTIBYTE (pattern);
135 cp->buf.target_multibyte = multibyte; 138 cp->buf.target_multibyte = multibyte;
136 cp->whitespace_regexp = Vsearch_spaces_regexp; 139 cp->whitespace_regexp = Vsearch_spaces_regexp;
140 cp->syntax_table = current_buffer->syntax_table;
137 /* Doing BLOCK_INPUT here has the effect that 141 /* Doing BLOCK_INPUT here has the effect that
138 the debugger won't run if an error occurs. 142 the debugger won't run if an error occurs.
139 Why is BLOCK_INPUT needed here? */ 143 Why is BLOCK_INPUT needed here? */
@@ -173,6 +177,19 @@ shrink_regexp_cache ()
173 } 177 }
174} 178}
175 179
180/* Clear the regexp cache.
181 There is no danger of memory leak here because re_compile_pattern
182 automagically manages the memory in each re_pattern_buffer struct,
183 based on its `allocated' and `buffer' values. */
184void
185clear_regexp_cache ()
186{
187 int i;
188
189 for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
190 searchbufs[i].regexp = Qnil;
191}
192
176/* Compile a regexp if necessary, but first check to see if there's one in 193/* Compile a regexp if necessary, but first check to see if there's one in
177 the cache. 194 the cache.
178 PATTERN is the pattern to compile. 195 PATTERN is the pattern to compile.
@@ -209,6 +226,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
209 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 226 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
210 && cp->posix == posix 227 && cp->posix == posix
211 && cp->buf.target_multibyte == multibyte 228 && cp->buf.target_multibyte == multibyte
229 /* TODO: Strictly speaking, we only need to match syntax
230 tables when a character class like [[:space:]] occurs in
231 the pattern. -- cyd*/
232 && EQ (cp->syntax_table, current_buffer->syntax_table)
212 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))) 233 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
213 break; 234 break;
214 235
@@ -3077,8 +3098,10 @@ syms_of_search ()
3077 searchbufs[i].buf.fastmap = searchbufs[i].fastmap; 3098 searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
3078 searchbufs[i].regexp = Qnil; 3099 searchbufs[i].regexp = Qnil;
3079 searchbufs[i].whitespace_regexp = Qnil; 3100 searchbufs[i].whitespace_regexp = Qnil;
3101 searchbufs[i].syntax_table = Qnil;
3080 staticpro (&searchbufs[i].regexp); 3102 staticpro (&searchbufs[i].regexp);
3081 staticpro (&searchbufs[i].whitespace_regexp); 3103 staticpro (&searchbufs[i].whitespace_regexp);
3104 staticpro (&searchbufs[i].syntax_table);
3082 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); 3105 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
3083 } 3106 }
3084 searchbuf_head = &searchbufs[0]; 3107 searchbuf_head = &searchbufs[0];
diff --git a/src/strftime.c b/src/strftime.c
index f46b40f232a..123763d8845 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -7,17 +7,17 @@
7 This file is part of the GNU Emacs. 7 This file is part of the GNU Emacs.
8 8
9 This program is free software; you can redistribute it and/or 9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public License 10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2, or 11 as published by the Free Software Foundation; either version 2, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details. 17 General Public License for more details.
18 18
19 You should have received a copy of the GNU Library General Public 19 You should have received a copy of the GNU General Public
20 License along with the GNU C Library; see the file COPYING.LIB. If not, 20 License along with the GNU C Library; see the file COPYING. If not,
21 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */ 22 Boston, MA 02110-1301, USA. */
23 23
diff --git a/src/syntax.c b/src/syntax.c
index b0b4bdc0032..a58fc70a113 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1029,6 +1029,11 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
1029 SET_RAW_SYNTAX_ENTRY_RANGE (syntax_table, c, newentry); 1029 SET_RAW_SYNTAX_ENTRY_RANGE (syntax_table, c, newentry);
1030 else 1030 else
1031 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), newentry); 1031 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), newentry);
1032
1033 /* We clear the regexp cache, since character classes can now have
1034 different values from those in the compiled regexps.*/
1035 clear_regexp_cache ();
1036
1032 return Qnil; 1037 return Qnil;
1033} 1038}
1034 1039
diff --git a/src/window.c b/src/window.c
index 4208323eab3..2a3d29a8da8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -340,8 +340,8 @@ return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
340where X and Y are the pixel coordinates relative to the top left corner 340where X and Y are the pixel coordinates relative to the top left corner
341of the window. The remaining elements are omitted if the character after 341of the window. The remaining elements are omitted if the character after
342POS is fully visible; otherwise, RTOP and RBOT are the number of pixels 342POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
343invisible at the top and bottom of the row, ROWH is the height of the display 343off-screen at the top and bottom of the row, ROWH is the height of the
344row, and VPOS is the row number (0-based) containing POS. */) 344display row, and VPOS is the row number (0-based) containing POS. */)
345 (pos, window, partially) 345 (pos, window, partially)
346 Lisp_Object pos, window, partially; 346 Lisp_Object pos, window, partially;
347{ 347{
@@ -390,6 +390,117 @@ row, and VPOS is the row number (0-based) containing POS. */)
390 return in_window; 390 return in_window;
391} 391}
392 392
393DEFUN ("window-line-height", Fwindow_line_height,
394 Swindow_line_height, 0, 2, 0,
395 doc: /* Return height in pixels of text line LINE in window WINDOW.
396If WINDOW is nil or omitted, use selected window.
397
398Return height of current line if LINE is omitted or nil. Return height of
399header or mode line if LINE is `header-line' and `mode-line'.
400Otherwise, LINE is a text line number starting from 0. A negative number
401counts from the end of the window.
402
403Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height
404in pixels of the visible part of the line, VPOS and YPOS are the
405vertical position in lines and pixels of the row, relative to the top
406of the first text line, and OFFBOT is the number of off-screen pixels at
407the bottom of the text row. If there are off-screen pixels at the top
408of the (first) text row, YPOS is negative.
409
410Return nil if window display is not up-to-date. In that case, use
411`pos-visible-in-window-p' to obtain the information. */)
412 (line, window)
413 Lisp_Object line, window;
414{
415 register struct window *w;
416 register struct buffer *b;
417 struct glyph_row *row, *end_row;
418 int max_y, crop, i, n;
419
420 w = decode_window (window);
421
422 if (noninteractive
423 || w->pseudo_window_p)
424 return Qnil;
425
426 CHECK_BUFFER (w->buffer);
427 b = XBUFFER (w->buffer);
428
429 /* Fail if current matrix is not up-to-date. */
430 if (NILP (w->window_end_valid)
431 || current_buffer->clip_changed
432 || current_buffer->prevent_redisplay_optimizations_p
433 || XFASTINT (w->last_modified) < BUF_MODIFF (b)
434 || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
435 return Qnil;
436
437 if (NILP (line))
438 {
439 i = w->cursor.vpos;
440 if (i < 0 || i >= w->current_matrix->nrows
441 || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p))
442 return Qnil;
443 max_y = window_text_bottom_y (w);
444 goto found_row;
445 }
446
447 if (EQ (line, Qheader_line))
448 {
449 if (!WINDOW_WANTS_HEADER_LINE_P (w))
450 return Qnil;
451 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
452 if (!row->enabled_p)
453 return Qnil;
454 return list4 (make_number (row->height),
455 make_number (0), make_number (0),
456 make_number (0));
457 }
458
459 if (EQ (line, Qmode_line))
460 {
461 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
462 if (!row->enabled_p)
463 return Qnil;
464 return list4 (make_number (row->height),
465 make_number (0), /* not accurate */
466 make_number (WINDOW_HEADER_LINE_HEIGHT (w)
467 + window_text_bottom_y (w)),
468 make_number (0));
469 }
470
471 CHECK_NUMBER (line);
472 n = XINT (line);
473
474 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
475 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
476 max_y = window_text_bottom_y (w);
477 i = 0;
478
479 while ((n < 0 || i < n)
480 && row <= end_row && row->enabled_p
481 && row->y + row->height < max_y)
482 row++, i++;
483
484 if (row > end_row || !row->enabled_p)
485 return Qnil;
486
487 if (++n < 0)
488 {
489 if (-n > i)
490 return Qnil;
491 row += n;
492 i += n;
493 }
494
495 found_row:
496 crop = max (0, (row->y + row->height) - max_y);
497 return list4 (make_number (row->height + min (0, row->y) - crop),
498 make_number (i),
499 make_number (row->y),
500 make_number (crop));
501}
502
503
393 504
394static struct window * 505static struct window *
395decode_window (window) 506decode_window (window)
@@ -454,7 +565,7 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
454Return NCOL. NCOL should be zero or positive. 565Return NCOL. NCOL should be zero or positive.
455 566
456Note that if `automatic-hscrolling' is non-nil, you cannot scroll the 567Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
457window so that the location of point becomes invisible. */) 568window so that the location of point moves off-screen. */)
458 (window, ncol) 569 (window, ncol)
459 Lisp_Object window, ncol; 570 Lisp_Object window, ncol;
460{ 571{
@@ -1051,9 +1162,11 @@ if it isn't already recorded. */)
1051 Lisp_Object value; 1162 Lisp_Object value;
1052 struct window *w = decode_window (window); 1163 struct window *w = decode_window (window);
1053 Lisp_Object buf; 1164 Lisp_Object buf;
1165 struct buffer *b;
1054 1166
1055 buf = w->buffer; 1167 buf = w->buffer;
1056 CHECK_BUFFER (buf); 1168 CHECK_BUFFER (buf);
1169 b = XBUFFER (buf);
1057 1170
1058#if 0 /* This change broke some things. We should make it later. */ 1171#if 0 /* This change broke some things. We should make it later. */
1059 /* If we don't know the end position, return nil. 1172 /* If we don't know the end position, return nil.
@@ -1066,12 +1179,20 @@ if it isn't already recorded. */)
1066 1179
1067 if (! NILP (update) 1180 if (! NILP (update)
1068 && ! (! NILP (w->window_end_valid) 1181 && ! (! NILP (w->window_end_valid)
1069 && XFASTINT (w->last_modified) >= MODIFF) 1182 && XFASTINT (w->last_modified) >= BUF_MODIFF (b))
1070 && !noninteractive) 1183 && !noninteractive)
1071 { 1184 {
1072 struct text_pos startp; 1185 struct text_pos startp;
1073 struct it it; 1186 struct it it;
1074 struct buffer *old_buffer = NULL, *b = XBUFFER (buf); 1187 struct buffer *old_buffer = NULL;
1188
1189 /* Cannot use Fvertical_motion because that function doesn't
1190 cope with variable-height lines. */
1191 if (b != current_buffer)
1192 {
1193 old_buffer = current_buffer;
1194 set_buffer_internal (b);
1195 }
1075 1196
1076 /* In case W->start is out of the range, use something 1197 /* In case W->start is out of the range, use something
1077 reasonable. This situation occurred when loading a file with 1198 reasonable. This situation occurred when loading a file with
@@ -1085,14 +1206,6 @@ if it isn't already recorded. */)
1085 else 1206 else
1086 SET_TEXT_POS_FROM_MARKER (startp, w->start); 1207 SET_TEXT_POS_FROM_MARKER (startp, w->start);
1087 1208
1088 /* Cannot use Fvertical_motion because that function doesn't
1089 cope with variable-height lines. */
1090 if (b != current_buffer)
1091 {
1092 old_buffer = current_buffer;
1093 set_buffer_internal (b);
1094 }
1095
1096 start_display (&it, w, startp); 1209 start_display (&it, w, startp);
1097 move_it_vertically (&it, window_box_height (w)); 1210 move_it_vertically (&it, window_box_height (w));
1098 if (it.current_y < it.last_visible_y) 1211 if (it.current_y < it.last_visible_y)
@@ -1103,7 +1216,7 @@ if it isn't already recorded. */)
1103 set_buffer_internal (old_buffer); 1216 set_buffer_internal (old_buffer);
1104 } 1217 }
1105 else 1218 else
1106 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); 1219 XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos));
1107 1220
1108 return value; 1221 return value;
1109} 1222}
@@ -7365,6 +7478,7 @@ The selected frame is the one whose configuration has changed. */);
7365 defsubr (&Swindowp); 7478 defsubr (&Swindowp);
7366 defsubr (&Swindow_live_p); 7479 defsubr (&Swindow_live_p);
7367 defsubr (&Spos_visible_in_window_p); 7480 defsubr (&Spos_visible_in_window_p);
7481 defsubr (&Swindow_line_height);
7368 defsubr (&Swindow_buffer); 7482 defsubr (&Swindow_buffer);
7369 defsubr (&Swindow_height); 7483 defsubr (&Swindow_height);
7370 defsubr (&Swindow_width); 7484 defsubr (&Swindow_width);
diff --git a/src/xdisp.c b/src/xdisp.c
index cf241a4159a..9ab61c09c2a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20047,7 +20047,7 @@ produce_image_glyph (it)
20047{ 20047{
20048 struct image *img; 20048 struct image *img;
20049 struct face *face; 20049 struct face *face;
20050 int glyph_ascent; 20050 int glyph_ascent, crop;
20051 struct glyph_slice slice; 20051 struct glyph_slice slice;
20052 20052
20053 xassert (it->what == IT_IMAGE); 20053 xassert (it->what == IT_IMAGE);
@@ -20155,6 +20155,15 @@ produce_image_glyph (it)
20155 20155
20156 take_vertical_position_into_account (it); 20156 take_vertical_position_into_account (it);
20157 20157
20158 /* Automatically crop wide image glyphs at right edge so we can
20159 draw the cursor on same display row. */
20160 if ((crop = it->pixel_width - (it->last_visible_x - it->current_x), crop > 0)
20161 && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4))
20162 {
20163 it->pixel_width -= crop;
20164 slice.width -= crop;
20165 }
20166
20158 if (it->glyph_row) 20167 if (it->glyph_row)
20159 { 20168 {
20160 struct glyph *glyph; 20169 struct glyph *glyph;
diff --git a/src/xfns.c b/src/xfns.c
index 8e35c30c5e6..c60035e41c2 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -157,12 +157,16 @@ int display_hourglass_p;
157 157
158/* Non-zero means prompt with the old GTK file selection dialog. */ 158/* Non-zero means prompt with the old GTK file selection dialog. */
159 159
160int x_use_old_gtk_file_dialog; 160int x_gtk_use_old_file_dialog;
161 161
162/* If non-zero, by default show hidden files in the GTK file chooser. */ 162/* If non-zero, by default show hidden files in the GTK file chooser. */
163 163
164int x_gtk_show_hidden_files; 164int x_gtk_show_hidden_files;
165 165
166/* If non-zero, don't show additional help text in the GTK file chooser. */
167
168int x_gtk_file_dialog_help_text;
169
166/* If non-zero, don't collapse to tool bar when it is detached. */ 170/* If non-zero, don't collapse to tool bar when it is detached. */
167 171
168int x_gtk_whole_detached_tool_bar; 172int x_gtk_whole_detached_tool_bar;
@@ -5886,12 +5890,12 @@ Chinese, Japanese, and Korean. */);
5886 Vx_pixel_size_width_font_regexp = Qnil; 5890 Vx_pixel_size_width_font_regexp = Qnil;
5887 5891
5888/* This is not ifdef:ed, so other builds than GTK can customize it. */ 5892/* This is not ifdef:ed, so other builds than GTK can customize it. */
5889 DEFVAR_BOOL ("x-use-old-gtk-file-dialog", &x_use_old_gtk_file_dialog, 5893 DEFVAR_BOOL ("x-gtk-use-old-file-dialog", &x_gtk_use_old_file_dialog,
5890 doc: /* *Non-nil means prompt with the old GTK file selection dialog. 5894 doc: /* *Non-nil means prompt with the old GTK file selection dialog.
5891If nil or if the file selection dialog is not available, the new GTK file 5895If nil or if the file selection dialog is not available, the new GTK file
5892chooser is used instead. To turn off all file dialogs set the 5896chooser is used instead. To turn off all file dialogs set the
5893variable `use-file-dialog'. */); 5897variable `use-file-dialog'. */);
5894 x_use_old_gtk_file_dialog = 0; 5898 x_gtk_use_old_file_dialog = 0;
5895 5899
5896 DEFVAR_BOOL ("x-gtk-show-hidden-files", &x_gtk_show_hidden_files, 5900 DEFVAR_BOOL ("x-gtk-show-hidden-files", &x_gtk_show_hidden_files,
5897 doc: /* *If non-nil, the GTK file chooser will by default show hidden files. 5901 doc: /* *If non-nil, the GTK file chooser will by default show hidden files.
@@ -5899,6 +5903,12 @@ Note that this is just the default, there is a toggle button on the file
5899chooser to show or not show hidden files on a case by case basis. */); 5903chooser to show or not show hidden files on a case by case basis. */);
5900 x_gtk_show_hidden_files = 0; 5904 x_gtk_show_hidden_files = 0;
5901 5905
5906 DEFVAR_BOOL ("x-gtk-file-dialog-help-text", &x_gtk_file_dialog_help_text,
5907 doc: /* *If non-nil, the GTK file chooser will by show additional help text.
5908If more space for files in the file chooser dialog is wanted, set this to nil
5909to turn the additional text off. */);
5910 x_gtk_file_dialog_help_text = 1;
5911
5902 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", &x_gtk_whole_detached_tool_bar, 5912 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", &x_gtk_whole_detached_tool_bar,
5903 doc: /* *If non-nil, a detached tool bar is shown in full. 5913 doc: /* *If non-nil, a detached tool bar is shown in full.
5904The default is to just show an arrow and pressing on that arrow shows 5914The default is to just show an arrow and pressing on that arrow shows