aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit6
-rw-r--r--src/ChangeLog135
-rw-r--r--src/alloc.c27
-rw-r--r--src/buffer.c12
-rw-r--r--src/editfns.c24
-rw-r--r--src/frame.c13
-rw-r--r--src/keyboard.c71
-rw-r--r--src/keyboard.h3
-rw-r--r--src/print.c9
-rw-r--r--src/puresize.h2
-rw-r--r--src/w32.c22
-rw-r--r--src/w32.h3
-rw-r--r--src/w32fns.c41
-rw-r--r--src/w32menu.c6
-rw-r--r--src/xselect.c51
-rw-r--r--src/xterm.c9
-rw-r--r--src/xterm.h6
17 files changed, 394 insertions, 46 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 60730536ae9..e1ad68e9eb3 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -164,6 +164,10 @@ define pitx
164 if ($it->current.pos.charpos != $it->current.pos.bytepos) 164 if ($it->current.pos.charpos != $it->current.pos.bytepos)
165 printf "[%d]", $it->current.pos.bytepos 165 printf "[%d]", $it->current.pos.bytepos
166 end 166 end
167 printf " pos=%d", $it->position.charpos
168 if ($it->position.charpos != $it->position.bytepos)
169 printf "[%d]", $it->position.bytepos
170 end
167 printf " start=%d", $it->start.pos.charpos 171 printf " start=%d", $it->start.pos.charpos
168 if ($it->start.pos.charpos != $it->start.pos.bytepos) 172 if ($it->start.pos.charpos != $it->start.pos.bytepos)
169 printf "[%d]", $it->start.pos.bytepos 173 printf "[%d]", $it->start.pos.bytepos
@@ -218,7 +222,7 @@ define pitx
218 printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent 222 printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent
219 printf "\n" 223 printf "\n"
220 set $i = 0 224 set $i = 0
221 while ($i < $it->sp) 225 while ($i < $it->sp && $i < 4)
222 set $e = $it->stack[$i] 226 set $e = $it->stack[$i]
223 printf "stack[%d]: ", $i 227 printf "stack[%d]: ", $i
224 output $e->method 228 output $e->method
diff --git a/src/ChangeLog b/src/ChangeLog
index 474ead0cde6..1d7e22867e3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,138 @@
12006-08-16 Andreas Schwab <schwab@suse.de>
2
3 * print.c (debug_output_compilation_hack): Fix return type.
4
52006-08-16 Richard Stallman <rms@gnu.org>
6
7 * print.c (debug_output_compilation_hack): New function.
8
92006-08-16 Kenichi Handa <handa@m17n.org>
10
11 * fileio.c (choose_write_coding_system): Use LF for end-of-line
12 in auto-saving.
13
142006-08-15 Chong Yidong <cyd@stupidchicken.com>
15
16 * keyboard.c (read_char): Don't change idle timer state at all if
17 end_time is supplied.
18
192006-08-15 Kenichi Handa <handa@m17n.org>
20
21 * coding.c (ONE_MORE_BYTE_CHECK_MULTIBYTE): New arg RET. If SRC
22 is exhausted, return with RET.
23 (detect_coding_emacs_mule, detect_coding_iso2022)
24 (detect_coding_sjis, detect_coding_big5, detect_coding_utf_8)
25 (detect_coding_utf_16, detect_coding_ccl): Adjusted for the above
26 change.
27
282006-08-14 Chong Yidong <cyd@stupidchicken.com>
29
30 * keyboard.c (read_char): Don't reset idle timers if a time limit
31 is supplied.
32
332006-08-14 Kim F. Storm <storm@cua.dk>
34
35 * .gdbinit (pitx): Print iterator position.
36 Limit stack dump in case iterator is not initialized.
37
382006-08-12 Eli Zaretskii <eliz@gnu.org>
39
40 * frame.c (Fmouse_position, Fmouse_pixel_position)
41 (Fset_mouse_position, Fset_mouse_pixel_position): Doc fix.
42
432006-08-11 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
44
45 * xselect.c (Fx_register_dnd_atom): New function.
46 (syms_of_xselect): Defsubr it.
47 (x_handle_dnd_message): Check that message_type is in
48 dpyinfo->x_dnd_atoms before generating lisp event.
49
50 * xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track
51 of drag and drop Atoms.
52
53 * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms*
54
55
562006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
57
58 * keyboard.c: Define in_sighandler.
59 (input_available_signal): Set in_sighandler.
60 (init_keyboard): Initialize in_sighandler.
61
62 * keyboard.h: Declare in_sighandler.
63
64 * alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler
65 to check if mutex should be locked or not.
66
672006-08-09 Richard Stallman <rms@gnu.org>
68
69 * keyboard.c (keyremap_step): No-op if fkey->parent = nil.
70 (read_key_sequence): Always start fkey.start and fkey.end at 0,
71 and likewise for keytran.
72
732006-08-09 Kenichi Handa <handa@m17n.org>
74
75 * coding.c (syms_of_coding): Improve the docstring
76 file-coding-system-alist.
77
782006-08-07 Andreas Schwab <schwab@suse.de>
79
80 * puresize.h (BASE_PURESIZE): Increase to 1120000.
81
822006-08-06 Chong Yidong <cyd@stupidchicken.com>
83
84 * buffer.c (Vchange_major_mode_hook, Qchange_major_mode_hook): New vars.
85 (Fkill_all_local_variables): Use it.
86 (syms_of_buffer): Defvar it.
87
882006-08-05 Eli Zaretskii <eliz@gnu.org>
89
90 * w32.c (w32_valid_pointer_p): New function.
91
92 * w32.h: Add prototype for w32_valid_pointer_p.
93
94 * alloc.c: Include w32.h.
95 (valid_lisp_object_p) [WINDOWSNT]: Call w32_valid_pointer_p to do
96 the job.
97
98 * keyboard.c (kbd_buffer_get_event): Return Qnil when current time
99 is exactly equal to end_time, not only when it is past that.
100
1012006-08-04 Chong Yidong <cyd@stupidchicken.com>
102
103 * keyboard.c (read_char): Rebalance specpdl after receiving jump.
104
105 * process.c: Reapply 2006-08-01 change.
106
1072006-08-04 Eli Zaretskii <eliz@gnu.org>
108
109 * w32fns.c (w32_query_font): Fix last change: use stricmp.
110
1112006-08-04 Stefan Monnier <monnier@iro.umontreal.ca>
112
113 * editfns.c (Fsubst_char_in_region): Redo the setup work after running
114 the before-change-functions since they may have altered the buffer.
115
1162006-08-04 Ralf Angeli <angeli@caeruleus.net>
117
118 * w32fns.c (w32_createwindow): Handle -geometry command line option
119 and the geometry settings in the Registry.
120
1212006-08-04 Kenichi Handa <handa@m17n.org>
122
123 * w32fns.c (w32_query_font): Compare names by ignoring case.
124
125 * xterm.c (x_query_font): Compare names by ignoring case.
126
1272006-08-03 Jason Rumney <jasonr@gnu.org>
128
129 * w32menu.c (w32_menu_show, w32_dialog_show): Call Fsignal to quit
130 when no option selected.
131
1322006-08-03 Chong Yidong <cyd@stupidchicken.com>
133
134 * process.c: Revert last change.
135
12006-08-01 Kim F. Storm <storm@cua.dk> 1362006-08-01 Kim F. Storm <storm@cua.dk>
2 137
3 * process.c (wait_reading_process_output_unwind): New function. 138 * process.c (wait_reading_process_output_unwind): New function.
diff --git a/src/alloc.c b/src/alloc.c
index 171cdade81a..9cd87503c5a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -80,6 +80,7 @@ extern POINTER_TYPE *sbrk ();
80 80
81#ifdef WINDOWSNT 81#ifdef WINDOWSNT
82#include <fcntl.h> 82#include <fcntl.h>
83#include "w32.h"
83#endif 84#endif
84 85
85#ifdef DOUG_LEA_MALLOC 86#ifdef DOUG_LEA_MALLOC
@@ -129,17 +130,27 @@ static pthread_mutex_t alloc_mutex;
129#define BLOCK_INPUT_ALLOC \ 130#define BLOCK_INPUT_ALLOC \
130 do \ 131 do \
131 { \ 132 { \
132 pthread_mutex_lock (&alloc_mutex); \ 133 if (!in_sighandler) \
133 if (pthread_self () == main_thread) \ 134 { \
134 BLOCK_INPUT; \ 135 pthread_mutex_lock (&alloc_mutex); \
136 if (pthread_self () == main_thread) \
137 BLOCK_INPUT; \
138 else \
139 sigblock (sigmask (SIGIO)); \
140 } \
135 } \ 141 } \
136 while (0) 142 while (0)
137#define UNBLOCK_INPUT_ALLOC \ 143#define UNBLOCK_INPUT_ALLOC \
138 do \ 144 do \
139 { \ 145 { \
140 if (pthread_self () == main_thread) \ 146 if (!in_sighandler) \
141 UNBLOCK_INPUT; \ 147 { \
142 pthread_mutex_unlock (&alloc_mutex); \ 148 pthread_mutex_unlock (&alloc_mutex); \
149 if (pthread_self () == main_thread) \
150 UNBLOCK_INPUT; \
151 else \
152 sigunblock (sigmask (SIGIO)); \
153 } \
143 } \ 154 } \
144 while (0) 155 while (0)
145 156
@@ -4572,6 +4583,9 @@ int
4572valid_pointer_p (p) 4583valid_pointer_p (p)
4573 void *p; 4584 void *p;
4574{ 4585{
4586#ifdef WINDOWSNT
4587 return w32_valid_pointer_p (p, 16);
4588#else
4575 int fd; 4589 int fd;
4576 4590
4577 /* Obviously, we cannot just access it (we would SEGV trying), so we 4591 /* Obviously, we cannot just access it (we would SEGV trying), so we
@@ -4588,6 +4602,7 @@ valid_pointer_p (p)
4588 } 4602 }
4589 4603
4590 return -1; 4604 return -1;
4605#endif
4591} 4606}
4592 4607
4593/* Return 1 if OBJ is a valid lisp object. 4608/* Return 1 if OBJ is a valid lisp object.
diff --git a/src/buffer.c b/src/buffer.c
index 6115f727deb..d26c4451d13 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -146,6 +146,9 @@ Lisp_Object Vinhibit_read_only;
146Lisp_Object Vkill_buffer_query_functions; 146Lisp_Object Vkill_buffer_query_functions;
147Lisp_Object Qkill_buffer_query_functions; 147Lisp_Object Qkill_buffer_query_functions;
148 148
149/* Hook run before changing a major mode. */
150Lisp_Object Vchange_major_mode_hook, Qchange_major_mode_hook;
151
149/* List of functions to call before changing an unmodified buffer. */ 152/* List of functions to call before changing an unmodified buffer. */
150Lisp_Object Vfirst_change_hook; 153Lisp_Object Vfirst_change_hook;
151 154
@@ -2402,7 +2405,7 @@ the normal hook `change-major-mode-hook'. */)
2402 Lisp_Object oalist; 2405 Lisp_Object oalist;
2403 2406
2404 if (!NILP (Vrun_hooks)) 2407 if (!NILP (Vrun_hooks))
2405 call1 (Vrun_hooks, intern ("change-major-mode-hook")); 2408 call1 (Vrun_hooks, Qchange_major_mode_hook);
2406 oalist = current_buffer->local_var_alist; 2409 oalist = current_buffer->local_var_alist;
2407 2410
2408 /* Make sure none of the bindings in oalist 2411 /* Make sure none of the bindings in oalist
@@ -6014,6 +6017,13 @@ t means to use hollow box cursor. See `cursor-type' for other values. */);
6014 doc: /* List of functions called with no args to query before killing a buffer. */); 6017 doc: /* List of functions called with no args to query before killing a buffer. */);
6015 Vkill_buffer_query_functions = Qnil; 6018 Vkill_buffer_query_functions = Qnil;
6016 6019
6020 DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook,
6021 doc: /* Normal hook run before changing the major mode of a buffer.
6022The function `kill-all-local-variables' runs this before doing anything else. */);
6023 Vchange_major_mode_hook = Qnil;
6024 Qchange_major_mode_hook = intern ("change-major-mode-hook");
6025 staticpro (&Qchange_major_mode_hook);
6026
6017 defsubr (&Sbuffer_live_p); 6027 defsubr (&Sbuffer_live_p);
6018 defsubr (&Sbuffer_list); 6028 defsubr (&Sbuffer_list);
6019 defsubr (&Sget_buffer); 6029 defsubr (&Sget_buffer);
diff --git a/src/editfns.c b/src/editfns.c
index 02ea2d2abb8..aa6ad457676 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2712,6 +2712,10 @@ Both characters must have the same length of multi-byte form. */)
2712 Lisp_Object start, end, fromchar, tochar, noundo; 2712 Lisp_Object start, end, fromchar, tochar, noundo;
2713{ 2713{
2714 register int pos, pos_byte, stop, i, len, end_byte; 2714 register int pos, pos_byte, stop, i, len, end_byte;
2715 /* Keep track of the first change in the buffer:
2716 if 0 we haven't found it yet.
2717 if < 0 we've found it and we've run the before-change-function.
2718 if > 0 we've actually performed it and the value is its position. */
2715 int changed = 0; 2719 int changed = 0;
2716 unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; 2720 unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH];
2717 unsigned char *p; 2721 unsigned char *p;
@@ -2724,6 +2728,8 @@ Both characters must have the same length of multi-byte form. */)
2724 int last_changed = 0; 2728 int last_changed = 0;
2725 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2729 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
2726 2730
2731 restart:
2732
2727 validate_region (&start, &end); 2733 validate_region (&start, &end);
2728 CHECK_NUMBER (fromchar); 2734 CHECK_NUMBER (fromchar);
2729 CHECK_NUMBER (tochar); 2735 CHECK_NUMBER (tochar);
@@ -2761,7 +2767,7 @@ Both characters must have the same length of multi-byte form. */)
2761 That's faster than getting rid of things, 2767 That's faster than getting rid of things,
2762 and it prevents even the entry for a first change. 2768 and it prevents even the entry for a first change.
2763 Also inhibit locking the file. */ 2769 Also inhibit locking the file. */
2764 if (!NILP (noundo)) 2770 if (!changed && !NILP (noundo))
2765 { 2771 {
2766 record_unwind_protect (subst_char_in_region_unwind, 2772 record_unwind_protect (subst_char_in_region_unwind,
2767 current_buffer->undo_list); 2773 current_buffer->undo_list);
@@ -2795,10 +2801,14 @@ Both characters must have the same length of multi-byte form. */)
2795 && (len == 2 || (p[2] == fromstr[2] 2801 && (len == 2 || (p[2] == fromstr[2]
2796 && (len == 3 || p[3] == fromstr[3])))))) 2802 && (len == 3 || p[3] == fromstr[3]))))))
2797 { 2803 {
2798 if (! changed) 2804 if (changed < 0)
2805 /* We've already seen this and run the before-change-function;
2806 this time we only need to record the actual position. */
2807 changed = pos;
2808 else if (!changed)
2799 { 2809 {
2800 changed = pos; 2810 changed = -1;
2801 modify_region (current_buffer, changed, XINT (end)); 2811 modify_region (current_buffer, pos, XINT (end));
2802 2812
2803 if (! NILP (noundo)) 2813 if (! NILP (noundo))
2804 { 2814 {
@@ -2807,6 +2817,10 @@ Both characters must have the same length of multi-byte form. */)
2807 if (MODIFF - 1 == current_buffer->auto_save_modified) 2817 if (MODIFF - 1 == current_buffer->auto_save_modified)
2808 current_buffer->auto_save_modified++; 2818 current_buffer->auto_save_modified++;
2809 } 2819 }
2820
2821 /* The before-change-function may have moved the gap
2822 or even modified the buffer so we should start over. */
2823 goto restart;
2810 } 2824 }
2811 2825
2812 /* Take care of the case where the new character 2826 /* Take care of the case where the new character
@@ -2859,7 +2873,7 @@ Both characters must have the same length of multi-byte form. */)
2859 pos++; 2873 pos++;
2860 } 2874 }
2861 2875
2862 if (changed) 2876 if (changed > 0)
2863 { 2877 {
2864 signal_after_change (changed, 2878 signal_after_change (changed,
2865 last_changed - changed, last_changed - changed); 2879 last_changed - changed, last_changed - changed);
diff --git a/src/frame.c b/src/frame.c
index 9bbdcd592aa..c57618696eb 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1439,7 +1439,8 @@ The functions are run with one arg, the frame to be deleted. */)
1439DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0, 1439DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
1440 doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position. 1440 doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1441The position is given in character cells, where (0, 0) is the 1441The position is given in character cells, where (0, 0) is the
1442upper-left corner. 1442upper-left corner of the frame, X is the horizontal offset, and Y is
1443the vertical offset.
1443If Emacs is running on a mouseless terminal or hasn't been programmed 1444If Emacs is running on a mouseless terminal or hasn't been programmed
1444to read the mouse position, it returns the selected frame for FRAME 1445to read the mouse position, it returns the selected frame for FRAME
1445and nil for X and Y. 1446and nil for X and Y.
@@ -1487,7 +1488,8 @@ DEFUN ("mouse-pixel-position", Fmouse_pixel_position,
1487 Smouse_pixel_position, 0, 0, 0, 1488 Smouse_pixel_position, 0, 0, 0,
1488 doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position. 1489 doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1489The position is given in pixel units, where (0, 0) is the 1490The position is given in pixel units, where (0, 0) is the
1490upper-left corner. 1491upper-left corner of the frame, X is the horizontal offset, and Y is
1492the vertical offset.
1491If Emacs is running on a mouseless terminal or hasn't been programmed 1493If Emacs is running on a mouseless terminal or hasn't been programmed
1492to read the mouse position, it returns the selected frame for FRAME 1494to read the mouse position, it returns the selected frame for FRAME
1493and nil for X and Y. */) 1495and nil for X and Y. */)
@@ -1520,6 +1522,10 @@ Coordinates are relative to the frame, not a window,
1520so the coordinates of the top left character in the frame 1522so the coordinates of the top left character in the frame
1521may be nonzero due to left-hand scroll bars or the menu bar. 1523may be nonzero due to left-hand scroll bars or the menu bar.
1522 1524
1525The position is given in character cells, where (0, 0) is the
1526upper-left corner of the frame, X is the horizontal offset, and Y is
1527the vertical offset.
1528
1523This function is a no-op for an X frame that is not visible. 1529This function is a no-op for an X frame that is not visible.
1524If you have just created a frame, you must wait for it to become visible 1530If you have just created a frame, you must wait for it to become visible
1525before calling this function on it, like this. 1531before calling this function on it, like this.
@@ -1552,6 +1558,9 @@ before calling this function on it, like this.
1552DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 1558DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
1553 Sset_mouse_pixel_position, 3, 3, 0, 1559 Sset_mouse_pixel_position, 3, 3, 0,
1554 doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME. 1560 doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
1561The position is given in pixels, where (0, 0) is the upper-left corner
1562of the frame, X is the horizontal offset, and Y is the vertical offset.
1563
1555Note, this is a no-op for an X frame that is not visible. 1564Note, this is a no-op for an X frame that is not visible.
1556If you have just created a frame, you must wait for it to become visible 1565If you have just created a frame, you must wait for it to become visible
1557before calling this function on it, like this. 1566before calling this function on it, like this.
diff --git a/src/keyboard.c b/src/keyboard.c
index 45d5832a905..62c862f69d1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -100,6 +100,9 @@ int interrupt_input_pending;
100/* File descriptor to use for input. */ 100/* File descriptor to use for input. */
101extern int input_fd; 101extern int input_fd;
102 102
103/* Nonzero if we are executing from the SIGIO signal handler. */
104int in_sighandler;
105
103#ifdef HAVE_WINDOW_SYSTEM 106#ifdef HAVE_WINDOW_SYSTEM
104/* Make all keyboard buffers much bigger when using X windows. */ 107/* Make all keyboard buffers much bigger when using X windows. */
105#ifdef MAC_OS8 108#ifdef MAC_OS8
@@ -2403,7 +2406,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2403 EMACS_TIME *end_time; 2406 EMACS_TIME *end_time;
2404{ 2407{
2405 volatile Lisp_Object c; 2408 volatile Lisp_Object c;
2406 int count; 2409 int count, jmpcount;
2407 jmp_buf local_getcjmp; 2410 jmp_buf local_getcjmp;
2408 jmp_buf save_jump; 2411 jmp_buf save_jump;
2409 volatile int key_already_recorded = 0; 2412 volatile int key_already_recorded = 0;
@@ -2629,11 +2632,13 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2629 around any call to sit_for or kbd_buffer_get_event; 2632 around any call to sit_for or kbd_buffer_get_event;
2630 it *must not* be in effect when we call redisplay. */ 2633 it *must not* be in effect when we call redisplay. */
2631 2634
2635 jmpcount = SPECPDL_INDEX ();
2632 if (_setjmp (local_getcjmp)) 2636 if (_setjmp (local_getcjmp))
2633 { 2637 {
2634 /* We must have saved the outer value of getcjmp here, 2638 /* We must have saved the outer value of getcjmp here,
2635 so restore it now. */ 2639 so restore it now. */
2636 restore_getcjmp (save_jump); 2640 restore_getcjmp (save_jump);
2641 unbind_to (jmpcount, Qnil);
2637 XSETINT (c, quit_char); 2642 XSETINT (c, quit_char);
2638 internal_last_event_frame = selected_frame; 2643 internal_last_event_frame = selected_frame;
2639 Vlast_event_frame = internal_last_event_frame; 2644 Vlast_event_frame = internal_last_event_frame;
@@ -2674,7 +2679,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2674 goto non_reread; 2679 goto non_reread;
2675 } 2680 }
2676 2681
2677 timer_start_idle (); 2682 /* Start idle timers if no time limit is supplied. We don't do it
2683 if a time limit is supplied to avoid an infinite recursion in the
2684 situation where an idle timer calls `sit-for'. */
2685
2686 if (!end_time)
2687 timer_start_idle ();
2678 2688
2679 /* If in middle of key sequence and minibuffer not active, 2689 /* If in middle of key sequence and minibuffer not active,
2680 start echoing if enough time elapses. */ 2690 start echoing if enough time elapses. */
@@ -2744,7 +2754,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2744 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); 2754 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu);
2745 2755
2746 /* Now that we have read an event, Emacs is not idle. */ 2756 /* Now that we have read an event, Emacs is not idle. */
2747 timer_stop_idle (); 2757 if (!end_time)
2758 timer_stop_idle ();
2748 2759
2749 goto exit; 2760 goto exit;
2750 } 2761 }
@@ -2874,7 +2885,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2874 /* Actually read a character, waiting if necessary. */ 2885 /* Actually read a character, waiting if necessary. */
2875 save_getcjmp (save_jump); 2886 save_getcjmp (save_jump);
2876 restore_getcjmp (local_getcjmp); 2887 restore_getcjmp (local_getcjmp);
2877 timer_start_idle (); 2888 if (!end_time)
2889 timer_start_idle ();
2878 c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); 2890 c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
2879 restore_getcjmp (save_jump); 2891 restore_getcjmp (save_jump);
2880 2892
@@ -2926,7 +2938,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2926 2938
2927 non_reread: 2939 non_reread:
2928 2940
2929 timer_stop_idle (); 2941 if (!end_time)
2942 timer_stop_idle ();
2930 RESUME_POLLING; 2943 RESUME_POLLING;
2931 2944
2932 if (NILP (c)) 2945 if (NILP (c))
@@ -2960,7 +2973,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2960 last_input_char = c; 2973 last_input_char = c;
2961 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); 2974 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt);
2962 2975
2963 if (CONSP (c) && EQ (XCAR (c), Qselect_window)) 2976 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time)
2964 /* We stopped being idle for this event; undo that. This 2977 /* We stopped being idle for this event; undo that. This
2965 prevents automatic window selection (under 2978 prevents automatic window selection (under
2966 mouse_autoselect_window from acting as a real input event, for 2979 mouse_autoselect_window from acting as a real input event, for
@@ -3166,7 +3179,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
3166 show_help_echo (help, window, object, position, 0); 3179 show_help_echo (help, window, object, position, 0);
3167 3180
3168 /* We stopped being idle for this event; undo that. */ 3181 /* We stopped being idle for this event; undo that. */
3169 timer_resume_idle (); 3182 if (!end_time)
3183 timer_resume_idle ();
3170 goto retry; 3184 goto retry;
3171 } 3185 }
3172 3186
@@ -3952,13 +3966,15 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
3952 { 3966 {
3953 EMACS_TIME duration; 3967 EMACS_TIME duration;
3954 EMACS_GET_TIME (duration); 3968 EMACS_GET_TIME (duration);
3955 EMACS_SUB_TIME (duration, *end_time, duration); 3969 if (EMACS_TIME_GE (duration, *end_time))
3956 if (EMACS_TIME_NEG_P (duration)) 3970 return Qnil; /* finished waiting */
3957 return Qnil;
3958 else 3971 else
3959 wait_reading_process_output (EMACS_SECS (duration), 3972 {
3960 EMACS_USECS (duration), 3973 EMACS_SUB_TIME (duration, *end_time, duration);
3961 -1, 1, Qnil, NULL, 0); 3974 wait_reading_process_output (EMACS_SECS (duration),
3975 EMACS_USECS (duration),
3976 -1, 1, Qnil, NULL, 0);
3977 }
3962 } 3978 }
3963 else 3979 else
3964 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); 3980 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
@@ -6920,6 +6936,8 @@ input_available_signal (signo)
6920 SIGNAL_THREAD_CHECK (signo); 6936 SIGNAL_THREAD_CHECK (signo);
6921#endif 6937#endif
6922 6938
6939 in_sighandler = 1;
6940
6923 if (input_available_clear_time) 6941 if (input_available_clear_time)
6924 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); 6942 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
6925 6943
@@ -6931,6 +6949,7 @@ input_available_signal (signo)
6931 sigfree (); 6949 sigfree ();
6932#endif 6950#endif
6933 errno = old_errno; 6951 errno = old_errno;
6952 in_sighandler = 0;
6934} 6953}
6935#endif /* SIGIO */ 6954#endif /* SIGIO */
6936 6955
@@ -8381,7 +8400,15 @@ follow_key (key, nmaps, current, defs, next)
8381 such as Vfunction_key_map and Vkey_translation_map. */ 8400 such as Vfunction_key_map and Vkey_translation_map. */
8382typedef struct keyremap 8401typedef struct keyremap
8383{ 8402{
8384 Lisp_Object map, parent; 8403 /* This is the map originally specified for this use. */
8404 Lisp_Object parent;
8405 /* This is a submap reached by looking up, in PARENT,
8406 the events from START to END. */
8407 Lisp_Object map;
8408 /* Positions [START, END) in the key sequence buffer
8409 are the key that we have scanned so far.
8410 Those events are the ones that we will replace
8411 if PAREHT maps them into a key sequence. */
8385 int start, end; 8412 int start, end;
8386} keyremap; 8413} keyremap;
8387 8414
@@ -8454,7 +8481,11 @@ keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt)
8454 Lisp_Object next, key; 8481 Lisp_Object next, key;
8455 8482
8456 key = keybuf[fkey->end++]; 8483 key = keybuf[fkey->end++];
8457 next = access_keymap_keyremap (fkey->map, key, prompt, doit); 8484
8485 if (KEYMAPP (fkey->parent))
8486 next = access_keymap_keyremap (fkey->map, key, prompt, doit);
8487 else
8488 next = Qnil;
8458 8489
8459 /* If keybuf[fkey->start..fkey->end] is bound in the 8490 /* If keybuf[fkey->start..fkey->end] is bound in the
8460 map and we're in a position to do the key remapping, replace it with 8491 map and we're in a position to do the key remapping, replace it with
@@ -8652,9 +8683,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8652 delayed_switch_frame = Qnil; 8683 delayed_switch_frame = Qnil;
8653 fkey.map = fkey.parent = Vfunction_key_map; 8684 fkey.map = fkey.parent = Vfunction_key_map;
8654 keytran.map = keytran.parent = Vkey_translation_map; 8685 keytran.map = keytran.parent = Vkey_translation_map;
8655 /* If there is no translation-map, turn off scanning. */ 8686 fkey.start = fkey.end = 0;
8656 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; 8687 keytran.start = keytran.end = 0;
8657 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
8658 8688
8659 if (INTERACTIVE) 8689 if (INTERACTIVE)
8660 { 8690 {
@@ -9481,8 +9511,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9481 9511
9482 keybuf[t - 1] = new_key; 9512 keybuf[t - 1] = new_key;
9483 mock_input = max (t, mock_input); 9513 mock_input = max (t, mock_input);
9484 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; 9514 fkey.start = fkey.end = 0;
9485 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; 9515 keytran.start = keytran.end = 0;
9486 9516
9487 goto replay_sequence; 9517 goto replay_sequence;
9488 } 9518 }
@@ -10786,6 +10816,7 @@ init_keyboard ()
10786 do_mouse_tracking = Qnil; 10816 do_mouse_tracking = Qnil;
10787#endif 10817#endif
10788 input_pending = 0; 10818 input_pending = 0;
10819 in_sighandler = 0;
10789 10820
10790 /* This means that command_loop_1 won't try to select anything the first 10821 /* This means that command_loop_1 won't try to select anything the first
10791 time through. */ 10822 time through. */
diff --git a/src/keyboard.h b/src/keyboard.h
index 96ac7d2e856..f8d8f789c08 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -190,6 +190,9 @@ extern EMACS_INT num_nonmacro_input_events;
190/* Nonzero means polling for input is temporarily suppressed. */ 190/* Nonzero means polling for input is temporarily suppressed. */
191extern int poll_suppress_count; 191extern int poll_suppress_count;
192 192
193/* Nonzero if we are executing from the SIGIO signal handler. */
194extern int in_sighandler;
195
193/* Keymap mapping ASCII function key sequences onto their preferred forms. 196/* Keymap mapping ASCII function key sequences onto their preferred forms.
194 Initialized by the terminal-specific lisp files. */ 197 Initialized by the terminal-specific lisp files. */
195extern Lisp_Object Vfunction_key_map; 198extern Lisp_Object Vfunction_key_map;
diff --git a/src/print.c b/src/print.c
index 6fdd41ada04..80fe22c7149 100644
--- a/src/print.c
+++ b/src/print.c
@@ -924,6 +924,15 @@ to make it write to the debugging output. */)
924 return character; 924 return character;
925} 925}
926 926
927/* This function is never called. Its purpose is to prevent
928 print_output_debug_flag from being optimized away. */
929
930void
931debug_output_compilation_hack (x)
932 int x;
933{
934 print_output_debug_flag = x;
935}
927 936
928#if defined(GNU_LINUX) 937#if defined(GNU_LINUX)
929 938
diff --git a/src/puresize.h b/src/puresize.h
index bae7cbb6d6a..5dd374af207 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */
43#endif 43#endif
44 44
45#ifndef BASE_PURESIZE 45#ifndef BASE_PURESIZE
46#define BASE_PURESIZE (1102000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) 46#define BASE_PURESIZE (1120000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
47#endif 47#endif
48 48
49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ 49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
diff --git a/src/w32.c b/src/w32.c
index c093eab599e..0da908ff932 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -323,6 +323,28 @@ w32_strerror (int error_no)
323 return buf; 323 return buf;
324} 324}
325 325
326/* Return 1 if P is a valid pointer to an object of size SIZE. Return
327 0 if P is NOT a valid pointer. Return -1 if we cannot validate P.
328
329 This is called from alloc.c:valid_pointer_p. */
330int
331w32_valid_pointer_p (void *p, int size)
332{
333 SIZE_T done;
334 HANDLE h = OpenProcess (PROCESS_VM_READ, FALSE, GetCurrentProcessId ());
335
336 if (h)
337 {
338 unsigned char *buf = alloca (size);
339 int retval = ReadProcessMemory (h, p, buf, size, &done);
340
341 CloseHandle (h);
342 return retval;
343 }
344 else
345 return -1;
346}
347
326static char startup_dir[MAXPATHLEN]; 348static char startup_dir[MAXPATHLEN];
327 349
328/* Get the current working directory. */ 350/* Get the current working directory. */
diff --git a/src/w32.h b/src/w32.h
index 1d5dbee6d40..6ba25a42403 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -110,6 +110,9 @@ extern void delete_child (child_process *cp);
110/* Equivalent of strerror for W32 error codes. */ 110/* Equivalent of strerror for W32 error codes. */
111extern char * w32_strerror (int error_no); 111extern char * w32_strerror (int error_no);
112 112
113/* Validate a pointer. */
114extern int w32_valid_pointer_p (void *, int);
115
113/* Get long (aka "true") form of file name, if it exists. */ 116/* Get long (aka "true") form of file name, if it exists. */
114extern BOOL w32_get_long_filename (char * name, char * buf, int size); 117extern BOOL w32_get_long_filename (char * name, char * buf, int size);
115 118
diff --git a/src/w32fns.c b/src/w32fns.c
index 9c0198f288d..f0060de7933 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2067,7 +2067,8 @@ w32_createwindow (f)
2067{ 2067{
2068 HWND hwnd; 2068 HWND hwnd;
2069 RECT rect; 2069 RECT rect;
2070 Lisp_Object top, left; 2070 Lisp_Object top = Qunbound;
2071 Lisp_Object left = Qunbound;
2071 2072
2072 rect.left = rect.top = 0; 2073 rect.left = rect.top = 0;
2073 rect.right = FRAME_PIXEL_WIDTH (f); 2074 rect.right = FRAME_PIXEL_WIDTH (f);
@@ -2080,13 +2081,41 @@ w32_createwindow (f)
2080 2081
2081 if (!hprevinst) 2082 if (!hprevinst)
2082 { 2083 {
2084 Lisp_Object ifa;
2085
2083 w32_init_class (hinst); 2086 w32_init_class (hinst);
2087
2088 /* Handle the -geometry command line option and the geometry
2089 settings in the registry. They are decoded and put into
2090 initial-frame-alist by w32-win.el:x-handle-geometry. */
2091 ifa = Fsymbol_value (intern ("initial-frame-alist"));
2092 if (CONSP (ifa))
2093 {
2094 Lisp_Object lt = Fassq (Qleft, ifa);
2095 Lisp_Object tp = Fassq (Qtop, ifa);
2096
2097 if (!NILP (lt))
2098 {
2099 lt = XCDR (lt);
2100 if (INTEGERP (lt))
2101 left = lt;
2102 }
2103 if (!NILP (tp))
2104 {
2105 tp = XCDR (tp);
2106 if (INTEGERP (tp))
2107 top = tp;
2108 }
2109 }
2084 } 2110 }
2085 2111
2086 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero 2112 if (EQ (left, Qunbound) && EQ (top, Qunbound))
2087 for anything that is not a number and is not Qunbound. */ 2113 {
2088 left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER); 2114 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
2089 top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER); 2115 for anything that is not a number and is not Qunbound. */
2116 left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
2117 top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
2118 }
2090 2119
2091 FRAME_W32_WINDOW (f) = hwnd 2120 FRAME_W32_WINDOW (f) = hwnd
2092 = CreateWindow (EMACS_CLASS, 2121 = CreateWindow (EMACS_CLASS,
@@ -6269,7 +6298,7 @@ w32_query_font (struct frame *f, char *fontname)
6269 6298
6270 for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) 6299 for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++)
6271 { 6300 {
6272 if (strcmp(pfi->name, fontname) == 0) return pfi; 6301 if (stricmp(pfi->name, fontname) == 0) return pfi;
6273 } 6302 }
6274 6303
6275 return NULL; 6304 return NULL;
diff --git a/src/w32menu.c b/src/w32menu.c
index 389e6c5b856..11af1d66b6f 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1994,6 +1994,9 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error)
1994 } 1994 }
1995 } 1995 }
1996 } 1996 }
1997 else if (!for_click)
1998 /* Make "Cancel" equivalent to C-g. */
1999 Fsignal (Qquit, Qnil);
1997 2000
1998 return Qnil; 2001 return Qnil;
1999} 2002}
@@ -2186,6 +2189,9 @@ w32_dialog_show (f, keymaps, title, header, error)
2186 } 2189 }
2187 } 2190 }
2188 } 2191 }
2192 else
2193 /* Make "Cancel" equivalent to C-g. */
2194 Fsignal (Qquit, Qnil);
2189 2195
2190 return Qnil; 2196 return Qnil;
2191} 2197}
diff --git a/src/xselect.c b/src/xselect.c
index fcac2860359..013a52dbdb1 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2677,8 +2677,48 @@ If the value is 0 or the atom is not known, return the empty string. */)
2677 return ret; 2677 return ret;
2678} 2678}
2679 2679
2680/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. 2680DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom,
2681 TODO: Check if this client event really is a DND event? */ 2681 Sx_register_dnd_atom, 1, 2, 0,
2682 doc: /* Request that dnd events are made for ClientMessages with ATOM.
2683ATOM can be a symbol or a string. The ATOM is interned on the display that
2684FRAME is on. If FRAME is nil, the selected frame is used. */)
2685 (atom, frame)
2686 Lisp_Object atom, frame;
2687{
2688 Atom x_atom;
2689 struct frame *f = check_x_frame (frame);
2690 size_t i;
2691 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
2692
2693
2694 if (SYMBOLP (atom))
2695 x_atom = symbol_to_x_atom (dpyinfo, FRAME_X_DISPLAY (f), atom);
2696 else if (STRINGP (atom))
2697 {
2698 BLOCK_INPUT;
2699 x_atom = XInternAtom (FRAME_X_DISPLAY (f), (char *) SDATA (atom), False);
2700 UNBLOCK_INPUT;
2701 }
2702 else
2703 error ("ATOM must be a symbol or a string");
2704
2705 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i)
2706 if (dpyinfo->x_dnd_atoms[i] == x_atom)
2707 return Qnil;
2708
2709 if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size)
2710 {
2711 dpyinfo->x_dnd_atoms_size *= 2;
2712 dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms,
2713 sizeof (*dpyinfo->x_dnd_atoms)
2714 * dpyinfo->x_dnd_atoms_size);
2715 }
2716
2717 dpyinfo->x_dnd_atoms[dpyinfo->x_dnd_atoms_length++] = x_atom;
2718 return Qnil;
2719}
2720
2721/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */
2682 2722
2683int 2723int
2684x_handle_dnd_message (f, event, dpyinfo, bufp) 2724x_handle_dnd_message (f, event, dpyinfo, bufp)
@@ -2694,6 +2734,12 @@ x_handle_dnd_message (f, event, dpyinfo, bufp)
2694 int x, y; 2734 int x, y;
2695 unsigned char *data = (unsigned char *) event->data.b; 2735 unsigned char *data = (unsigned char *) event->data.b;
2696 int idata[5]; 2736 int idata[5];
2737 size_t i;
2738
2739 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i)
2740 if (dpyinfo->x_dnd_atoms[i] == event->message_type) break;
2741
2742 if (i == dpyinfo->x_dnd_atoms_length) return 0;
2697 2743
2698 XSETFRAME (frame, f); 2744 XSETFRAME (frame, f);
2699 2745
@@ -2867,6 +2913,7 @@ syms_of_xselect ()
2867 2913
2868 defsubr (&Sx_get_atom_name); 2914 defsubr (&Sx_get_atom_name);
2869 defsubr (&Sx_send_client_message); 2915 defsubr (&Sx_send_client_message);
2916 defsubr (&Sx_register_dnd_atom);
2870 2917
2871 reading_selection_reply = Fcons (Qnil, Qnil); 2918 reading_selection_reply = Fcons (Qnil, Qnil);
2872 staticpro (&reading_selection_reply); 2919 staticpro (&reading_selection_reply);
diff --git a/src/xterm.c b/src/xterm.c
index 126d954a3a4..9cd945ae63b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10362,8 +10362,8 @@ x_query_font (f, fontname)
10362 10362
10363 for (i = 0; i < dpyinfo->n_fonts; i++) 10363 for (i = 0; i < dpyinfo->n_fonts; i++)
10364 if (dpyinfo->font_table[i].name 10364 if (dpyinfo->font_table[i].name
10365 && (!strcmp (dpyinfo->font_table[i].name, fontname) 10365 && (!strcasecmp (dpyinfo->font_table[i].name, fontname)
10366 || !strcmp (dpyinfo->font_table[i].full_name, fontname))) 10366 || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
10367 return (dpyinfo->font_table + i); 10367 return (dpyinfo->font_table + i);
10368 return NULL; 10368 return NULL;
10369} 10369}
@@ -11044,6 +11044,11 @@ x_term_init (display_name, xrm_option, resource_name)
11044 11044
11045 dpyinfo->cut_buffers_initialized = 0; 11045 dpyinfo->cut_buffers_initialized = 0;
11046 11046
11047 dpyinfo->x_dnd_atoms_size = 8;
11048 dpyinfo->x_dnd_atoms_length = 0;
11049 dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms)
11050 * dpyinfo->x_dnd_atoms_size);
11051
11047 connection = ConnectionNumber (dpyinfo->display); 11052 connection = ConnectionNumber (dpyinfo->display);
11048 dpyinfo->connection = connection; 11053 dpyinfo->connection = connection;
11049 11054
diff --git a/src/xterm.h b/src/xterm.h
index 8bc9782b02b..1c5d215f864 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -389,6 +389,12 @@ struct x_display_info
389 X_WMTYPE_A, 389 X_WMTYPE_A,
390 X_WMTYPE_B 390 X_WMTYPE_B
391 } wm_type; 391 } wm_type;
392
393
394 /* Atoms that are drag and drop atoms */
395 Atom *x_dnd_atoms;
396 size_t x_dnd_atoms_size;
397 size_t x_dnd_atoms_length;
392}; 398};
393 399
394#ifdef HAVE_X_I18N 400#ifdef HAVE_X_I18N