aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-06-26 21:12:57 +0000
committerKaroly Lorentey2005-06-26 21:12:57 +0000
commitd836b39b818551c04c7e598176d3f26be7abfa5e (patch)
tree51bad97e4eeb9af7e1e00646a324a38e33466beb /src
parent4ea81208d4c43df774e540a603be8f68cb470466 (diff)
parentc3bf675dd1caa64c514dcac38e2d21c64597f9ff (diff)
downloademacs-d836b39b818551c04c7e598176d3f26be7abfa5e.tar.gz
emacs-d836b39b818551c04c7e598176d3f26be7abfa5e.zip
Merged from miles@gnu.org--gnu-2005 (patch 447-448)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-447 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-448 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-360
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog51
-rw-r--r--src/dispextern.h2
-rw-r--r--src/eval.c71
-rw-r--r--src/fileio.c57
-rw-r--r--src/lread.c17
-rw-r--r--src/macfns.c2
-rw-r--r--src/s/ms-w32.h1
-rw-r--r--src/w32.c8
-rw-r--r--src/w32fns.c2
-rw-r--r--src/xdisp.c75
-rw-r--r--src/xfns.c2
11 files changed, 217 insertions, 71 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2ffb3c4959c..046d1a321fe 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,54 @@
12005-06-25 Richard M. Stallman <rms@gnu.org>
2
3 * macfns.c (Fx_show_tip): Pass new arg to try_window.
4
5 * w32fns.c (Fx_show_tip): Pass new arg to try_window.
6
7 * xfns.c (Fx_show_tip): Pass new arg to try_window.
8
9 * xdisp.c (try_window): New arg CHECK_MARGINS. Calls changed.
10 (redisplay_window): Handle try_window reporting point in scroll margin.
11
12 * dispextern.h (try_window): Declare new arg.
13
14 * fileio.c (Fcopy_file): New arg PRESERVE_UID_GID.
15 Use fchmod to copy the file modes.
16 (Frename_file): Don't copy UID and GID here;
17 instead, specify t for PRESERVE_UID_GID when calling Fcopy_file.
18
19 * eval.c (call_debugger): Take full care of extending stack limits
20 to make space for the debugger, and restore the change afterward.
21 Bind debug-on-error to nil.
22 (restore_stack_limits): New subroutine.
23 (Fsignal): Extend specpdl bound along with eval depth bound,
24 for calling edebug. Don't do either one, for calling debugger.
25 (find_handler_clause): Don't bind debug-on-error here.
26 Don't unbind anything either.
27 Temporarily advance max_specpdl_size for calling
28 internal_with_output_to_temp_buffer.
29 (grow_specpdl): Don't alter max_specpdl_size before signaling
30 an error.
31 (syms_of_eval) <max-specpdl-size>: Doc fix.
32
33 * lread.c (read1): 0.0e+NaN should make a "positive" NaN.
34
352005-06-24 Eli Zaretskii <eliz@gnu.org>
36
37 * fileio.c (Frename_file): Undo last change: no need to ifdef away
38 chown on DOS_NT platforms.
39
40 * w32.c (sys_chown): New function.
41
42 * s/ms-w32.h (chown): New; define to sys_chown.
43
442005-06-24 Juanma Barranquero <lekktu@gmail.com>
45
46 * xdisp.c (syms_of_xdisp) <nobreak-char-display>: Doc fix.
47 (syms_of_xdisp) <void-text-area-pointer>: Doc fix.
48
49 * fileio.c (Frename_file)[!DOS_NT]: Don't call chown on
50 MSDOS/Windows.
51
12005-06-23 Richard M. Stallman <rms@gnu.org> 522005-06-23 Richard M. Stallman <rms@gnu.org>
2 53
3 * xdisp.c (get_next_display_element): Finish reversing the tests of 54 * xdisp.c (get_next_display_element): Finish reversing the tests of
diff --git a/src/dispextern.h b/src/dispextern.h
index 3fb4f76a61f..3501d1de1e7 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2584,7 +2584,7 @@ int line_bottom_y P_ ((struct it *));
2584int display_prop_intangible_p P_ ((Lisp_Object)); 2584int display_prop_intangible_p P_ ((Lisp_Object));
2585void resize_echo_area_exactly P_ ((void)); 2585void resize_echo_area_exactly P_ ((void));
2586int resize_mini_window P_ ((struct window *, int)); 2586int resize_mini_window P_ ((struct window *, int));
2587int try_window P_ ((Lisp_Object, struct text_pos)); 2587int try_window P_ ((Lisp_Object, struct text_pos, int));
2588void window_box P_ ((struct window *, int, int *, int *, int *, int *)); 2588void window_box P_ ((struct window *, int, int *, int *, int *, int *));
2589int window_box_height P_ ((struct window *)); 2589int window_box_height P_ ((struct window *));
2590int window_text_bottom_y P_ ((struct window *)); 2590int window_text_bottom_y P_ ((struct window *));
diff --git a/src/eval.c b/src/eval.c
index 8ad289fd51f..c33021da7b7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -227,6 +227,18 @@ init_eval ()
227 when_entered_debugger = -1; 227 when_entered_debugger = -1;
228} 228}
229 229
230/* unwind-protect function used by call_debugger. */
231
232static Lisp_Object
233restore_stack_limits (data)
234 Lisp_Object data;
235{
236 max_specpdl_size = XINT (XCAR (data));
237 max_lisp_eval_depth = XINT (XCDR (data));
238}
239
240/* Call the Lisp debugger, giving it argument ARG. */
241
230Lisp_Object 242Lisp_Object
231call_debugger (arg) 243call_debugger (arg)
232 Lisp_Object arg; 244 Lisp_Object arg;
@@ -234,12 +246,22 @@ call_debugger (arg)
234 int debug_while_redisplaying; 246 int debug_while_redisplaying;
235 int count = SPECPDL_INDEX (); 247 int count = SPECPDL_INDEX ();
236 Lisp_Object val; 248 Lisp_Object val;
249 int old_max = max_specpdl_size;
237 250
238 if (lisp_eval_depth + 20 > max_lisp_eval_depth) 251 /* Temporarily bump up the stack limits,
239 max_lisp_eval_depth = lisp_eval_depth + 20; 252 so the debugger won't run out of stack. */
240 253
241 if (specpdl_size + 40 > max_specpdl_size) 254 max_specpdl_size += 1;
242 max_specpdl_size = specpdl_size + 40; 255 record_unwind_protect (restore_stack_limits,
256 Fcons (make_number (old_max),
257 make_number (max_lisp_eval_depth)));
258 max_specpdl_size = old_max;
259
260 if (lisp_eval_depth + 40 > max_lisp_eval_depth)
261 max_lisp_eval_depth = lisp_eval_depth + 40;
262
263 if (SPECPDL_INDEX () + 100 > max_specpdl_size)
264 max_specpdl_size = SPECPDL_INDEX () + 100;
243 265
244#ifdef HAVE_X_WINDOWS 266#ifdef HAVE_X_WINDOWS
245 if (display_hourglass_p) 267 if (display_hourglass_p)
@@ -256,6 +278,7 @@ call_debugger (arg)
256 specbind (intern ("debugger-may-continue"), 278 specbind (intern ("debugger-may-continue"),
257 debug_while_redisplaying ? Qnil : Qt); 279 debug_while_redisplaying ? Qnil : Qt);
258 specbind (Qinhibit_redisplay, Qnil); 280 specbind (Qinhibit_redisplay, Qnil);
281 specbind (Qdebug_on_error, Qnil);
259 282
260#if 0 /* Binding this prevents execution of Lisp code during 283#if 0 /* Binding this prevents execution of Lisp code during
261 redisplay, which necessarily leads to display problems. */ 284 redisplay, which necessarily leads to display problems. */
@@ -1533,7 +1556,16 @@ See also the function `condition-case'. */)
1533 /* This hook is used by edebug. */ 1556 /* This hook is used by edebug. */
1534 if (! NILP (Vsignal_hook_function) 1557 if (! NILP (Vsignal_hook_function)
1535 && ! NILP (error_symbol)) 1558 && ! NILP (error_symbol))
1536 call2 (Vsignal_hook_function, error_symbol, data); 1559 {
1560 /* Edebug takes care of restoring these variables when it exits. */
1561 if (lisp_eval_depth + 20 > max_lisp_eval_depth)
1562 max_lisp_eval_depth = lisp_eval_depth + 20;
1563
1564 if (SPECPDL_INDEX () + 40 > max_specpdl_size)
1565 max_specpdl_size = SPECPDL_INDEX () + 40;
1566
1567 call2 (Vsignal_hook_function, error_symbol, data);
1568 }
1537 1569
1538 conditions = Fget (real_error_symbol, Qerror_conditions); 1570 conditions = Fget (real_error_symbol, Qerror_conditions);
1539 1571
@@ -1555,12 +1587,6 @@ See also the function `condition-case'. */)
1555 { 1587 {
1556 register Lisp_Object clause; 1588 register Lisp_Object clause;
1557 1589
1558 if (lisp_eval_depth + 20 > max_lisp_eval_depth)
1559 max_lisp_eval_depth = lisp_eval_depth + 20;
1560
1561 if (specpdl_size + 40 > max_specpdl_size)
1562 max_specpdl_size = specpdl_size + 40;
1563
1564 clause = find_handler_clause (handlerlist->handler, conditions, 1590 clause = find_handler_clause (handlerlist->handler, conditions,
1565 error_symbol, data, &debugger_value); 1591 error_symbol, data, &debugger_value);
1566 1592
@@ -1673,7 +1699,11 @@ skip_debugger (conditions, data)
1673 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). 1699 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
1674 This is for memory-full errors only. 1700 This is for memory-full errors only.
1675 1701
1676 Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ 1702 Store value returned from debugger into *DEBUGGER_VALUE_PTR.
1703
1704 We need to increase max_specpdl_size temporarily around
1705 anything we do that can push on the specpdl, so as not to get
1706 a second error here in case we're handling specpdl overflow. */
1677 1707
1678static Lisp_Object 1708static Lisp_Object
1679find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) 1709find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
@@ -1691,7 +1721,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1691 || !NILP (Vdebug_on_signal)) /* This says call debugger even if 1721 || !NILP (Vdebug_on_signal)) /* This says call debugger even if
1692 there is a handler. */ 1722 there is a handler. */
1693 { 1723 {
1694 int count = SPECPDL_INDEX ();
1695 int debugger_called = 0; 1724 int debugger_called = 0;
1696 Lisp_Object sig_symbol, combined_data; 1725 Lisp_Object sig_symbol, combined_data;
1697 /* This is set to 1 if we are handling a memory-full error, 1726 /* This is set to 1 if we are handling a memory-full error,
@@ -1713,6 +1742,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1713 1742
1714 if (wants_debugger (Vstack_trace_on_error, conditions)) 1743 if (wants_debugger (Vstack_trace_on_error, conditions))
1715 { 1744 {
1745 max_specpdl_size++;
1716#ifdef PROTOTYPES 1746#ifdef PROTOTYPES
1717 internal_with_output_to_temp_buffer ("*Backtrace*", 1747 internal_with_output_to_temp_buffer ("*Backtrace*",
1718 (Lisp_Object (*) (Lisp_Object)) Fbacktrace, 1748 (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
@@ -1721,6 +1751,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1721 internal_with_output_to_temp_buffer ("*Backtrace*", 1751 internal_with_output_to_temp_buffer ("*Backtrace*",
1722 Fbacktrace, Qnil); 1752 Fbacktrace, Qnil);
1723#endif 1753#endif
1754 max_specpdl_size--;
1724 } 1755 }
1725 if (! no_debugger 1756 if (! no_debugger
1726 && (EQ (sig_symbol, Qquit) 1757 && (EQ (sig_symbol, Qquit)
@@ -1729,7 +1760,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1729 && ! skip_debugger (conditions, combined_data) 1760 && ! skip_debugger (conditions, combined_data)
1730 && when_entered_debugger < num_nonmacro_input_events) 1761 && when_entered_debugger < num_nonmacro_input_events)
1731 { 1762 {
1732 specbind (Qdebug_on_error, Qnil);
1733 *debugger_value_ptr 1763 *debugger_value_ptr
1734 = call_debugger (Fcons (Qerror, 1764 = call_debugger (Fcons (Qerror,
1735 Fcons (combined_data, Qnil))); 1765 Fcons (combined_data, Qnil)));
@@ -1739,7 +1769,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1739 if (EQ (handlers, Qerror)) 1769 if (EQ (handlers, Qerror))
1740 { 1770 {
1741 if (debugger_called) 1771 if (debugger_called)
1742 return unbind_to (count, Qlambda); 1772 return Qlambda;
1743 return Qt; 1773 return Qt;
1744 } 1774 }
1745 } 1775 }
@@ -3019,13 +3049,8 @@ grow_specpdl ()
3019 if (max_specpdl_size < 400) 3049 if (max_specpdl_size < 400)
3020 max_specpdl_size = 400; 3050 max_specpdl_size = 400;
3021 if (specpdl_size >= max_specpdl_size) 3051 if (specpdl_size >= max_specpdl_size)
3022 { 3052 Fsignal (Qerror,
3023 if (!NILP (Vdebug_on_error)) 3053 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
3024 /* Leave room for some specpdl in the debugger. */
3025 max_specpdl_size = specpdl_size + 100;
3026 Fsignal (Qerror,
3027 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
3028 }
3029 } 3054 }
3030 specpdl_size *= 2; 3055 specpdl_size *= 2;
3031 if (specpdl_size > max_specpdl_size) 3056 if (specpdl_size > max_specpdl_size)
@@ -3333,7 +3358,7 @@ syms_of_eval ()
3333{ 3358{
3334 DEFVAR_INT ("max-specpdl-size", &max_specpdl_size, 3359 DEFVAR_INT ("max-specpdl-size", &max_specpdl_size,
3335 doc: /* *Limit on number of Lisp variable bindings & unwind-protects. 3360 doc: /* *Limit on number of Lisp variable bindings & unwind-protects.
3336If Lisp code tries to make more than this many at once, 3361If Lisp code tries to increase the total number past this amount,
3337an error is signaled. 3362an error is signaled.
3338You can safely use a value considerably larger than the default value, 3363You can safely use a value considerably larger than the default value,
3339if that proves inconveniently small. However, if you increase it too far, 3364if that proves inconveniently small. However, if you increase it too far,
diff --git a/src/fileio.c b/src/fileio.c
index 075f12ccb21..ac81f73df16 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2408,7 +2408,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2408 return; 2408 return;
2409} 2409}
2410 2410
2411DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, 2411DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
2412 "fCopy file: \nGCopy %s to file: \np\nP", 2412 "fCopy file: \nGCopy %s to file: \np\nP",
2413 doc: /* Copy FILE to NEWNAME. Both args must be strings. 2413 doc: /* Copy FILE to NEWNAME. Both args must be strings.
2414If NEWNAME names a directory, copy FILE there. 2414If NEWNAME names a directory, copy FILE there.
@@ -2428,9 +2428,13 @@ for an existing file with the same name. If MUSTBENEW is `excl',
2428that means to get an error if the file already exists; never overwrite. 2428that means to get an error if the file already exists; never overwrite.
2429If MUSTBENEW is neither nil nor `excl', that means ask for 2429If MUSTBENEW is neither nil nor `excl', that means ask for
2430confirmation before overwriting, but do go ahead and overwrite the file 2430confirmation before overwriting, but do go ahead and overwrite the file
2431if the user confirms. */) 2431if the user confirms.
2432 (file, newname, ok_if_already_exists, keep_time, mustbenew) 2432
2433If PRESERVE-UID-GID is non-nil, we try to transfer the
2434uid and gid of FILE to NEWNAME. */)
2435 (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid)
2433 Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew; 2436 Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew;
2437 Lisp_Object preserve_uid_gid;
2434{ 2438{
2435 int ifd, ofd, n; 2439 int ifd, ofd, n;
2436 char buf[16 * 1024]; 2440 char buf[16 * 1024];
@@ -2572,6 +2576,26 @@ if the user confirms. */)
2572 report_file_error ("I/O error", Fcons (newname, Qnil)); 2576 report_file_error ("I/O error", Fcons (newname, Qnil));
2573 immediate_quit = 0; 2577 immediate_quit = 0;
2574 2578
2579 /* Preserve the owner and group, if requested. */
2580 if (input_file_statable_p && ! NILP (preserve_uid_gid))
2581 fchown (ofd, st.st_uid, st.st_gid);
2582
2583 if (input_file_statable_p)
2584 {
2585#ifndef MSDOS
2586 fchmod (ofd, st.st_mode & 07777);
2587#else /* MSDOS */
2588#if defined (__DJGPP__) && __DJGPP__ > 1
2589 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
2590 and if it can't, it tells so. Otherwise, under MSDOS we usually
2591 get only the READ bit, which will make the copied file read-only,
2592 so it's better not to chmod at all. */
2593 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
2594 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2595#endif /* DJGPP version 2 or newer */
2596#endif /* MSDOS */
2597 }
2598
2575 /* Closing the output clobbers the file times on some systems. */ 2599 /* Closing the output clobbers the file times on some systems. */
2576 if (emacs_close (ofd) < 0) 2600 if (emacs_close (ofd) < 0)
2577 report_file_error ("I/O error", Fcons (newname, Qnil)); 2601 report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2589,18 +2613,6 @@ if the user confirms. */)
2589 Fcons (build_string ("Cannot set file date"), 2613 Fcons (build_string ("Cannot set file date"),
2590 Fcons (newname, Qnil))); 2614 Fcons (newname, Qnil)));
2591 } 2615 }
2592#ifndef MSDOS
2593 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2594#else /* MSDOS */
2595#if defined (__DJGPP__) && __DJGPP__ > 1
2596 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
2597 and if it can't, it tells so. Otherwise, under MSDOS we usually
2598 get only the READ bit, which will make the copied file read-only,
2599 so it's better not to chmod at all. */
2600 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
2601 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2602#endif /* DJGPP version 2 or newer */
2603#endif /* MSDOS */
2604 } 2616 }
2605 2617
2606 emacs_close (ifd); 2618 emacs_close (ifd);
@@ -2777,7 +2789,6 @@ This is what happens in interactive use with M-x. */)
2777 { 2789 {
2778 if (errno == EXDEV) 2790 if (errno == EXDEV)
2779 { 2791 {
2780 struct stat data;
2781#ifdef S_IFLNK 2792#ifdef S_IFLNK
2782 symlink_target = Ffile_symlink_p (file); 2793 symlink_target = Ffile_symlink_p (file);
2783 if (! NILP (symlink_target)) 2794 if (! NILP (symlink_target))
@@ -2785,15 +2796,11 @@ This is what happens in interactive use with M-x. */)
2785 NILP (ok_if_already_exists) ? Qnil : Qt); 2796 NILP (ok_if_already_exists) ? Qnil : Qt);
2786 else 2797 else
2787#endif 2798#endif
2788 Fcopy_file (file, newname, 2799 Fcopy_file (file, newname,
2789 /* We have already prompted if it was an integer, 2800 /* We have already prompted if it was an integer,
2790 so don't have copy-file prompt again. */ 2801 so don't have copy-file prompt again. */
2791 NILP (ok_if_already_exists) ? Qnil : Qt, 2802 NILP (ok_if_already_exists) ? Qnil : Qt,
2792 Qt, Qnil); 2803 Qt, Qnil, Qt);
2793
2794 /* Preserve owner and group, if possible (if we are root). */
2795 if (stat (SDATA (encoded_file), &data) >= 0)
2796 chown (SDATA (encoded_file), data.st_uid, data.st_gid);
2797 2804
2798 Fdelete_file (file); 2805 Fdelete_file (file);
2799 } 2806 }
diff --git a/src/lread.c b/src/lread.c
index 773696ed946..f02252fe475 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2596,6 +2596,23 @@ read1 (readcharfun, pch, first_in_list)
2596 break; 2596 break;
2597 case 'N': 2597 case 'N':
2598 value = zero / zero; 2598 value = zero / zero;
2599
2600 /* If that made a "negative" NaN, negate it. */
2601
2602 {
2603 int i;
2604 union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
2605
2606 u_data.d = value;
2607 u_minus_zero.d = - 0.0;
2608 for (i = 0; i < sizeof (double); i++)
2609 if (u_data.c[i] & u_minus_zero.c[i])
2610 {
2611 value = - value;
2612 break;
2613 }
2614 }
2615 /* Now VALUE is a positive NaN. */
2599 break; 2616 break;
2600 default: 2617 default:
2601 value = atof (read_buffer + negative); 2618 value = atof (read_buffer + negative);
diff --git a/src/macfns.c b/src/macfns.c
index da1afa13bd8..d0e97e15f69 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4088,7 +4088,7 @@ Text larger than the specified size is clipped. */)
4088 clear_glyph_matrix (w->desired_matrix); 4088 clear_glyph_matrix (w->desired_matrix);
4089 clear_glyph_matrix (w->current_matrix); 4089 clear_glyph_matrix (w->current_matrix);
4090 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 4090 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
4091 try_window (FRAME_ROOT_WINDOW (f), pos); 4091 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
4092 4092
4093 /* Compute width and height of the tooltip. */ 4093 /* Compute width and height of the tooltip. */
4094 width = height = 0; 4094 width = height = 0;
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 998c1f7cf05..10e3bfe3a5a 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -311,6 +311,7 @@ Boston, MA 02111-1307, USA. */
311#define chdir sys_chdir 311#define chdir sys_chdir
312#undef chmod 312#undef chmod
313#define chmod sys_chmod 313#define chmod sys_chmod
314#define chown sys_chown
314#undef close 315#undef close
315#define close sys_close 316#define close sys_close
316#undef creat 317#undef creat
diff --git a/src/w32.c b/src/w32.c
index 1bb4a91ff03..1585b3eaf1e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1898,6 +1898,14 @@ sys_chmod (const char * path, int mode)
1898} 1898}
1899 1899
1900int 1900int
1901sys_chown (const char *path, uid_t owner, gid_t group)
1902{
1903 if (sys_chmod (path, _S_IREAD) == -1) /* check if file exists */
1904 return -1;
1905 return 0;
1906}
1907
1908int
1901sys_creat (const char * path, int mode) 1909sys_creat (const char * path, int mode)
1902{ 1910{
1903 return _creat (map_w32_filename (path, NULL), mode); 1911 return _creat (map_w32_filename (path, NULL), mode);
diff --git a/src/w32fns.c b/src/w32fns.c
index e9af1b8ce2f..36131f2d1d8 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7586,7 +7586,7 @@ Text larger than the specified size is clipped. */)
7586 clear_glyph_matrix (w->desired_matrix); 7586 clear_glyph_matrix (w->desired_matrix);
7587 clear_glyph_matrix (w->current_matrix); 7587 clear_glyph_matrix (w->current_matrix);
7588 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 7588 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
7589 try_window (FRAME_ROOT_WINDOW (f), pos); 7589 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
7590 7590
7591 /* Compute width and height of the tooltip. */ 7591 /* Compute width and height of the tooltip. */
7592 width = height = 0; 7592 width = height = 0;
diff --git a/src/xdisp.c b/src/xdisp.c
index e92c3e9b1ce..1fc5a8b277c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7594,7 +7594,7 @@ display_echo_area_1 (a1, a2, a3, a4)
7594 clear_glyph_matrix (w->desired_matrix); 7594 clear_glyph_matrix (w->desired_matrix);
7595 XSETWINDOW (window, w); 7595 XSETWINDOW (window, w);
7596 SET_TEXT_POS (start, BEG, BEG_BYTE); 7596 SET_TEXT_POS (start, BEG, BEG_BYTE);
7597 try_window (window, start); 7597 try_window (window, start, 0);
7598 7598
7599 return window_height_changed_p; 7599 return window_height_changed_p;
7600} 7600}
@@ -11573,7 +11573,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
11573 11573
11574 /* Display the window. Give up if new fonts are loaded, or if point 11574 /* Display the window. Give up if new fonts are loaded, or if point
11575 doesn't appear. */ 11575 doesn't appear. */
11576 if (!try_window (window, startp)) 11576 if (!try_window (window, startp, 0))
11577 rc = SCROLLING_NEED_LARGER_MATRICES; 11577 rc = SCROLLING_NEED_LARGER_MATRICES;
11578 else if (w->cursor.vpos < 0) 11578 else if (w->cursor.vpos < 0)
11579 { 11579 {
@@ -12178,6 +12178,7 @@ redisplay_window (window, just_this_one_p)
12178 { 12178 {
12179 /* We set this later on if we have to adjust point. */ 12179 /* We set this later on if we have to adjust point. */
12180 int new_vpos = -1; 12180 int new_vpos = -1;
12181 int val;
12181 12182
12182 w->force_start = Qnil; 12183 w->force_start = Qnil;
12183 w->vscroll = 0; 12184 w->vscroll = 0;
@@ -12211,12 +12212,16 @@ redisplay_window (window, just_this_one_p)
12211 12212
12212 /* Redisplay, then check if cursor has been set during the 12213 /* Redisplay, then check if cursor has been set during the
12213 redisplay. Give up if new fonts were loaded. */ 12214 redisplay. Give up if new fonts were loaded. */
12214 if (!try_window (window, startp)) 12215 val = try_window (window, startp, 1);
12216 if (!val)
12215 { 12217 {
12216 w->force_start = Qt; 12218 w->force_start = Qt;
12217 clear_glyph_matrix (w->desired_matrix); 12219 clear_glyph_matrix (w->desired_matrix);
12218 goto need_larger_matrices; 12220 goto need_larger_matrices;
12219 } 12221 }
12222 /* Point was outside the scroll margins. */
12223 if (val < 0)
12224 new_vpos = window_box_height (w) / 2;
12220 12225
12221 if (w->cursor.vpos < 0 && !w->frozen_window_start_p) 12226 if (w->cursor.vpos < 0 && !w->frozen_window_start_p)
12222 { 12227 {
@@ -12259,7 +12264,7 @@ redisplay_window (window, just_this_one_p)
12259 && !NILP (current_buffer->mark_active)) 12264 && !NILP (current_buffer->mark_active))
12260 { 12265 {
12261 clear_glyph_matrix (w->desired_matrix); 12266 clear_glyph_matrix (w->desired_matrix);
12262 if (!try_window (window, startp)) 12267 if (!try_window (window, startp, 0))
12263 goto need_larger_matrices; 12268 goto need_larger_matrices;
12264 } 12269 }
12265 } 12270 }
@@ -12349,7 +12354,11 @@ redisplay_window (window, just_this_one_p)
12349 = try_window_reusing_current_matrix (w))) 12354 = try_window_reusing_current_matrix (w)))
12350 { 12355 {
12351 IF_DEBUG (debug_method_add (w, "1")); 12356 IF_DEBUG (debug_method_add (w, "1"));
12352 try_window (window, startp); 12357 if (try_window (window, startp, 1) < 0)
12358 /* -1 means we need to scroll.
12359 0 means we need new matrices, but fonts_changed_p
12360 is set in that case, so we will detect it below. */
12361 goto try_to_scroll;
12353 } 12362 }
12354 12363
12355 if (fonts_changed_p) 12364 if (fonts_changed_p)
@@ -12479,7 +12488,7 @@ redisplay_window (window, just_this_one_p)
12479 || MINI_WINDOW_P (w) 12488 || MINI_WINDOW_P (w)
12480 || !(used_current_matrix_p 12489 || !(used_current_matrix_p
12481 = try_window_reusing_current_matrix (w))) 12490 = try_window_reusing_current_matrix (w)))
12482 try_window (window, startp); 12491 try_window (window, startp, 0);
12483 12492
12484 /* If new fonts have been loaded (due to fontsets), give up. We 12493 /* If new fonts have been loaded (due to fontsets), give up. We
12485 have to start a new redisplay since we need to re-adjust glyph 12494 have to start a new redisplay since we need to re-adjust glyph
@@ -12499,13 +12508,13 @@ redisplay_window (window, just_this_one_p)
12499 { 12508 {
12500 clear_glyph_matrix (w->desired_matrix); 12509 clear_glyph_matrix (w->desired_matrix);
12501 move_it_by_lines (&it, 1, 0); 12510 move_it_by_lines (&it, 1, 0);
12502 try_window (window, it.current.pos); 12511 try_window (window, it.current.pos, 0);
12503 } 12512 }
12504 else if (PT < IT_CHARPOS (it)) 12513 else if (PT < IT_CHARPOS (it))
12505 { 12514 {
12506 clear_glyph_matrix (w->desired_matrix); 12515 clear_glyph_matrix (w->desired_matrix);
12507 move_it_by_lines (&it, -1, 0); 12516 move_it_by_lines (&it, -1, 0);
12508 try_window (window, it.current.pos); 12517 try_window (window, it.current.pos, 0);
12509 } 12518 }
12510 else 12519 else
12511 { 12520 {
@@ -12691,14 +12700,18 @@ redisplay_window (window, just_this_one_p)
12691 12700
12692 12701
12693/* Build the complete desired matrix of WINDOW with a window start 12702/* Build the complete desired matrix of WINDOW with a window start
12694 buffer position POS. Value is non-zero if successful. It is zero 12703 buffer position POS.
12695 if fonts were loaded during redisplay which makes re-adjusting 12704
12696 glyph matrices necessary. */ 12705 Value is 1 if successful. It is zero if fonts were loaded during
12706 redisplay which makes re-adjusting glyph matrices necessary, and -1
12707 if point would appear in the scroll margins.
12708 (We check that only if CHECK_MARGINS is nonzero. */
12697 12709
12698int 12710int
12699try_window (window, pos) 12711try_window (window, pos, check_margins)
12700 Lisp_Object window; 12712 Lisp_Object window;
12701 struct text_pos pos; 12713 struct text_pos pos;
12714 int check_margins;
12702{ 12715{
12703 struct window *w = XWINDOW (window); 12716 struct window *w = XWINDOW (window);
12704 struct it it; 12717 struct it it;
@@ -12723,6 +12736,30 @@ try_window (window, pos)
12723 return 0; 12736 return 0;
12724 } 12737 }
12725 12738
12739 /* Don't let the cursor end in the scroll margins. */
12740 if (check_margins)
12741 {
12742 int this_scroll_margin, cursor_height;
12743
12744 this_scroll_margin = max (0, scroll_margin);
12745 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
12746 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
12747 cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
12748
12749 if ((w->cursor.y < this_scroll_margin
12750 && CHARPOS (pos) > BEGV)
12751 /* Old redisplay didn't take scroll margin into account at the bottom,
12752 but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
12753 || (w->cursor.y + (make_cursor_line_fully_visible_p
12754 ? cursor_height + this_scroll_margin
12755 : 1)) > it.last_visible_y)
12756 {
12757 w->cursor.vpos = -1;
12758 clear_glyph_matrix (w->desired_matrix);
12759 return -1;
12760 }
12761 }
12762
12726 /* If bottom moved off end of frame, change mode line percentage. */ 12763 /* If bottom moved off end of frame, change mode line percentage. */
12727 if (XFASTINT (w->window_end_pos) <= 0 12764 if (XFASTINT (w->window_end_pos) <= 0
12728 && Z != IT_CHARPOS (it)) 12765 && Z != IT_CHARPOS (it))
@@ -21667,7 +21704,7 @@ note_mouse_highlight (f, x, y)
21667 /* If we were displaying active text in another window, clear that. 21704 /* If we were displaying active text in another window, clear that.
21668 Also clear if we move out of text area in same window. */ 21705 Also clear if we move out of text area in same window. */
21669 if (! EQ (window, dpyinfo->mouse_face_window) 21706 if (! EQ (window, dpyinfo->mouse_face_window)
21670 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE 21707 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
21671 && !NILP (dpyinfo->mouse_face_window))) 21708 && !NILP (dpyinfo->mouse_face_window)))
21672 clear_mouse_face (dpyinfo); 21709 clear_mouse_face (dpyinfo);
21673 21710
@@ -22894,17 +22931,17 @@ The face used for trailing whitespace is `trailing-whitespace'. */);
22894 22931
22895 DEFVAR_LISP ("nobreak-char-display", &Vnobreak_char_display, 22932 DEFVAR_LISP ("nobreak-char-display", &Vnobreak_char_display,
22896 doc: /* *Control highlighting of nobreak space and soft hyphen. 22933 doc: /* *Control highlighting of nobreak space and soft hyphen.
22897t means highlight the character itself (for nobreak space, 22934A value of t means highlight the character itself (for nobreak space,
22898use face `nobreak-space'. 22935use face `nobreak-space').
22899nil means no highlighting. 22936A value of nil means no highlighting.
22900other values mean display the escape glyph followed by an ordinary 22937Other values mean display the escape glyph followed by an ordinary
22901space or ordinary hyphen. */); 22938space or ordinary hyphen. */);
22902 Vnobreak_char_display = Qt; 22939 Vnobreak_char_display = Qt;
22903 22940
22904 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, 22941 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
22905 doc: /* *The pointer shape to show in void text areas. 22942 doc: /* *The pointer shape to show in void text areas.
22906Nil means to show the text pointer. Other options are `arrow', `text', 22943A value of nil means to show the text pointer. Other options are `arrow',
22907`hand', `vdrag', `hdrag', `modeline', and `hourglass'. */); 22944`text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'. */);
22908 Vvoid_text_area_pointer = Qarrow; 22945 Vvoid_text_area_pointer = Qarrow;
22909 22946
22910 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay, 22947 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay,
diff --git a/src/xfns.c b/src/xfns.c
index 44e1dbae0c2..2910d0f3cd4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5101,7 +5101,7 @@ Text larger than the specified size is clipped. */)
5101 clear_glyph_matrix (w->desired_matrix); 5101 clear_glyph_matrix (w->desired_matrix);
5102 clear_glyph_matrix (w->current_matrix); 5102 clear_glyph_matrix (w->current_matrix);
5103 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5103 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
5104 try_window (FRAME_ROOT_WINDOW (f), pos); 5104 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
5105 5105
5106 /* Compute width and height of the tooltip. */ 5106 /* Compute width and height of the tooltip. */
5107 width = height = 0; 5107 width = height = 0;