aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 1f98ff040b3..d0f1df694d5 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -101,7 +101,7 @@ static void general_insert_function (void (*) (const char *, EMACS_INT),
101 void (*) (Lisp_Object, EMACS_INT, 101 void (*) (Lisp_Object, EMACS_INT,
102 EMACS_INT, EMACS_INT, 102 EMACS_INT, EMACS_INT,
103 EMACS_INT, int), 103 EMACS_INT, int),
104 int, int, Lisp_Object *); 104 int, size_t, Lisp_Object *);
105static Lisp_Object subst_char_in_region_unwind (Lisp_Object); 105static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
106static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); 106static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
107static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, 107static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
@@ -928,18 +928,21 @@ save_excursion_restore (Lisp_Object info)
928 tem1 = BVAR (current_buffer, mark_active); 928 tem1 = BVAR (current_buffer, mark_active);
929 BVAR (current_buffer, mark_active) = tem; 929 BVAR (current_buffer, mark_active) = tem;
930 930
931 if (!NILP (Vrun_hooks)) 931 /* If mark is active now, and either was not active
932 or was at a different place, run the activate hook. */
933 if (! NILP (tem))
932 { 934 {
933 /* If mark is active now, and either was not active 935 if (! EQ (omark, nmark))
934 or was at a different place, run the activate hook. */ 936 {
935 if (! NILP (BVAR (current_buffer, mark_active))) 937 tem = intern ("activate-mark-hook");
936 { 938 Frun_hooks (1, &tem);
937 if (! EQ (omark, nmark)) 939 }
938 call1 (Vrun_hooks, intern ("activate-mark-hook")); 940 }
939 } 941 /* If mark has ceased to be active, run deactivate hook. */
940 /* If mark has ceased to be active, run deactivate hook. */ 942 else if (! NILP (tem1))
941 else if (! NILP (tem1)) 943 {
942 call1 (Vrun_hooks, intern ("deactivate-mark-hook")); 944 tem = intern ("deactivate-mark-hook");
945 Frun_hooks (1, &tem);
943 } 946 }
944 947
945 /* If buffer was visible in a window, and a different window was 948 /* If buffer was visible in a window, and a different window was
@@ -1868,7 +1871,7 @@ Years before 1970 are not guaranteed to work. On some systems,
1868year values as low as 1901 do work. 1871year values as low as 1901 do work.
1869 1872
1870usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) 1873usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1871 (int nargs, register Lisp_Object *args) 1874 (size_t nargs, register Lisp_Object *args)
1872{ 1875{
1873 time_t value; 1876 time_t value;
1874 struct tm tm; 1877 struct tm tm;
@@ -2204,9 +2207,9 @@ general_insert_function (void (*insert_func)
2204 void (*insert_from_string_func) 2207 void (*insert_from_string_func)
2205 (Lisp_Object, EMACS_INT, EMACS_INT, 2208 (Lisp_Object, EMACS_INT, EMACS_INT,
2206 EMACS_INT, EMACS_INT, int), 2209 EMACS_INT, EMACS_INT, int),
2207 int inherit, int nargs, Lisp_Object *args) 2210 int inherit, size_t nargs, Lisp_Object *args)
2208{ 2211{
2209 register int argnum; 2212 register size_t argnum;
2210 register Lisp_Object val; 2213 register Lisp_Object val;
2211 2214
2212 for (argnum = 0; argnum < nargs; argnum++) 2215 for (argnum = 0; argnum < nargs; argnum++)
@@ -2223,7 +2226,7 @@ general_insert_function (void (*insert_func)
2223 { 2226 {
2224 str[0] = (ASCII_CHAR_P (XINT (val)) 2227 str[0] = (ASCII_CHAR_P (XINT (val))
2225 ? XINT (val) 2228 ? XINT (val)
2226 : multibyte_char_to_unibyte (XINT (val), Qnil)); 2229 : multibyte_char_to_unibyte (XINT (val)));
2227 len = 1; 2230 len = 1;
2228 } 2231 }
2229 (*insert_func) ((char *) str, len); 2232 (*insert_func) ((char *) str, len);
@@ -2269,7 +2272,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string
2269and insert the result. 2272and insert the result.
2270 2273
2271usage: (insert &rest ARGS) */) 2274usage: (insert &rest ARGS) */)
2272 (int nargs, register Lisp_Object *args) 2275 (size_t nargs, register Lisp_Object *args)
2273{ 2276{
2274 general_insert_function (insert, insert_from_string, 0, nargs, args); 2277 general_insert_function (insert, insert_from_string, 0, nargs, args);
2275 return Qnil; 2278 return Qnil;
@@ -2288,7 +2291,7 @@ If the current buffer is unibyte, multibyte strings are converted
2288to unibyte for insertion. 2291to unibyte for insertion.
2289 2292
2290usage: (insert-and-inherit &rest ARGS) */) 2293usage: (insert-and-inherit &rest ARGS) */)
2291 (int nargs, register Lisp_Object *args) 2294 (size_t nargs, register Lisp_Object *args)
2292{ 2295{
2293 general_insert_function (insert_and_inherit, insert_from_string, 1, 2296 general_insert_function (insert_and_inherit, insert_from_string, 1,
2294 nargs, args); 2297 nargs, args);
@@ -2305,7 +2308,7 @@ If the current buffer is unibyte, multibyte strings are converted
2305to unibyte for insertion. 2308to unibyte for insertion.
2306 2309
2307usage: (insert-before-markers &rest ARGS) */) 2310usage: (insert-before-markers &rest ARGS) */)
2308 (int nargs, register Lisp_Object *args) 2311 (size_t nargs, register Lisp_Object *args)
2309{ 2312{
2310 general_insert_function (insert_before_markers, 2313 general_insert_function (insert_before_markers,
2311 insert_from_string_before_markers, 0, 2314 insert_from_string_before_markers, 0,
@@ -2324,7 +2327,7 @@ If the current buffer is unibyte, multibyte strings are converted
2324to unibyte for insertion. 2327to unibyte for insertion.
2325 2328
2326usage: (insert-before-markers-and-inherit &rest ARGS) */) 2329usage: (insert-before-markers-and-inherit &rest ARGS) */)
2327 (int nargs, register Lisp_Object *args) 2330 (size_t nargs, register Lisp_Object *args)
2328{ 2331{
2329 general_insert_function (insert_before_markers_and_inherit, 2332 general_insert_function (insert_before_markers_and_inherit,
2330 insert_from_string_before_markers, 1, 2333 insert_from_string_before_markers, 1,
@@ -3396,7 +3399,7 @@ any existing message; this lets the minibuffer contents show. See
3396also `current-message'. 3399also `current-message'.
3397 3400
3398usage: (message FORMAT-STRING &rest ARGS) */) 3401usage: (message FORMAT-STRING &rest ARGS) */)
3399 (int nargs, Lisp_Object *args) 3402 (size_t nargs, Lisp_Object *args)
3400{ 3403{
3401 if (NILP (args[0]) 3404 if (NILP (args[0])
3402 || (STRINGP (args[0]) 3405 || (STRINGP (args[0])
@@ -3424,7 +3427,7 @@ If the first argument is nil or the empty string, clear any existing
3424message; let the minibuffer contents show. 3427message; let the minibuffer contents show.
3425 3428
3426usage: (message-box FORMAT-STRING &rest ARGS) */) 3429usage: (message-box FORMAT-STRING &rest ARGS) */)
3427 (int nargs, Lisp_Object *args) 3430 (size_t nargs, Lisp_Object *args)
3428{ 3431{
3429 if (NILP (args[0])) 3432 if (NILP (args[0]))
3430 { 3433 {
@@ -3441,12 +3444,12 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
3441 if (FRAME_WINDOW_P (XFRAME (selected_frame)) 3444 if (FRAME_WINDOW_P (XFRAME (selected_frame))
3442 || FRAME_MSDOS_P (XFRAME (selected_frame))) 3445 || FRAME_MSDOS_P (XFRAME (selected_frame)))
3443 { 3446 {
3444 Lisp_Object pane, menu, obj; 3447 Lisp_Object pane, menu;
3445 struct gcpro gcpro1; 3448 struct gcpro gcpro1;
3446 pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil); 3449 pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil);
3447 GCPRO1 (pane); 3450 GCPRO1 (pane);
3448 menu = Fcons (val, pane); 3451 menu = Fcons (val, pane);
3449 obj = Fx_popup_dialog (Qt, menu, Qt); 3452 Fx_popup_dialog (Qt, menu, Qt);
3450 UNGCPRO; 3453 UNGCPRO;
3451 return val; 3454 return val;
3452 } 3455 }
@@ -3481,7 +3484,7 @@ If the first argument is nil or the empty string, clear any existing
3481message; let the minibuffer contents show. 3484message; let the minibuffer contents show.
3482 3485
3483usage: (message-or-box FORMAT-STRING &rest ARGS) */) 3486usage: (message-or-box FORMAT-STRING &rest ARGS) */)
3484 (int nargs, Lisp_Object *args) 3487 (size_t nargs, Lisp_Object *args)
3485{ 3488{
3486#ifdef HAVE_MENUS 3489#ifdef HAVE_MENUS
3487 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 3490 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
@@ -3505,14 +3508,14 @@ First argument is the string to copy.
3505Remaining arguments form a sequence of PROPERTY VALUE pairs for text 3508Remaining arguments form a sequence of PROPERTY VALUE pairs for text
3506properties to add to the result. 3509properties to add to the result.
3507usage: (propertize STRING &rest PROPERTIES) */) 3510usage: (propertize STRING &rest PROPERTIES) */)
3508 (int nargs, Lisp_Object *args) 3511 (size_t nargs, Lisp_Object *args)
3509{ 3512{
3510 Lisp_Object properties, string; 3513 Lisp_Object properties, string;
3511 struct gcpro gcpro1, gcpro2; 3514 struct gcpro gcpro1, gcpro2;
3512 int i; 3515 size_t i;
3513 3516
3514 /* Number of args must be odd. */ 3517 /* Number of args must be odd. */
3515 if ((nargs & 1) == 0 || nargs < 1) 3518 if ((nargs & 1) == 0)
3516 error ("Wrong number of arguments"); 3519 error ("Wrong number of arguments");
3517 3520
3518 properties = string = Qnil; 3521 properties = string = Qnil;
@@ -3587,10 +3590,10 @@ decimal point itself is omitted. For %s and %S, the precision
3587specifier truncates the string to the given width. 3590specifier truncates the string to the given width.
3588 3591
3589usage: (format STRING &rest OBJECTS) */) 3592usage: (format STRING &rest OBJECTS) */)
3590 (int nargs, register Lisp_Object *args) 3593 (size_t nargs, register Lisp_Object *args)
3591{ 3594{
3592 register int n; /* The number of the next arg to substitute */ 3595 register size_t n; /* The number of the next arg to substitute */
3593 register EMACS_INT total; /* An estimate of the final length */ 3596 register size_t total; /* An estimate of the final length */
3594 char *buf, *p; 3597 char *buf, *p;
3595 register char *format, *end, *format_start; 3598 register char *format, *end, *format_start;
3596 int nchars; 3599 int nchars;
@@ -3666,8 +3669,8 @@ usage: (format STRING &rest OBJECTS) */)
3666 3669
3667 /* Allocate the info and discarded tables. */ 3670 /* Allocate the info and discarded tables. */
3668 { 3671 {
3669 int nbytes = (nargs+1) * sizeof *info; 3672 size_t nbytes = (nargs+1) * sizeof *info;
3670 int i; 3673 size_t i;
3671 if (!info) 3674 if (!info)
3672 info = (struct info *) alloca (nbytes); 3675 info = (struct info *) alloca (nbytes);
3673 memset (info, 0, nbytes); 3676 memset (info, 0, nbytes);