aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2005-06-30 00:31:46 +0000
committerMiles Bader2005-06-30 00:31:46 +0000
commiteeb88b27e1dbd3f412aa684d44e4a784f6e536a2 (patch)
tree23ea1eda87f588e060b6c00e9c7ffac6a89a7e42 /src
parent16e1457021e3f6e3b83fc9b5262fde38b7140c96 (diff)
parent84861437f914ac45c1eea7b6477ffc4783bb3bdd (diff)
downloademacs-eeb88b27e1dbd3f412aa684d44e4a784f6e536a2.tar.gz
emacs-eeb88b27e1dbd3f412aa684d44e4a784f6e536a2.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-67
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 447-458) - Update from CVS - Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 83-85) - Merge from emacs--cvs-trunk--0 - Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog76
-rw-r--r--src/dispextern.h2
-rw-r--r--src/eval.c143
-rw-r--r--src/fileio.c57
-rw-r--r--src/lread.c17
-rw-r--r--src/macfns.c2
-rw-r--r--src/macterm.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
12 files changed, 291 insertions, 96 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 94cfec41a62..2d312756daf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,11 +1,80 @@
12005-06-29 Juanma Barranquero <lekktu@gmail.com>
2
3 * eval.c (user_variable_p_eh): New function.
4 (Fuser_variable_p): Use it. Clarify docstring.
5 Return t for aliases of user options, nil for alias loops.
6
72005-06-27 Richard M. Stallman <rms@gnu.org>
8
9 * eval.c (Fdefvar): Improve error message.
10
112005-06-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
12
13 * macterm.c [USE_CARBON_EVENTS] (mac_convert_event_ref): Fix last
14 change.
15
162005-06-27 Juanma Barranquero <lekktu@gmail.com>
17
18 * eval.c (Fdefvar): Don't try to set constant symbols.
19
202005-06-25 Richard M. Stallman <rms@gnu.org>
21
22 * macfns.c (Fx_show_tip): Pass new arg to try_window.
23
24 * w32fns.c (Fx_show_tip): Pass new arg to try_window.
25
26 * xfns.c (Fx_show_tip): Pass new arg to try_window.
27
28 * xdisp.c (try_window): New arg CHECK_MARGINS. Calls changed.
29 (redisplay_window): Handle try_window reporting point in scroll margin.
30
31 * dispextern.h (try_window): Declare new arg.
32
33 * fileio.c (Fcopy_file): New arg PRESERVE_UID_GID.
34 Use fchmod to copy the file modes.
35 (Frename_file): Don't copy UID and GID here;
36 instead, specify t for PRESERVE_UID_GID when calling Fcopy_file.
37
38 * eval.c (call_debugger): Take full care of extending stack limits
39 to make space for the debugger, and restore the change afterward.
40 Bind debug-on-error to nil.
41 (restore_stack_limits): New subroutine.
42 (Fsignal): Extend specpdl bound along with eval depth bound,
43 for calling edebug. Don't do either one, for calling debugger.
44 (find_handler_clause): Don't bind debug-on-error here.
45 Don't unbind anything either.
46 Temporarily advance max_specpdl_size for calling
47 internal_with_output_to_temp_buffer.
48 (grow_specpdl): Don't alter max_specpdl_size before signaling
49 an error.
50 (syms_of_eval) <max-specpdl-size>: Doc fix.
51
52 * lread.c (read1): 0.0e+NaN should make a "positive" NaN.
53
542005-06-24 Eli Zaretskii <eliz@gnu.org>
55
56 * fileio.c (Frename_file): Undo last change: no need to ifdef away
57 chown on DOS_NT platforms.
58
59 * w32.c (sys_chown): New function.
60
61 * s/ms-w32.h (chown): New; define to sys_chown.
62
632005-06-24 Juanma Barranquero <lekktu@gmail.com>
64
65 * xdisp.c (syms_of_xdisp) <nobreak-char-display>: Doc fix.
66 (syms_of_xdisp) <void-text-area-pointer>: Doc fix.
67
68 * fileio.c (Frename_file)[!DOS_NT]: Don't call chown on MSDOS/Windows.
69
12005-06-23 Richard M. Stallman <rms@gnu.org> 702005-06-23 Richard M. Stallman <rms@gnu.org>
2 71
3 * xdisp.c (get_next_display_element): Finish reversing the tests of 72 * xdisp.c (get_next_display_element): Finish reversing the tests of
4 Vnobreak_char_display. 73 Vnobreak_char_display.
5 74
6 * xdisp.c (Vnobreak_char_display): Renamed from Vshow_nonbreak_escape. 75 * xdisp.c (Vnobreak_char_display): Rename from Vshow_nonbreak_escape.
7 All uses changed. 76 All uses changed.
8 (Qnobreak_space): Renamed from Qno_break_space. All uses changed. 77 (Qnobreak_space): Rename from Qno_break_space. All uses changed.
9 (syms_of_xdisp): Define nobreak-char-display and nobreak-space. 78 (syms_of_xdisp): Define nobreak-char-display and nobreak-space.
10 79
11 * fileio.c (Frename_file): Preserve owner and group, if possible, 80 * fileio.c (Frename_file): Preserve owner and group, if possible,
@@ -301,8 +370,7 @@
301 370
3022005-06-06 Eli Zaretskii <eliz@gnu.org> 3712005-06-06 Eli Zaretskii <eliz@gnu.org>
303 372
304 * w32heap.h (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_PTR): 373 * w32heap.h (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_PTR): Remove macros.
305 Remove macros.
306 374
307 * unexw32.c (RVA_TO_PTR): Move here from w32heap.h. 375 * unexw32.c (RVA_TO_PTR): Move here from w32heap.h.
308 376
diff --git a/src/dispextern.h b/src/dispextern.h
index cd8488830f0..c049b17ce56 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2589,7 +2589,7 @@ int line_bottom_y P_ ((struct it *));
2589int display_prop_intangible_p P_ ((Lisp_Object)); 2589int display_prop_intangible_p P_ ((Lisp_Object));
2590void resize_echo_area_exactly P_ ((void)); 2590void resize_echo_area_exactly P_ ((void));
2591int resize_mini_window P_ ((struct window *, int)); 2591int resize_mini_window P_ ((struct window *, int));
2592int try_window P_ ((Lisp_Object, struct text_pos)); 2592int try_window P_ ((Lisp_Object, struct text_pos, int));
2593void window_box P_ ((struct window *, int, int *, int *, int *, int *)); 2593void window_box P_ ((struct window *, int, int *, int *, int *, int *));
2594int window_box_height P_ ((struct window *)); 2594int window_box_height P_ ((struct window *));
2595int window_text_bottom_y P_ ((struct window *)); 2595int window_text_bottom_y P_ ((struct window *));
diff --git a/src/eval.c b/src/eval.c
index 8ad289fd51f..17e9f7f4360 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;
250
251 /* Temporarily bump up the stack limits,
252 so the debugger won't run out of stack. */
253
254 max_specpdl_size += 1;
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;
237 259
238 if (lisp_eval_depth + 20 > max_lisp_eval_depth) 260 if (lisp_eval_depth + 40 > max_lisp_eval_depth)
239 max_lisp_eval_depth = lisp_eval_depth + 20; 261 max_lisp_eval_depth = lisp_eval_depth + 40;
240 262
241 if (specpdl_size + 40 > max_specpdl_size) 263 if (SPECPDL_INDEX () + 100 > max_specpdl_size)
242 max_specpdl_size = specpdl_size + 40; 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. */
@@ -783,6 +806,10 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
783 register Lisp_Object sym, tem, tail; 806 register Lisp_Object sym, tem, tail;
784 807
785 sym = Fcar (args); 808 sym = Fcar (args);
809 if (SYMBOL_CONSTANT_P (sym))
810 error ("Constant symbol `%s' specified in defvar",
811 SDATA (SYMBOL_NAME (sym)));
812
786 tail = Fcdr (args); 813 tail = Fcdr (args);
787 if (!NILP (Fcdr (Fcdr (tail)))) 814 if (!NILP (Fcdr (Fcdr (tail))))
788 error ("Too many arguments"); 815 error ("Too many arguments");
@@ -862,12 +889,24 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
862 return sym; 889 return sym;
863} 890}
864 891
892/* Error handler used in Fuser_variable_p. */
893static Lisp_Object
894user_variable_p_eh (ignore)
895 Lisp_Object ignore;
896{
897 return Qnil;
898}
899
865DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0, 900DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
866 doc: /* Returns t if VARIABLE is intended to be set and modified by users. 901 doc: /* Return t if VARIABLE is intended to be set and modified by users.
867\(The alternative is a variable used internally in a Lisp program.) 902\(The alternative is a variable used internally in a Lisp program.)
868Determined by whether the first character of the documentation 903A variable is a user variable if
869for the variable is `*' or if the variable is customizable (has a non-nil 904\(1) the first character of its documentation is `*', or
870value of `standard-value' or of `custom-autoload' on its property list). */) 905\(2) it is customizable (its property list contains a non-nil value
906 of `standard-value' or `custom-autoload'), or
907\(3) it is an alias for another user variable.
908Return nil if VARIABLE is an alias and there is a loop in the
909chain of symbols. */)
871 (variable) 910 (variable)
872 Lisp_Object variable; 911 Lisp_Object variable;
873{ 912{
@@ -876,23 +915,37 @@ value of `standard-value' or of `custom-autoload' on its property list). */)
876 if (!SYMBOLP (variable)) 915 if (!SYMBOLP (variable))
877 return Qnil; 916 return Qnil;
878 917
879 documentation = Fget (variable, Qvariable_documentation); 918 /* If indirect and there's an alias loop, don't check anything else. */
880 if (INTEGERP (documentation) && XINT (documentation) < 0) 919 if (XSYMBOL (variable)->indirect_variable
881 return Qt; 920 && NILP (internal_condition_case_1 (indirect_variable, variable,
882 if (STRINGP (documentation) 921 Qt, user_variable_p_eh)))
883 && ((unsigned char) SREF (documentation, 0) == '*')) 922 return Qnil;
884 return Qt; 923
885 /* If it is (STRING . INTEGER), a negative integer means a user variable. */ 924 while (1)
886 if (CONSP (documentation) 925 {
887 && STRINGP (XCAR (documentation)) 926 documentation = Fget (variable, Qvariable_documentation);
888 && INTEGERP (XCDR (documentation)) 927 if (INTEGERP (documentation) && XINT (documentation) < 0)
889 && XINT (XCDR (documentation)) < 0) 928 return Qt;
890 return Qt; 929 if (STRINGP (documentation)
891 /* Customizable? See `custom-variable-p'. */ 930 && ((unsigned char) SREF (documentation, 0) == '*'))
892 if ((!NILP (Fget (variable, intern ("standard-value")))) 931 return Qt;
893 || (!NILP (Fget (variable, intern ("custom-autoload"))))) 932 /* If it is (STRING . INTEGER), a negative integer means a user variable. */
894 return Qt; 933 if (CONSP (documentation)
895 return Qnil; 934 && STRINGP (XCAR (documentation))
935 && INTEGERP (XCDR (documentation))
936 && XINT (XCDR (documentation)) < 0)
937 return Qt;
938 /* Customizable? See `custom-variable-p'. */
939 if ((!NILP (Fget (variable, intern ("standard-value"))))
940 || (!NILP (Fget (variable, intern ("custom-autoload")))))
941 return Qt;
942
943 if (!XSYMBOL (variable)->indirect_variable)
944 return Qnil;
945
946 /* An indirect variable? Let's follow the chain. */
947 variable = XSYMBOL (variable)->value;
948 }
896} 949}
897 950
898DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 951DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
@@ -1533,7 +1586,16 @@ See also the function `condition-case'. */)
1533 /* This hook is used by edebug. */ 1586 /* This hook is used by edebug. */
1534 if (! NILP (Vsignal_hook_function) 1587 if (! NILP (Vsignal_hook_function)
1535 && ! NILP (error_symbol)) 1588 && ! NILP (error_symbol))
1536 call2 (Vsignal_hook_function, error_symbol, data); 1589 {
1590 /* Edebug takes care of restoring these variables when it exits. */
1591 if (lisp_eval_depth + 20 > max_lisp_eval_depth)
1592 max_lisp_eval_depth = lisp_eval_depth + 20;
1593
1594 if (SPECPDL_INDEX () + 40 > max_specpdl_size)
1595 max_specpdl_size = SPECPDL_INDEX () + 40;
1596
1597 call2 (Vsignal_hook_function, error_symbol, data);
1598 }
1537 1599
1538 conditions = Fget (real_error_symbol, Qerror_conditions); 1600 conditions = Fget (real_error_symbol, Qerror_conditions);
1539 1601
@@ -1555,12 +1617,6 @@ See also the function `condition-case'. */)
1555 { 1617 {
1556 register Lisp_Object clause; 1618 register Lisp_Object clause;
1557 1619
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, 1620 clause = find_handler_clause (handlerlist->handler, conditions,
1565 error_symbol, data, &debugger_value); 1621 error_symbol, data, &debugger_value);
1566 1622
@@ -1673,7 +1729,11 @@ skip_debugger (conditions, data)
1673 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). 1729 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
1674 This is for memory-full errors only. 1730 This is for memory-full errors only.
1675 1731
1676 Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ 1732 Store value returned from debugger into *DEBUGGER_VALUE_PTR.
1733
1734 We need to increase max_specpdl_size temporarily around
1735 anything we do that can push on the specpdl, so as not to get
1736 a second error here in case we're handling specpdl overflow. */
1677 1737
1678static Lisp_Object 1738static Lisp_Object
1679find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) 1739find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
@@ -1691,7 +1751,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1691 || !NILP (Vdebug_on_signal)) /* This says call debugger even if 1751 || !NILP (Vdebug_on_signal)) /* This says call debugger even if
1692 there is a handler. */ 1752 there is a handler. */
1693 { 1753 {
1694 int count = SPECPDL_INDEX ();
1695 int debugger_called = 0; 1754 int debugger_called = 0;
1696 Lisp_Object sig_symbol, combined_data; 1755 Lisp_Object sig_symbol, combined_data;
1697 /* This is set to 1 if we are handling a memory-full error, 1756 /* This is set to 1 if we are handling a memory-full error,
@@ -1713,6 +1772,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1713 1772
1714 if (wants_debugger (Vstack_trace_on_error, conditions)) 1773 if (wants_debugger (Vstack_trace_on_error, conditions))
1715 { 1774 {
1775 max_specpdl_size++;
1716#ifdef PROTOTYPES 1776#ifdef PROTOTYPES
1717 internal_with_output_to_temp_buffer ("*Backtrace*", 1777 internal_with_output_to_temp_buffer ("*Backtrace*",
1718 (Lisp_Object (*) (Lisp_Object)) Fbacktrace, 1778 (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
@@ -1721,6 +1781,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1721 internal_with_output_to_temp_buffer ("*Backtrace*", 1781 internal_with_output_to_temp_buffer ("*Backtrace*",
1722 Fbacktrace, Qnil); 1782 Fbacktrace, Qnil);
1723#endif 1783#endif
1784 max_specpdl_size--;
1724 } 1785 }
1725 if (! no_debugger 1786 if (! no_debugger
1726 && (EQ (sig_symbol, Qquit) 1787 && (EQ (sig_symbol, Qquit)
@@ -1729,7 +1790,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1729 && ! skip_debugger (conditions, combined_data) 1790 && ! skip_debugger (conditions, combined_data)
1730 && when_entered_debugger < num_nonmacro_input_events) 1791 && when_entered_debugger < num_nonmacro_input_events)
1731 { 1792 {
1732 specbind (Qdebug_on_error, Qnil);
1733 *debugger_value_ptr 1793 *debugger_value_ptr
1734 = call_debugger (Fcons (Qerror, 1794 = call_debugger (Fcons (Qerror,
1735 Fcons (combined_data, Qnil))); 1795 Fcons (combined_data, Qnil)));
@@ -1739,7 +1799,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1739 if (EQ (handlers, Qerror)) 1799 if (EQ (handlers, Qerror))
1740 { 1800 {
1741 if (debugger_called) 1801 if (debugger_called)
1742 return unbind_to (count, Qlambda); 1802 return Qlambda;
1743 return Qt; 1803 return Qt;
1744 } 1804 }
1745 } 1805 }
@@ -3019,13 +3079,8 @@ grow_specpdl ()
3019 if (max_specpdl_size < 400) 3079 if (max_specpdl_size < 400)
3020 max_specpdl_size = 400; 3080 max_specpdl_size = 400;
3021 if (specpdl_size >= max_specpdl_size) 3081 if (specpdl_size >= max_specpdl_size)
3022 { 3082 Fsignal (Qerror,
3023 if (!NILP (Vdebug_on_error)) 3083 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 } 3084 }
3030 specpdl_size *= 2; 3085 specpdl_size *= 2;
3031 if (specpdl_size > max_specpdl_size) 3086 if (specpdl_size > max_specpdl_size)
@@ -3333,7 +3388,7 @@ syms_of_eval ()
3333{ 3388{
3334 DEFVAR_INT ("max-specpdl-size", &max_specpdl_size, 3389 DEFVAR_INT ("max-specpdl-size", &max_specpdl_size,
3335 doc: /* *Limit on number of Lisp variable bindings & unwind-protects. 3390 doc: /* *Limit on number of Lisp variable bindings & unwind-protects.
3336If Lisp code tries to make more than this many at once, 3391If Lisp code tries to increase the total number past this amount,
3337an error is signaled. 3392an error is signaled.
3338You can safely use a value considerably larger than the default value, 3393You can safely use a value considerably larger than the default value,
3339if that proves inconveniently small. However, if you increase it too far, 3394if that proves inconveniently small. However, if you increase it too far,
diff --git a/src/fileio.c b/src/fileio.c
index 3dab52c47f0..112c879c1c5 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2411,7 +2411,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2411 return; 2411 return;
2412} 2412}
2413 2413
2414DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, 2414DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
2415 "fCopy file: \nGCopy %s to file: \np\nP", 2415 "fCopy file: \nGCopy %s to file: \np\nP",
2416 doc: /* Copy FILE to NEWNAME. Both args must be strings. 2416 doc: /* Copy FILE to NEWNAME. Both args must be strings.
2417If NEWNAME names a directory, copy FILE there. 2417If NEWNAME names a directory, copy FILE there.
@@ -2431,9 +2431,13 @@ for an existing file with the same name. If MUSTBENEW is `excl',
2431that means to get an error if the file already exists; never overwrite. 2431that means to get an error if the file already exists; never overwrite.
2432If MUSTBENEW is neither nil nor `excl', that means ask for 2432If MUSTBENEW is neither nil nor `excl', that means ask for
2433confirmation before overwriting, but do go ahead and overwrite the file 2433confirmation before overwriting, but do go ahead and overwrite the file
2434if the user confirms. */) 2434if the user confirms.
2435 (file, newname, ok_if_already_exists, keep_time, mustbenew) 2435
2436If PRESERVE-UID-GID is non-nil, we try to transfer the
2437uid and gid of FILE to NEWNAME. */)
2438 (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid)
2436 Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew; 2439 Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew;
2440 Lisp_Object preserve_uid_gid;
2437{ 2441{
2438 int ifd, ofd, n; 2442 int ifd, ofd, n;
2439 char buf[16 * 1024]; 2443 char buf[16 * 1024];
@@ -2575,6 +2579,26 @@ if the user confirms. */)
2575 report_file_error ("I/O error", Fcons (newname, Qnil)); 2579 report_file_error ("I/O error", Fcons (newname, Qnil));
2576 immediate_quit = 0; 2580 immediate_quit = 0;
2577 2581
2582 /* Preserve the owner and group, if requested. */
2583 if (input_file_statable_p && ! NILP (preserve_uid_gid))
2584 fchown (ofd, st.st_uid, st.st_gid);
2585
2586 if (input_file_statable_p)
2587 {
2588#ifndef MSDOS
2589 fchmod (ofd, st.st_mode & 07777);
2590#else /* MSDOS */
2591#if defined (__DJGPP__) && __DJGPP__ > 1
2592 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
2593 and if it can't, it tells so. Otherwise, under MSDOS we usually
2594 get only the READ bit, which will make the copied file read-only,
2595 so it's better not to chmod at all. */
2596 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
2597 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2598#endif /* DJGPP version 2 or newer */
2599#endif /* MSDOS */
2600 }
2601
2578 /* Closing the output clobbers the file times on some systems. */ 2602 /* Closing the output clobbers the file times on some systems. */
2579 if (emacs_close (ofd) < 0) 2603 if (emacs_close (ofd) < 0)
2580 report_file_error ("I/O error", Fcons (newname, Qnil)); 2604 report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2592,18 +2616,6 @@ if the user confirms. */)
2592 Fcons (build_string ("Cannot set file date"), 2616 Fcons (build_string ("Cannot set file date"),
2593 Fcons (newname, Qnil))); 2617 Fcons (newname, Qnil)));
2594 } 2618 }
2595#ifndef MSDOS
2596 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2597#else /* MSDOS */
2598#if defined (__DJGPP__) && __DJGPP__ > 1
2599 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
2600 and if it can't, it tells so. Otherwise, under MSDOS we usually
2601 get only the READ bit, which will make the copied file read-only,
2602 so it's better not to chmod at all. */
2603 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
2604 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2605#endif /* DJGPP version 2 or newer */
2606#endif /* MSDOS */
2607 } 2619 }
2608 2620
2609 emacs_close (ifd); 2621 emacs_close (ifd);
@@ -2780,7 +2792,6 @@ This is what happens in interactive use with M-x. */)
2780 { 2792 {
2781 if (errno == EXDEV) 2793 if (errno == EXDEV)
2782 { 2794 {
2783 struct stat data;
2784#ifdef S_IFLNK 2795#ifdef S_IFLNK
2785 symlink_target = Ffile_symlink_p (file); 2796 symlink_target = Ffile_symlink_p (file);
2786 if (! NILP (symlink_target)) 2797 if (! NILP (symlink_target))
@@ -2788,15 +2799,11 @@ This is what happens in interactive use with M-x. */)
2788 NILP (ok_if_already_exists) ? Qnil : Qt); 2799 NILP (ok_if_already_exists) ? Qnil : Qt);
2789 else 2800 else
2790#endif 2801#endif
2791 Fcopy_file (file, newname, 2802 Fcopy_file (file, newname,
2792 /* We have already prompted if it was an integer, 2803 /* We have already prompted if it was an integer,
2793 so don't have copy-file prompt again. */ 2804 so don't have copy-file prompt again. */
2794 NILP (ok_if_already_exists) ? Qnil : Qt, 2805 NILP (ok_if_already_exists) ? Qnil : Qt,
2795 Qt, Qnil); 2806 Qt, Qnil, Qt);
2796
2797 /* Preserve owner and group, if possible (if we are root). */
2798 if (stat (SDATA (encoded_file), &data) >= 0)
2799 chown (SDATA (encoded_file), data.st_uid, data.st_gid);
2800 2807
2801 Fdelete_file (file); 2808 Fdelete_file (file);
2802 } 2809 }
diff --git a/src/lread.c b/src/lread.c
index d180836ada3..389bc04ddaa 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2715,6 +2715,23 @@ read1 (readcharfun, pch, first_in_list)
2715 break; 2715 break;
2716 case 'N': 2716 case 'N':
2717 value = zero / zero; 2717 value = zero / zero;
2718
2719 /* If that made a "negative" NaN, negate it. */
2720
2721 {
2722 int i;
2723 union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
2724
2725 u_data.d = value;
2726 u_minus_zero.d = - 0.0;
2727 for (i = 0; i < sizeof (double); i++)
2728 if (u_data.c[i] & u_minus_zero.c[i])
2729 {
2730 value = - value;
2731 break;
2732 }
2733 }
2734 /* Now VALUE is a positive NaN. */
2718 break; 2735 break;
2719 default: 2736 default:
2720 value = atof (read_buffer + negative); 2737 value = atof (read_buffer + negative);
diff --git a/src/macfns.c b/src/macfns.c
index 346ee1e2bde..f6ce7c42a67 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/macterm.c b/src/macterm.c
index cef213024fa..16d8452c87c 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -7666,6 +7666,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
7666 default: 7666 default:
7667 break; 7667 break;
7668 } 7668 }
7669 break;
7669 7670
7670 case kEventClassKeyboard: 7671 case kEventClassKeyboard:
7671 switch (GetEventKind (eventRef)) 7672 switch (GetEventKind (eventRef))
@@ -7688,6 +7689,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
7688 default: 7689 default:
7689 break; 7690 break;
7690 } 7691 }
7692 break;
7691 7693
7692 default: 7694 default:
7693 break; 7695 break;
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 3913349d8bd..5d92cb03d00 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7648,7 +7648,7 @@ Text larger than the specified size is clipped. */)
7648 clear_glyph_matrix (w->desired_matrix); 7648 clear_glyph_matrix (w->desired_matrix);
7649 clear_glyph_matrix (w->current_matrix); 7649 clear_glyph_matrix (w->current_matrix);
7650 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 7650 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
7651 try_window (FRAME_ROOT_WINDOW (f), pos); 7651 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
7652 7652
7653 /* Compute width and height of the tooltip. */ 7653 /* Compute width and height of the tooltip. */
7654 width = height = 0; 7654 width = height = 0;
diff --git a/src/xdisp.c b/src/xdisp.c
index b5f69a93810..0a2a02b4628 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7697,7 +7697,7 @@ display_echo_area_1 (a1, a2, a3, a4)
7697 clear_glyph_matrix (w->desired_matrix); 7697 clear_glyph_matrix (w->desired_matrix);
7698 XSETWINDOW (window, w); 7698 XSETWINDOW (window, w);
7699 SET_TEXT_POS (start, BEG, BEG_BYTE); 7699 SET_TEXT_POS (start, BEG, BEG_BYTE);
7700 try_window (window, start); 7700 try_window (window, start, 0);
7701 7701
7702 return window_height_changed_p; 7702 return window_height_changed_p;
7703} 7703}
@@ -11665,7 +11665,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
11665 11665
11666 /* Display the window. Give up if new fonts are loaded, or if point 11666 /* Display the window. Give up if new fonts are loaded, or if point
11667 doesn't appear. */ 11667 doesn't appear. */
11668 if (!try_window (window, startp)) 11668 if (!try_window (window, startp, 0))
11669 rc = SCROLLING_NEED_LARGER_MATRICES; 11669 rc = SCROLLING_NEED_LARGER_MATRICES;
11670 else if (w->cursor.vpos < 0) 11670 else if (w->cursor.vpos < 0)
11671 { 11671 {
@@ -12268,6 +12268,7 @@ redisplay_window (window, just_this_one_p)
12268 { 12268 {
12269 /* We set this later on if we have to adjust point. */ 12269 /* We set this later on if we have to adjust point. */
12270 int new_vpos = -1; 12270 int new_vpos = -1;
12271 int val;
12271 12272
12272 w->force_start = Qnil; 12273 w->force_start = Qnil;
12273 w->vscroll = 0; 12274 w->vscroll = 0;
@@ -12301,12 +12302,16 @@ redisplay_window (window, just_this_one_p)
12301 12302
12302 /* Redisplay, then check if cursor has been set during the 12303 /* Redisplay, then check if cursor has been set during the
12303 redisplay. Give up if new fonts were loaded. */ 12304 redisplay. Give up if new fonts were loaded. */
12304 if (!try_window (window, startp)) 12305 val = try_window (window, startp, 1);
12306 if (!val)
12305 { 12307 {
12306 w->force_start = Qt; 12308 w->force_start = Qt;
12307 clear_glyph_matrix (w->desired_matrix); 12309 clear_glyph_matrix (w->desired_matrix);
12308 goto need_larger_matrices; 12310 goto need_larger_matrices;
12309 } 12311 }
12312 /* Point was outside the scroll margins. */
12313 if (val < 0)
12314 new_vpos = window_box_height (w) / 2;
12310 12315
12311 if (w->cursor.vpos < 0 && !w->frozen_window_start_p) 12316 if (w->cursor.vpos < 0 && !w->frozen_window_start_p)
12312 { 12317 {
@@ -12349,7 +12354,7 @@ redisplay_window (window, just_this_one_p)
12349 && !NILP (current_buffer->mark_active)) 12354 && !NILP (current_buffer->mark_active))
12350 { 12355 {
12351 clear_glyph_matrix (w->desired_matrix); 12356 clear_glyph_matrix (w->desired_matrix);
12352 if (!try_window (window, startp)) 12357 if (!try_window (window, startp, 0))
12353 goto need_larger_matrices; 12358 goto need_larger_matrices;
12354 } 12359 }
12355 } 12360 }
@@ -12439,7 +12444,11 @@ redisplay_window (window, just_this_one_p)
12439 = try_window_reusing_current_matrix (w))) 12444 = try_window_reusing_current_matrix (w)))
12440 { 12445 {
12441 IF_DEBUG (debug_method_add (w, "1")); 12446 IF_DEBUG (debug_method_add (w, "1"));
12442 try_window (window, startp); 12447 if (try_window (window, startp, 1) < 0)
12448 /* -1 means we need to scroll.
12449 0 means we need new matrices, but fonts_changed_p
12450 is set in that case, so we will detect it below. */
12451 goto try_to_scroll;
12443 } 12452 }
12444 12453
12445 if (fonts_changed_p) 12454 if (fonts_changed_p)
@@ -12569,7 +12578,7 @@ redisplay_window (window, just_this_one_p)
12569 || MINI_WINDOW_P (w) 12578 || MINI_WINDOW_P (w)
12570 || !(used_current_matrix_p 12579 || !(used_current_matrix_p
12571 = try_window_reusing_current_matrix (w))) 12580 = try_window_reusing_current_matrix (w)))
12572 try_window (window, startp); 12581 try_window (window, startp, 0);
12573 12582
12574 /* If new fonts have been loaded (due to fontsets), give up. We 12583 /* If new fonts have been loaded (due to fontsets), give up. We
12575 have to start a new redisplay since we need to re-adjust glyph 12584 have to start a new redisplay since we need to re-adjust glyph
@@ -12589,13 +12598,13 @@ redisplay_window (window, just_this_one_p)
12589 { 12598 {
12590 clear_glyph_matrix (w->desired_matrix); 12599 clear_glyph_matrix (w->desired_matrix);
12591 move_it_by_lines (&it, 1, 0); 12600 move_it_by_lines (&it, 1, 0);
12592 try_window (window, it.current.pos); 12601 try_window (window, it.current.pos, 0);
12593 } 12602 }
12594 else if (PT < IT_CHARPOS (it)) 12603 else if (PT < IT_CHARPOS (it))
12595 { 12604 {
12596 clear_glyph_matrix (w->desired_matrix); 12605 clear_glyph_matrix (w->desired_matrix);
12597 move_it_by_lines (&it, -1, 0); 12606 move_it_by_lines (&it, -1, 0);
12598 try_window (window, it.current.pos); 12607 try_window (window, it.current.pos, 0);
12599 } 12608 }
12600 else 12609 else
12601 { 12610 {
@@ -12778,14 +12787,18 @@ redisplay_window (window, just_this_one_p)
12778 12787
12779 12788
12780/* Build the complete desired matrix of WINDOW with a window start 12789/* Build the complete desired matrix of WINDOW with a window start
12781 buffer position POS. Value is non-zero if successful. It is zero 12790 buffer position POS.
12782 if fonts were loaded during redisplay which makes re-adjusting 12791
12783 glyph matrices necessary. */ 12792 Value is 1 if successful. It is zero if fonts were loaded during
12793 redisplay which makes re-adjusting glyph matrices necessary, and -1
12794 if point would appear in the scroll margins.
12795 (We check that only if CHECK_MARGINS is nonzero. */
12784 12796
12785int 12797int
12786try_window (window, pos) 12798try_window (window, pos, check_margins)
12787 Lisp_Object window; 12799 Lisp_Object window;
12788 struct text_pos pos; 12800 struct text_pos pos;
12801 int check_margins;
12789{ 12802{
12790 struct window *w = XWINDOW (window); 12803 struct window *w = XWINDOW (window);
12791 struct it it; 12804 struct it it;
@@ -12810,6 +12823,30 @@ try_window (window, pos)
12810 return 0; 12823 return 0;
12811 } 12824 }
12812 12825
12826 /* Don't let the cursor end in the scroll margins. */
12827 if (check_margins)
12828 {
12829 int this_scroll_margin, cursor_height;
12830
12831 this_scroll_margin = max (0, scroll_margin);
12832 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
12833 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
12834 cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
12835
12836 if ((w->cursor.y < this_scroll_margin
12837 && CHARPOS (pos) > BEGV)
12838 /* Old redisplay didn't take scroll margin into account at the bottom,
12839 but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
12840 || (w->cursor.y + (make_cursor_line_fully_visible_p
12841 ? cursor_height + this_scroll_margin
12842 : 1)) > it.last_visible_y)
12843 {
12844 w->cursor.vpos = -1;
12845 clear_glyph_matrix (w->desired_matrix);
12846 return -1;
12847 }
12848 }
12849
12813 /* If bottom moved off end of frame, change mode line percentage. */ 12850 /* If bottom moved off end of frame, change mode line percentage. */
12814 if (XFASTINT (w->window_end_pos) <= 0 12851 if (XFASTINT (w->window_end_pos) <= 0
12815 && Z != IT_CHARPOS (it)) 12852 && Z != IT_CHARPOS (it))
@@ -21801,7 +21838,7 @@ note_mouse_highlight (f, x, y)
21801 /* If we were displaying active text in another window, clear that. 21838 /* If we were displaying active text in another window, clear that.
21802 Also clear if we move out of text area in same window. */ 21839 Also clear if we move out of text area in same window. */
21803 if (! EQ (window, dpyinfo->mouse_face_window) 21840 if (! EQ (window, dpyinfo->mouse_face_window)
21804 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE 21841 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
21805 && !NILP (dpyinfo->mouse_face_window))) 21842 && !NILP (dpyinfo->mouse_face_window)))
21806 clear_mouse_face (dpyinfo); 21843 clear_mouse_face (dpyinfo);
21807 21844
@@ -23026,17 +23063,17 @@ The face used for trailing whitespace is `trailing-whitespace'. */);
23026 23063
23027 DEFVAR_LISP ("nobreak-char-display", &Vnobreak_char_display, 23064 DEFVAR_LISP ("nobreak-char-display", &Vnobreak_char_display,
23028 doc: /* *Control highlighting of nobreak space and soft hyphen. 23065 doc: /* *Control highlighting of nobreak space and soft hyphen.
23029t means highlight the character itself (for nobreak space, 23066A value of t means highlight the character itself (for nobreak space,
23030use face `nobreak-space'. 23067use face `nobreak-space').
23031nil means no highlighting. 23068A value of nil means no highlighting.
23032other values mean display the escape glyph followed by an ordinary 23069Other values mean display the escape glyph followed by an ordinary
23033space or ordinary hyphen. */); 23070space or ordinary hyphen. */);
23034 Vnobreak_char_display = Qt; 23071 Vnobreak_char_display = Qt;
23035 23072
23036 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, 23073 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
23037 doc: /* *The pointer shape to show in void text areas. 23074 doc: /* *The pointer shape to show in void text areas.
23038Nil means to show the text pointer. Other options are `arrow', `text', 23075A value of nil means to show the text pointer. Other options are `arrow',
23039`hand', `vdrag', `hdrag', `modeline', and `hourglass'. */); 23076`text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'. */);
23040 Vvoid_text_area_pointer = Qarrow; 23077 Vvoid_text_area_pointer = Qarrow;
23041 23078
23042 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay, 23079 DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay,
diff --git a/src/xfns.c b/src/xfns.c
index e5efec27b7d..1de6fc71d1a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5070,7 +5070,7 @@ Text larger than the specified size is clipped. */)
5070 clear_glyph_matrix (w->desired_matrix); 5070 clear_glyph_matrix (w->desired_matrix);
5071 clear_glyph_matrix (w->current_matrix); 5071 clear_glyph_matrix (w->current_matrix);
5072 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5072 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
5073 try_window (FRAME_ROOT_WINDOW (f), pos); 5073 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
5074 5074
5075 /* Compute width and height of the tooltip. */ 5075 /* Compute width and height of the tooltip. */
5076 width = height = 0; 5076 width = height = 0;