diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 38 | ||||
| -rw-r--r-- | src/ChangeLog | 87 | ||||
| -rw-r--r-- | src/alloc.c | 7 | ||||
| -rw-r--r-- | src/emacs.c | 23 | ||||
| -rw-r--r-- | src/fileio.c | 51 | ||||
| -rw-r--r-- | src/keyboard.c | 82 | ||||
| -rw-r--r-- | src/mac.c | 299 | ||||
| -rw-r--r-- | src/macfns.c | 1 | ||||
| -rw-r--r-- | src/macmenu.c | 1 | ||||
| -rw-r--r-- | src/macselect.c | 4 | ||||
| -rw-r--r-- | src/macterm.c | 85 | ||||
| -rw-r--r-- | src/process.c | 7 | ||||
| -rw-r--r-- | src/unexmacosx.c | 98 | ||||
| -rw-r--r-- | src/xdisp.c | 23 |
14 files changed, 535 insertions, 271 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index c3c7e6fd428..f1cc2d35d4b 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -112,21 +112,45 @@ define pitx | |||
| 112 | if ($it->start.pos.charpos != $it->start.pos.bytepos) | 112 | if ($it->start.pos.charpos != $it->start.pos.bytepos) |
| 113 | printf "[%d]", $it->start.pos.bytepos | 113 | printf "[%d]", $it->start.pos.bytepos |
| 114 | end | 114 | end |
| 115 | printf " stop=%d ", $it->stop_charpos | 115 | printf " end=%d", $it->end_charpos |
| 116 | output $it->what | 116 | printf " stop=%d", $it->stop_charpos |
| 117 | printf " face=%d", $it->face_id | ||
| 118 | if ($it->multibyte_p) | ||
| 119 | printf " MB" | ||
| 120 | end | ||
| 121 | if ($it->header_line_p) | ||
| 122 | printf " HL" | ||
| 123 | end | ||
| 124 | if ($it->n_overlay_strings > 0) | ||
| 125 | printf " nov=%d" | ||
| 126 | end | ||
| 127 | if ($it->sp != 0) | ||
| 128 | printf " sp=%d", $it->sp | ||
| 129 | end | ||
| 117 | if ($it->what == IT_CHARACTER) | 130 | if ($it->what == IT_CHARACTER) |
| 118 | if ($it->len == 1 && $it->c >= ' ' && it->c < 255) | 131 | if ($it->len == 1 && $it->c >= ' ' && it->c < 255) |
| 119 | printf "['%c']", $it->c | 132 | printf "ch='%c'", $it->c |
| 120 | else | 133 | else |
| 121 | printf "[%d,%d]", $it->c, $it->len | 134 | printf "ch=[%d,%d]", $it->c, $it->len |
| 135 | end | ||
| 136 | else | ||
| 137 | if ($it->what == IT_IMAGE) | ||
| 138 | printf "IMAGE=%d", $it->image_id | ||
| 139 | else | ||
| 140 | output $it->what | ||
| 122 | end | 141 | end |
| 123 | end | 142 | end |
| 124 | printf " next=" | 143 | if ($it->method != GET_FROM_BUFFER) |
| 125 | output $it->method | 144 | printf " next=" |
| 145 | output $it->method | ||
| 146 | end | ||
| 126 | printf "\n" | 147 | printf "\n" |
| 148 | if ($it->region_beg_charpos >= 0) | ||
| 149 | printf "reg=%d-%d ", $it->region_beg_charpos, $it->region_end_charpos | ||
| 150 | end | ||
| 127 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, | 151 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, |
| 128 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y | 152 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y |
| 129 | printf " x=%d lvx=%d", $it->current_x, $it->last_visible_x | 153 | printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x |
| 130 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent | 154 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent |
| 131 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent | 155 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent |
| 132 | printf "\n" | 156 | printf "\n" |
diff --git a/src/ChangeLog b/src/ChangeLog index a0999f79f64..10d3bd31bda 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,90 @@ | |||
| 1 | 2005-05-19 Nick Roberts <nickrob@snap.net.nz> | ||
| 2 | |||
| 3 | * keyboard.c (syms_of_keyboard): Remove lisp variables | ||
| 4 | post-command-idle-hook and post-command-idle-delay. | ||
| 5 | (command_loop_1): Don't try to execute post-command-idle-hook. | ||
| 6 | |||
| 7 | 2005-05-16 Kim F. Storm <storm@cua.dk> | ||
| 8 | |||
| 9 | * xdisp.c (handle_display_prop): Handle empty replacement. | ||
| 10 | (handle_single_display_spec): Return -1 for empty replacement. | ||
| 11 | |||
| 12 | * keyboard.c (adjust_point_for_property): Skip empty overlay string. | ||
| 13 | |||
| 14 | * .gdbinit (pitx): Print more info about iterator. | ||
| 15 | |||
| 16 | 2005-05-16 Andreas Schwab <schwab@suse.de> | ||
| 17 | |||
| 18 | * unexmacosx.c (unexec_realloc): Move declarations before | ||
| 19 | statements. | ||
| 20 | |||
| 21 | 2005-05-14 Richard M. Stallman <rms@gnu.org> | ||
| 22 | |||
| 23 | * xdisp.c (message3): Call cancel_echoing. | ||
| 24 | |||
| 25 | * alloc.c (Fmemory_full_p): New function. | ||
| 26 | (syms_of_alloc): defsubr it. | ||
| 27 | |||
| 28 | * process.c (send_process_trap): Unblock SIGPIPE. | ||
| 29 | (send_process): Reset SIGPIPE handler before reporting error. | ||
| 30 | |||
| 31 | 2005-05-14 Nick Roberts <nickrob@snap.net.nz> | ||
| 32 | |||
| 33 | * emacs.c (syms_of_emacs): Fix doc string for system-type. | ||
| 34 | |||
| 35 | 2005-05-13 Richard M. Stallman <rms@gnu.org> | ||
| 36 | |||
| 37 | * fileio.c (Ffind_file_name_handler): Handle lambda-exp as handler. | ||
| 38 | (Finsert_file_contents): If we read 0 bytes from a special file, | ||
| 39 | unlock the visited file if we locked it. | ||
| 40 | (Fmake_symbolic_link, Frecent_auto_save_p): Doc fixes. | ||
| 41 | (Ffile_exists_p, Ffile_symlink_p): Doc fixes. | ||
| 42 | |||
| 43 | 2005-05-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 44 | |||
| 45 | * emacs.c (main) [MAC_OS8]: Call init_atimer before mac_term_init. | ||
| 46 | |||
| 47 | * keyboard.c (readable_events) [USE_TOOLKIT_SCROLL_BARS]: Regard | ||
| 48 | toolkit scroll bar thumb drag events as squeezable and prevent | ||
| 49 | redisplay from being paused by them. | ||
| 50 | |||
| 51 | * mac.c [!MAC_OSX]: Include keyboard.h and syssignal.h. | ||
| 52 | [!MAC_OSX] (target_ticks): Remove variable. | ||
| 53 | [!MAC_OSX] (check_alarm, pause, index): Remove functions. | ||
| 54 | [!MAC_OSX && __MRC__] (sys_strftime): Likewise. | ||
| 55 | [!MAC_OSX] (select): If fd 0 is not set in rfds and some input | ||
| 56 | event occurs before timeout, behave as if the function were | ||
| 57 | interrupted. | ||
| 58 | [!MAC_OSX] (sigblock, sigsetmask, alarm): Simulate SIGALRM | ||
| 59 | handling using Time Manager routines. | ||
| 60 | [!MAC_OSX] (mac_atimer_task, mac_atimer_qlink, signal_mask): New | ||
| 61 | variables. | ||
| 62 | [!MAC_OSX] (mac_atimer_handler, set_mac_atimer, remove_mac_atimer) | ||
| 63 | (setitimer): New functions. | ||
| 64 | |||
| 65 | * macfns.c, macmenu.c: Don't include signal.h. | ||
| 66 | |||
| 67 | * macterm.c [USE_TOOLKIT_SCROLL_BARS] (get_control_part_bounds): | ||
| 68 | Rename from get_control_part_bound. All callers changed. | ||
| 69 | (x_scroll_bar_clear): New function. | ||
| 70 | (x_clear_frame): Use it. | ||
| 71 | (XTset_vertical_scroll_bar): Don't call Draw1Control. | ||
| 72 | (x_scroll_bar_handle_click): Change type of second argument from | ||
| 73 | int to ControlPartCode. | ||
| 74 | (check_alarm): Remove declaration. | ||
| 75 | (XTread_Socket) [!TARGET_API_MAC_CARBON]: Don't call it. | ||
| 76 | (XTread_Socket): Use ControlPartCode instead of SInt16. | ||
| 77 | |||
| 78 | 2005-05-13 Nozomu Ando <nand@mac.com> | ||
| 79 | |||
| 80 | * unexmacosx.c: Include assert.h. | ||
| 81 | (MACOSX_MALLOC_MULT16): New define. | ||
| 82 | [MACOSX_MALLOC_MULT16] (ptr_in_unexec_regions): Determine whether | ||
| 83 | ptr is in unexec regions by checking it is multiple of 16. | ||
| 84 | (unexec_malloc_header_t): New typedef. | ||
| 85 | (unexec_malloc, unexec_realloc, unexec_free): Store and use | ||
| 86 | allocated size information in unexec_malloc_header. | ||
| 87 | |||
| 1 | 2005-05-10 Richard M. Stallman <rms@gnu.org> | 88 | 2005-05-10 Richard M. Stallman <rms@gnu.org> |
| 2 | 89 | ||
| 3 | * xterm.c (noinclude): Add #undef. | 90 | * xterm.c (noinclude): Add #undef. |
diff --git a/src/alloc.c b/src/alloc.c index 1aa07b01da2..1eeea72ea7e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -534,6 +534,12 @@ memory_full () | |||
| 534 | Fsignal (Qnil, Vmemory_signal_data); | 534 | Fsignal (Qnil, Vmemory_signal_data); |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | DEFUN ("memory-full-p", Fmemory_full_p, Smemory_full_p, 0, 0, 0, | ||
| 538 | doc: /* t if memory is nearly full, nil otherwise. */) | ||
| 539 | () | ||
| 540 | { | ||
| 541 | return (spare_memory ? Qnil : Qt); | ||
| 542 | } | ||
| 537 | 543 | ||
| 538 | /* Called if we can't allocate relocatable space for a buffer. */ | 544 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 539 | 545 | ||
| @@ -6035,6 +6041,7 @@ The time is in seconds as a floating point value. */); | |||
| 6035 | DEFVAR_INT ("gcs-done", &gcs_done, | 6041 | DEFVAR_INT ("gcs-done", &gcs_done, |
| 6036 | doc: /* Accumulated number of garbage collections done. */); | 6042 | doc: /* Accumulated number of garbage collections done. */); |
| 6037 | 6043 | ||
| 6044 | defsubr (&Smemory_full_p); | ||
| 6038 | defsubr (&Scons); | 6045 | defsubr (&Scons); |
| 6039 | defsubr (&Slist); | 6046 | defsubr (&Slist); |
| 6040 | defsubr (&Svector); | 6047 | defsubr (&Svector); |
diff --git a/src/emacs.c b/src/emacs.c index 597a86d2eec..65a6d549845 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1326,6 +1326,7 @@ main (argc, argv | |||
| 1326 | syms_of_search (); | 1326 | syms_of_search (); |
| 1327 | syms_of_frame (); | 1327 | syms_of_frame (); |
| 1328 | 1328 | ||
| 1329 | init_atimer (); | ||
| 1329 | mac_term_init (build_string ("Mac"), NULL, NULL); | 1330 | mac_term_init (build_string ("Mac"), NULL, NULL); |
| 1330 | init_keyboard (); | 1331 | init_keyboard (); |
| 1331 | #endif | 1332 | #endif |
| @@ -1351,7 +1352,9 @@ main (argc, argv | |||
| 1351 | #ifdef CLASH_DETECTION | 1352 | #ifdef CLASH_DETECTION |
| 1352 | init_filelock (); | 1353 | init_filelock (); |
| 1353 | #endif | 1354 | #endif |
| 1355 | #ifndef MAC_OS8 | ||
| 1354 | init_atimer (); | 1356 | init_atimer (); |
| 1357 | #endif | ||
| 1355 | running_asynch_code = 0; | 1358 | running_asynch_code = 0; |
| 1356 | 1359 | ||
| 1357 | /* Handle --unibyte and the EMACS_UNIBYTE envvar, | 1360 | /* Handle --unibyte and the EMACS_UNIBYTE envvar, |
| @@ -2447,16 +2450,16 @@ syms_of_emacs () | |||
| 2447 | Many arguments are deleted from the list as they are processed. */); | 2450 | Many arguments are deleted from the list as they are processed. */); |
| 2448 | 2451 | ||
| 2449 | DEFVAR_LISP ("system-type", &Vsystem_type, | 2452 | DEFVAR_LISP ("system-type", &Vsystem_type, |
| 2450 | + doc: /* Value is symbol indicating type of operating system you are using. | 2453 | doc: /* Value is symbol indicating type of operating system you are using. |
| 2451 | +Special values: | 2454 | Special values: |
| 2452 | + `gnu/linux' compiled for a GNU/Linux system. | 2455 | `gnu/linux' compiled for a GNU/Linux system. |
| 2453 | + `darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...). | 2456 | `darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...). |
| 2454 | + `macos' compiled for Mac OS 9. | 2457 | `macos' compiled for Mac OS 9. |
| 2455 | + `ms-dos' compiled as an MS-DOS application. | 2458 | `ms-dos' compiled as an MS-DOS application. |
| 2456 | + `windows-nt' compiled as a native W32 application. | 2459 | `windows-nt' compiled as a native W32 application. |
| 2457 | + `cygwin' compiled using the Cygwin library. | 2460 | `cygwin' compiled using the Cygwin library. |
| 2458 | + `vax-vms' or `axp-vms': compiled for a (Open)VMS system. | 2461 | `vax-vms' or `axp-vms': compiled for a (Open)VMS system. |
| 2459 | +Anything else indicates some sort of Unix system. */); | 2462 | Anything else indicates some sort of Unix system. */); |
| 2460 | Vsystem_type = intern (SYSTEM_TYPE); | 2463 | Vsystem_type = intern (SYSTEM_TYPE); |
| 2461 | 2464 | ||
| 2462 | DEFVAR_LISP ("system-configuration", &Vsystem_configuration, | 2465 | DEFVAR_LISP ("system-configuration", &Vsystem_configuration, |
diff --git a/src/fileio.c b/src/fileio.c index 1d6100a2a81..58912a7cb8c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -377,7 +377,10 @@ use the standard functions without calling themselves recursively. */) | |||
| 377 | Lisp_Object string = XCAR (elt); | 377 | Lisp_Object string = XCAR (elt); |
| 378 | int match_pos; | 378 | int match_pos; |
| 379 | Lisp_Object handler = XCDR (elt); | 379 | Lisp_Object handler = XCDR (elt); |
| 380 | Lisp_Object operations = Fget (handler, Qoperations); | 380 | Lisp_Object operations = Qnil; |
| 381 | |||
| 382 | if (SYMBOLP (handler)) | ||
| 383 | operations = Fget (handler, Qoperations); | ||
| 381 | 384 | ||
| 382 | if (STRINGP (string) | 385 | if (STRINGP (string) |
| 383 | && (match_pos = fast_string_match (string, filename)) > pos | 386 | && (match_pos = fast_string_match (string, filename)) > pos |
| @@ -2867,7 +2870,8 @@ This is what happens in interactive use with M-x. */) | |||
| 2867 | #ifdef S_IFLNK | 2870 | #ifdef S_IFLNK |
| 2868 | DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, | 2871 | DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, |
| 2869 | "FMake symbolic link to file: \nGMake symbolic link to file %s: \np", | 2872 | "FMake symbolic link to file: \nGMake symbolic link to file %s: \np", |
| 2870 | doc: /* Make a symbolic link to FILENAME, named LINKNAME. Both args must be strings. | 2873 | doc: /* Make a symbolic link to FILENAME, named LINKNAME. |
| 2874 | Both args must be strings. | ||
| 2871 | Signals a `file-already-exists' error if a file LINKNAME already exists | 2875 | Signals a `file-already-exists' error if a file LINKNAME already exists |
| 2872 | unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. | 2876 | unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. |
| 2873 | A number as third arg means request confirmation if LINKNAME already exists. | 2877 | A number as third arg means request confirmation if LINKNAME already exists. |
| @@ -3065,8 +3069,10 @@ check_writable (filename) | |||
| 3065 | } | 3069 | } |
| 3066 | 3070 | ||
| 3067 | DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, | 3071 | DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, |
| 3068 | doc: /* Return t if file FILENAME exists. (This does not mean you can read it.) | 3072 | doc: /* Return t if file FILENAME exists (whether or not you can read it.) |
| 3069 | See also `file-readable-p' and `file-attributes'. */) | 3073 | See also `file-readable-p' and `file-attributes'. |
| 3074 | This returns nil for a symlink to a nonexistent file. | ||
| 3075 | Use `file-symlink-p' to test for such links. */) | ||
| 3070 | (filename) | 3076 | (filename) |
| 3071 | Lisp_Object filename; | 3077 | Lisp_Object filename; |
| 3072 | { | 3078 | { |
| @@ -3243,7 +3249,10 @@ If there is no error, returns nil. */) | |||
| 3243 | DEFUN ("file-symlink-p", Ffile_symlink_p, Sfile_symlink_p, 1, 1, 0, | 3249 | DEFUN ("file-symlink-p", Ffile_symlink_p, Sfile_symlink_p, 1, 1, 0, |
| 3244 | doc: /* Return non-nil if file FILENAME is the name of a symbolic link. | 3250 | doc: /* Return non-nil if file FILENAME is the name of a symbolic link. |
| 3245 | The value is the link target, as a string. | 3251 | The value is the link target, as a string. |
| 3246 | Otherwise returns nil. */) | 3252 | Otherwise it returns nil. |
| 3253 | |||
| 3254 | This function returns t when given the name of a symlink that | ||
| 3255 | points to a nonexistent file. */) | ||
| 3247 | (filename) | 3256 | (filename) |
| 3248 | Lisp_Object filename; | 3257 | Lisp_Object filename; |
| 3249 | { | 3258 | { |
| @@ -3733,6 +3742,8 @@ actually used. */) | |||
| 3733 | int set_coding_system = 0; | 3742 | int set_coding_system = 0; |
| 3734 | Lisp_Object coding_system; | 3743 | Lisp_Object coding_system; |
| 3735 | int read_quit = 0; | 3744 | int read_quit = 0; |
| 3745 | int old_Vdeactivate_mark = Vdeactivate_mark; | ||
| 3746 | int we_locked_file = 0; | ||
| 3736 | 3747 | ||
| 3737 | if (current_buffer->base_buffer && ! NILP (visit)) | 3748 | if (current_buffer->base_buffer && ! NILP (visit)) |
| 3738 | error ("Cannot do file visiting in an indirect buffer"); | 3749 | error ("Cannot do file visiting in an indirect buffer"); |
| @@ -4381,8 +4392,17 @@ actually used. */) | |||
| 4381 | /* For a special file, all we can do is guess. */ | 4392 | /* For a special file, all we can do is guess. */ |
| 4382 | total = READ_BUF_SIZE; | 4393 | total = READ_BUF_SIZE; |
| 4383 | 4394 | ||
| 4384 | if (NILP (visit) && total > 0) | 4395 | if (NILP (visit) && inserted > 0) |
| 4385 | prepare_to_modify_buffer (PT, PT, NULL); | 4396 | { |
| 4397 | #ifdef CLASH_DETECTION | ||
| 4398 | if (!NILP (current_buffer->file_truename) | ||
| 4399 | /* Make binding buffer-file-name to nil effective. */ | ||
| 4400 | && !NILP (current_buffer->filename) | ||
| 4401 | && SAVE_MODIFF >= MODIFF) | ||
| 4402 | we_locked_file = 1; | ||
| 4403 | #endif /* CLASH_DETECTION */ | ||
| 4404 | prepare_to_modify_buffer (GPT, GPT, NULL); | ||
| 4405 | } | ||
| 4386 | 4406 | ||
| 4387 | move_gap (PT); | 4407 | move_gap (PT); |
| 4388 | if (GAP_SIZE < total) | 4408 | if (GAP_SIZE < total) |
| @@ -4472,6 +4492,18 @@ actually used. */) | |||
| 4472 | } | 4492 | } |
| 4473 | } | 4493 | } |
| 4474 | 4494 | ||
| 4495 | /* Now we have read all the file data into the gap. | ||
| 4496 | If it was empty, undo marking the buffer modified. */ | ||
| 4497 | |||
| 4498 | if (inserted == 0) | ||
| 4499 | { | ||
| 4500 | #ifdef CLASH_DETECTION | ||
| 4501 | if (we_locked_file) | ||
| 4502 | unlock_file (current_buffer->file_truename); | ||
| 4503 | #endif | ||
| 4504 | Vdeactivate_mark = old_Vdeactivate_mark; | ||
| 4505 | } | ||
| 4506 | |||
| 4475 | /* Make the text read part of the buffer. */ | 4507 | /* Make the text read part of the buffer. */ |
| 4476 | GAP_SIZE -= inserted; | 4508 | GAP_SIZE -= inserted; |
| 4477 | GPT += inserted; | 4509 | GPT += inserted; |
| @@ -5952,7 +5984,10 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, | |||
| 5952 | 5984 | ||
| 5953 | DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p, | 5985 | DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p, |
| 5954 | 0, 0, 0, | 5986 | 0, 0, 0, |
| 5955 | doc: /* Return t if current buffer has been auto-saved since last read in or saved. */) | 5987 | doc: /* Return t if current buffer has been auto-saved recently. |
| 5988 | More precisely, if it has been auto-saved since last read from or saved | ||
| 5989 | in the visited file. If the buffer has no visited file, | ||
| 5990 | then any auto-save counts as "recent". */) | ||
| 5956 | () | 5991 | () |
| 5957 | { | 5992 | { |
| 5958 | return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil; | 5993 | return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil; |
diff --git a/src/keyboard.c b/src/keyboard.c index dd4767585b7..0e7fb1c2719 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -450,11 +450,6 @@ Lisp_Object Qecho_area_clear_hook; | |||
| 450 | Lisp_Object Qpre_command_hook, Vpre_command_hook; | 450 | Lisp_Object Qpre_command_hook, Vpre_command_hook; |
| 451 | Lisp_Object Qpost_command_hook, Vpost_command_hook; | 451 | Lisp_Object Qpost_command_hook, Vpost_command_hook; |
| 452 | Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal; | 452 | Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal; |
| 453 | /* Hook run after a command if there's no more input soon. */ | ||
| 454 | Lisp_Object Qpost_command_idle_hook, Vpost_command_idle_hook; | ||
| 455 | |||
| 456 | /* Delay time in microseconds before running post-command-idle-hook. */ | ||
| 457 | EMACS_INT post_command_idle_delay; | ||
| 458 | 453 | ||
| 459 | /* List of deferred actions to be performed at a later time. | 454 | /* List of deferred actions to be performed at a later time. |
| 460 | The precise format isn't relevant here; we just check whether it is nil. */ | 455 | The precise format isn't relevant here; we just check whether it is nil. */ |
| @@ -1447,16 +1442,6 @@ command_loop_1 () | |||
| 1447 | 1442 | ||
| 1448 | if (!NILP (Vdeferred_action_list)) | 1443 | if (!NILP (Vdeferred_action_list)) |
| 1449 | safe_run_hooks (Qdeferred_action_function); | 1444 | safe_run_hooks (Qdeferred_action_function); |
| 1450 | |||
| 1451 | if (!NILP (Vpost_command_idle_hook) && !NILP (Vrun_hooks)) | ||
| 1452 | { | ||
| 1453 | if (NILP (Vunread_command_events) | ||
| 1454 | && NILP (Vunread_input_method_events) | ||
| 1455 | && NILP (Vunread_post_input_method_events) | ||
| 1456 | && NILP (Vexecuting_kbd_macro) | ||
| 1457 | && !NILP (sit_for (0, post_command_idle_delay, 0, 1, 1))) | ||
| 1458 | safe_run_hooks (Qpost_command_idle_hook); | ||
| 1459 | } | ||
| 1460 | } | 1445 | } |
| 1461 | 1446 | ||
| 1462 | Vmemory_full = Qnil; | 1447 | Vmemory_full = Qnil; |
| @@ -1822,16 +1807,6 @@ command_loop_1 () | |||
| 1822 | if (!NILP (Vdeferred_action_list)) | 1807 | if (!NILP (Vdeferred_action_list)) |
| 1823 | safe_run_hooks (Qdeferred_action_function); | 1808 | safe_run_hooks (Qdeferred_action_function); |
| 1824 | 1809 | ||
| 1825 | if (!NILP (Vpost_command_idle_hook) && !NILP (Vrun_hooks)) | ||
| 1826 | { | ||
| 1827 | if (NILP (Vunread_command_events) | ||
| 1828 | && NILP (Vunread_input_method_events) | ||
| 1829 | && NILP (Vunread_post_input_method_events) | ||
| 1830 | && NILP (Vexecuting_kbd_macro) | ||
| 1831 | && !NILP (sit_for (0, post_command_idle_delay, 0, 1, 1))) | ||
| 1832 | safe_run_hooks (Qpost_command_idle_hook); | ||
| 1833 | } | ||
| 1834 | |||
| 1835 | /* If there is a prefix argument, | 1810 | /* If there is a prefix argument, |
| 1836 | 1) We don't want Vlast_command to be ``universal-argument'' | 1811 | 1) We don't want Vlast_command to be ``universal-argument'' |
| 1837 | (that would be dumb), so don't set Vlast_command, | 1812 | (that would be dumb), so don't set Vlast_command, |
| @@ -1947,10 +1922,13 @@ adjust_point_for_property (last_pt, modified) | |||
| 1947 | ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil) | 1922 | ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil) |
| 1948 | : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)), | 1923 | : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)), |
| 1949 | end = OVERLAY_POSITION (OVERLAY_END (overlay)))) | 1924 | end = OVERLAY_POSITION (OVERLAY_END (overlay)))) |
| 1950 | && beg < PT) /* && end > PT <- It's always the case. */ | 1925 | && (beg < PT /* && end > PT <- It's always the case. */ |
| 1926 | || (beg <= PT && STRINGP (val) && SCHARS (val) == 0))) | ||
| 1951 | { | 1927 | { |
| 1952 | xassert (end > PT); | 1928 | xassert (end > PT); |
| 1953 | SET_PT (PT < last_pt ? beg : end); | 1929 | SET_PT (PT < last_pt |
| 1930 | ? (STRINGP (val) && SCHARS (val) == 0 ? beg - 1 : beg) | ||
| 1931 | : end); | ||
| 1954 | check_composition = check_invisible = 1; | 1932 | check_composition = check_invisible = 1; |
| 1955 | } | 1933 | } |
| 1956 | check_display = 0; | 1934 | check_display = 0; |
| @@ -3530,9 +3508,11 @@ readable_events (flags) | |||
| 3530 | READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */ | 3508 | READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */ |
| 3531 | if (kbd_fetch_ptr != kbd_store_ptr) | 3509 | if (kbd_fetch_ptr != kbd_store_ptr) |
| 3532 | { | 3510 | { |
| 3533 | int have_live_event = 1; | 3511 | if (flags & (READABLE_EVENTS_FILTER_EVENTS |
| 3534 | 3512 | #ifdef USE_TOOLKIT_SCROLL_BARS | |
| 3535 | if (flags & READABLE_EVENTS_FILTER_EVENTS) | 3513 | | READABLE_EVENTS_IGNORE_SQUEEZABLES |
| 3514 | #endif | ||
| 3515 | )) | ||
| 3536 | { | 3516 | { |
| 3537 | struct input_event *event; | 3517 | struct input_event *event; |
| 3538 | 3518 | ||
| @@ -3540,16 +3520,29 @@ readable_events (flags) | |||
| 3540 | ? kbd_fetch_ptr | 3520 | ? kbd_fetch_ptr |
| 3541 | : kbd_buffer); | 3521 | : kbd_buffer); |
| 3542 | 3522 | ||
| 3543 | while (have_live_event && event->kind == FOCUS_IN_EVENT) | 3523 | do |
| 3544 | { | 3524 | { |
| 3545 | event++; | 3525 | if (!( |
| 3526 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 3527 | (flags & READABLE_EVENTS_FILTER_EVENTS) && | ||
| 3528 | #endif | ||
| 3529 | event->kind == FOCUS_IN_EVENT) | ||
| 3530 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 3531 | && !((flags & READABLE_EVENTS_IGNORE_SQUEEZABLES) | ||
| 3532 | && event->kind == SCROLL_BAR_CLICK_EVENT | ||
| 3533 | && event->part == scroll_bar_handle | ||
| 3534 | && event->modifiers == 0) | ||
| 3535 | #endif | ||
| 3536 | ) | ||
| 3537 | return 1; | ||
| 3538 | event++; | ||
| 3546 | if (event == kbd_buffer + KBD_BUFFER_SIZE) | 3539 | if (event == kbd_buffer + KBD_BUFFER_SIZE) |
| 3547 | event = kbd_buffer; | 3540 | event = kbd_buffer; |
| 3548 | if (event == kbd_store_ptr) | 3541 | } |
| 3549 | have_live_event = 0; | 3542 | while (event != kbd_store_ptr); |
| 3550 | } | ||
| 3551 | } | 3543 | } |
| 3552 | if (have_live_event) return 1; | 3544 | else |
| 3545 | return 1; | ||
| 3553 | } | 3546 | } |
| 3554 | 3547 | ||
| 3555 | #ifdef HAVE_MOUSE | 3548 | #ifdef HAVE_MOUSE |
| @@ -6544,7 +6537,7 @@ lucid_event_type_list_p (object) | |||
| 6544 | If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal | 6537 | If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal |
| 6545 | events (FOCUS_IN_EVENT). | 6538 | events (FOCUS_IN_EVENT). |
| 6546 | If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse | 6539 | If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse |
| 6547 | movements. */ | 6540 | movements and toolkit scroll bar thumb drags. */ |
| 6548 | 6541 | ||
| 6549 | static void | 6542 | static void |
| 6550 | get_input_pending (addr, flags) | 6543 | get_input_pending (addr, flags) |
| @@ -10835,9 +10828,6 @@ syms_of_keyboard () | |||
| 10835 | Qpost_command_hook = intern ("post-command-hook"); | 10828 | Qpost_command_hook = intern ("post-command-hook"); |
| 10836 | staticpro (&Qpost_command_hook); | 10829 | staticpro (&Qpost_command_hook); |
| 10837 | 10830 | ||
| 10838 | Qpost_command_idle_hook = intern ("post-command-idle-hook"); | ||
| 10839 | staticpro (&Qpost_command_idle_hook); | ||
| 10840 | |||
| 10841 | Qdeferred_action_function = intern ("deferred-action-function"); | 10831 | Qdeferred_action_function = intern ("deferred-action-function"); |
| 10842 | staticpro (&Qdeferred_action_function); | 10832 | staticpro (&Qdeferred_action_function); |
| 10843 | 10833 | ||
| @@ -11283,16 +11273,6 @@ the hook value is set to nil, since otherwise the error | |||
| 11283 | might happen repeatedly and make Emacs nonfunctional. */); | 11273 | might happen repeatedly and make Emacs nonfunctional. */); |
| 11284 | Vpost_command_hook = Qnil; | 11274 | Vpost_command_hook = Qnil; |
| 11285 | 11275 | ||
| 11286 | DEFVAR_LISP ("post-command-idle-hook", &Vpost_command_idle_hook, | ||
| 11287 | doc: /* Normal hook run after each command is executed, if idle. | ||
| 11288 | Errors running the hook are caught and ignored. */); | ||
| 11289 | Vpost_command_idle_hook = Qnil; | ||
| 11290 | |||
| 11291 | DEFVAR_INT ("post-command-idle-delay", &post_command_idle_delay, | ||
| 11292 | doc: /* Delay time before running `post-command-idle-hook'. | ||
| 11293 | This is measured in microseconds. */); | ||
| 11294 | post_command_idle_delay = 100000; | ||
| 11295 | |||
| 11296 | #if 0 | 11276 | #if 0 |
| 11297 | DEFVAR_LISP ("echo-area-clear-hook", ..., | 11277 | DEFVAR_LISP ("echo-area-clear-hook", ..., |
| 11298 | doc: /* Normal hook run when clearing the echo area. */); | 11278 | doc: /* Normal hook run when clearing the echo area. */); |
| @@ -1672,37 +1672,7 @@ sys_fopen (const char *name, const char *mode) | |||
| 1672 | } | 1672 | } |
| 1673 | 1673 | ||
| 1674 | 1674 | ||
| 1675 | long target_ticks = 0; | 1675 | #include "keyboard.h" |
| 1676 | |||
| 1677 | #ifdef __MRC__ | ||
| 1678 | __sigfun alarm_signal_func = (__sigfun) 0; | ||
| 1679 | #elif __MWERKS__ | ||
| 1680 | __signal_func_ptr alarm_signal_func = (__signal_func_ptr) 0; | ||
| 1681 | #else /* not __MRC__ and not __MWERKS__ */ | ||
| 1682 | You lose!!! | ||
| 1683 | #endif /* not __MRC__ and not __MWERKS__ */ | ||
| 1684 | |||
| 1685 | |||
| 1686 | /* These functions simulate SIG_ALRM. The stub for function signal | ||
| 1687 | stores the signal handler function in alarm_signal_func if a | ||
| 1688 | SIG_ALRM is encountered. check_alarm is called in XTread_socket, | ||
| 1689 | which emacs calls periodically. A pending alarm is represented by | ||
| 1690 | a non-zero target_ticks value. check_alarm calls the handler | ||
| 1691 | function pointed to by alarm_signal_func if one has been set up and | ||
| 1692 | an alarm is pending. */ | ||
| 1693 | |||
| 1694 | void | ||
| 1695 | check_alarm () | ||
| 1696 | { | ||
| 1697 | if (target_ticks && TickCount () > target_ticks) | ||
| 1698 | { | ||
| 1699 | target_ticks = 0; | ||
| 1700 | if (alarm_signal_func) | ||
| 1701 | (*alarm_signal_func)(SIGALRM); | ||
| 1702 | } | ||
| 1703 | } | ||
| 1704 | |||
| 1705 | |||
| 1706 | extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); | 1676 | extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); |
| 1707 | 1677 | ||
| 1708 | int | 1678 | int |
| @@ -1713,25 +1683,17 @@ select (n, rfds, wfds, efds, timeout) | |||
| 1713 | SELECT_TYPE *efds; | 1683 | SELECT_TYPE *efds; |
| 1714 | struct timeval *timeout; | 1684 | struct timeval *timeout; |
| 1715 | { | 1685 | { |
| 1716 | #if TARGET_API_MAC_CARBON | ||
| 1717 | OSErr err; | 1686 | OSErr err; |
| 1687 | #if TARGET_API_MAC_CARBON | ||
| 1718 | EventTimeout timeout_sec = | 1688 | EventTimeout timeout_sec = |
| 1719 | (timeout | 1689 | (timeout |
| 1720 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | 1690 | ? (EMACS_SECS (*timeout) * kEventDurationSecond |
| 1721 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | 1691 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) |
| 1722 | : kEventDurationForever); | 1692 | : kEventDurationForever); |
| 1723 | 1693 | ||
| 1724 | if (FD_ISSET (0, rfds)) | 1694 | BLOCK_INPUT; |
| 1725 | { | 1695 | err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); |
| 1726 | BLOCK_INPUT; | 1696 | UNBLOCK_INPUT; |
| 1727 | err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); | ||
| 1728 | UNBLOCK_INPUT; | ||
| 1729 | if (err == noErr) | ||
| 1730 | return 1; | ||
| 1731 | else | ||
| 1732 | FD_ZERO (rfds); | ||
| 1733 | } | ||
| 1734 | return 0; | ||
| 1735 | #else /* not TARGET_API_MAC_CARBON */ | 1697 | #else /* not TARGET_API_MAC_CARBON */ |
| 1736 | EventRecord e; | 1698 | EventRecord e; |
| 1737 | UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + | 1699 | UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + |
| @@ -1746,47 +1708,62 @@ select (n, rfds, wfds, efds, timeout) | |||
| 1746 | read_avail_input which in turn calls XTread_socket to poll for | 1708 | read_avail_input which in turn calls XTread_socket to poll for |
| 1747 | these events. Otherwise these never get processed except but a | 1709 | these events. Otherwise these never get processed except but a |
| 1748 | very slow poll timer. */ | 1710 | very slow poll timer. */ |
| 1749 | if (FD_ISSET (0, rfds) && mac_wait_next_event (&e, sleep_time, false)) | 1711 | if (mac_wait_next_event (&e, sleep_time, false)) |
| 1750 | return 1; | 1712 | err = noErr; |
| 1751 | 1713 | else | |
| 1752 | return 0; | 1714 | err = -9875; /* eventLoopTimedOutErr */ |
| 1753 | #endif /* not TARGET_API_MAC_CARBON */ | 1715 | #endif /* not TARGET_API_MAC_CARBON */ |
| 1754 | } | ||
| 1755 | |||
| 1756 | |||
| 1757 | /* Called in sys_select to wait for an alarm signal to arrive. */ | ||
| 1758 | |||
| 1759 | int | ||
| 1760 | pause () | ||
| 1761 | { | ||
| 1762 | EventRecord e; | ||
| 1763 | unsigned long tick; | ||
| 1764 | |||
| 1765 | if (!target_ticks) /* no alarm pending */ | ||
| 1766 | return -1; | ||
| 1767 | 1716 | ||
| 1768 | if ((tick = TickCount ()) < target_ticks) | 1717 | if (FD_ISSET (0, rfds)) |
| 1769 | WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event; | 1718 | if (err == noErr) |
| 1770 | just wait. by T.I. */ | 1719 | return 1; |
| 1720 | else | ||
| 1721 | { | ||
| 1722 | FD_ZERO (rfds); | ||
| 1723 | return 0; | ||
| 1724 | } | ||
| 1725 | else | ||
| 1726 | if (err == noErr) | ||
| 1727 | { | ||
| 1728 | if (input_polling_used ()) | ||
| 1729 | { | ||
| 1730 | /* It could be confusing if a real alarm arrives while | ||
| 1731 | processing the fake one. Turn it off and let the | ||
| 1732 | handler reset it. */ | ||
| 1733 | extern void poll_for_input_1 P_ ((void)); | ||
| 1734 | int old_poll_suppress_count = poll_suppress_count; | ||
| 1735 | poll_suppress_count = 1; | ||
| 1736 | poll_for_input_1 (); | ||
| 1737 | poll_suppress_count = old_poll_suppress_count; | ||
| 1738 | } | ||
| 1739 | errno = EINTR; | ||
| 1740 | return -1; | ||
| 1741 | } | ||
| 1742 | else | ||
| 1743 | return 0; | ||
| 1744 | } | ||
| 1771 | 1745 | ||
| 1772 | target_ticks = 0; | ||
| 1773 | if (alarm_signal_func) | ||
| 1774 | (*alarm_signal_func)(SIGALRM); | ||
| 1775 | 1746 | ||
| 1776 | return 0; | 1747 | /* Simulation of SIGALRM. The stub for function signal stores the |
| 1777 | } | 1748 | signal handler function in alarm_signal_func if a SIGALRM is |
| 1749 | encountered. */ | ||
| 1778 | 1750 | ||
| 1751 | #include <signal.h> | ||
| 1752 | #include "syssignal.h" | ||
| 1779 | 1753 | ||
| 1780 | int | 1754 | static TMTask mac_atimer_task; |
| 1781 | alarm (int seconds) | ||
| 1782 | { | ||
| 1783 | long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0; | ||
| 1784 | 1755 | ||
| 1785 | target_ticks = seconds ? TickCount () + 60 * seconds : 0; | 1756 | static QElemPtr mac_atimer_qlink = (QElemPtr) &mac_atimer_task; |
| 1786 | 1757 | ||
| 1787 | return (remaining < 0) ? 0 : (unsigned int) remaining; | 1758 | static int signal_mask = 0; |
| 1788 | } | ||
| 1789 | 1759 | ||
| 1760 | #ifdef __MRC__ | ||
| 1761 | __sigfun alarm_signal_func = (__sigfun) 0; | ||
| 1762 | #elif __MWERKS__ | ||
| 1763 | __signal_func_ptr alarm_signal_func = (__signal_func_ptr) 0; | ||
| 1764 | #else /* not __MRC__ and not __MWERKS__ */ | ||
| 1765 | You lose!!! | ||
| 1766 | #endif /* not __MRC__ and not __MWERKS__ */ | ||
| 1790 | 1767 | ||
| 1791 | #undef signal | 1768 | #undef signal |
| 1792 | #ifdef __MRC__ | 1769 | #ifdef __MRC__ |
| @@ -1819,6 +1796,128 @@ sys_signal (int signal_num, __signal_func_ptr signal_func) | |||
| 1819 | } | 1796 | } |
| 1820 | 1797 | ||
| 1821 | 1798 | ||
| 1799 | static pascal void | ||
| 1800 | mac_atimer_handler (qlink) | ||
| 1801 | TMTaskPtr qlink; | ||
| 1802 | { | ||
| 1803 | if (alarm_signal_func) | ||
| 1804 | (alarm_signal_func) (SIGALRM); | ||
| 1805 | } | ||
| 1806 | |||
| 1807 | |||
| 1808 | static void | ||
| 1809 | set_mac_atimer (count) | ||
| 1810 | long count; | ||
| 1811 | { | ||
| 1812 | static TimerUPP mac_atimer_handlerUPP = NULL; | ||
| 1813 | |||
| 1814 | if (mac_atimer_handlerUPP == NULL) | ||
| 1815 | mac_atimer_handlerUPP = NewTimerUPP (mac_atimer_handler); | ||
| 1816 | mac_atimer_task.tmCount = 0; | ||
| 1817 | mac_atimer_task.tmAddr = mac_atimer_handlerUPP; | ||
| 1818 | mac_atimer_qlink = (QElemPtr) &mac_atimer_task; | ||
| 1819 | InsTime (mac_atimer_qlink); | ||
| 1820 | if (count) | ||
| 1821 | PrimeTime (mac_atimer_qlink, count); | ||
| 1822 | } | ||
| 1823 | |||
| 1824 | |||
| 1825 | int | ||
| 1826 | remove_mac_atimer (remaining_count) | ||
| 1827 | long *remaining_count; | ||
| 1828 | { | ||
| 1829 | if (mac_atimer_qlink) | ||
| 1830 | { | ||
| 1831 | RmvTime (mac_atimer_qlink); | ||
| 1832 | if (remaining_count) | ||
| 1833 | *remaining_count = mac_atimer_task.tmCount; | ||
| 1834 | mac_atimer_qlink = NULL; | ||
| 1835 | |||
| 1836 | return 0; | ||
| 1837 | } | ||
| 1838 | else | ||
| 1839 | return -1; | ||
| 1840 | } | ||
| 1841 | |||
| 1842 | |||
| 1843 | int | ||
| 1844 | sigblock (int mask) | ||
| 1845 | { | ||
| 1846 | int old_mask = signal_mask; | ||
| 1847 | |||
| 1848 | signal_mask |= mask; | ||
| 1849 | |||
| 1850 | if ((old_mask ^ signal_mask) & sigmask (SIGALRM)) | ||
| 1851 | remove_mac_atimer (NULL); | ||
| 1852 | |||
| 1853 | return old_mask; | ||
| 1854 | } | ||
| 1855 | |||
| 1856 | |||
| 1857 | int | ||
| 1858 | sigsetmask (int mask) | ||
| 1859 | { | ||
| 1860 | int old_mask = signal_mask; | ||
| 1861 | |||
| 1862 | signal_mask = mask; | ||
| 1863 | |||
| 1864 | if ((old_mask ^ signal_mask) & sigmask (SIGALRM)) | ||
| 1865 | if (signal_mask & sigmask (SIGALRM)) | ||
| 1866 | remove_mac_atimer (NULL); | ||
| 1867 | else | ||
| 1868 | set_mac_atimer (mac_atimer_task.tmCount); | ||
| 1869 | |||
| 1870 | return old_mask; | ||
| 1871 | } | ||
| 1872 | |||
| 1873 | |||
| 1874 | int | ||
| 1875 | alarm (int seconds) | ||
| 1876 | { | ||
| 1877 | long remaining_count; | ||
| 1878 | |||
| 1879 | if (remove_mac_atimer (&remaining_count) == 0) | ||
| 1880 | { | ||
| 1881 | set_mac_atimer (seconds * 1000); | ||
| 1882 | |||
| 1883 | return remaining_count / 1000; | ||
| 1884 | } | ||
| 1885 | else | ||
| 1886 | { | ||
| 1887 | mac_atimer_task.tmCount = seconds * 1000; | ||
| 1888 | |||
| 1889 | return 0; | ||
| 1890 | } | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | |||
| 1894 | int | ||
| 1895 | setitimer (which, value, ovalue) | ||
| 1896 | int which; | ||
| 1897 | const struct itimerval *value; | ||
| 1898 | struct itimerval *ovalue; | ||
| 1899 | { | ||
| 1900 | long remaining_count; | ||
| 1901 | long count = (EMACS_SECS (value->it_value) * 1000 | ||
| 1902 | + (EMACS_USECS (value->it_value) + 999) / 1000); | ||
| 1903 | |||
| 1904 | if (remove_mac_atimer (&remaining_count) == 0) | ||
| 1905 | { | ||
| 1906 | if (ovalue) | ||
| 1907 | { | ||
| 1908 | bzero (ovalue, sizeof (*ovalue)); | ||
| 1909 | EMACS_SET_SECS_USECS (ovalue->it_value, remaining_count / 1000, | ||
| 1910 | (remaining_count % 1000) * 1000); | ||
| 1911 | } | ||
| 1912 | set_mac_atimer (count); | ||
| 1913 | } | ||
| 1914 | else | ||
| 1915 | mac_atimer_task.tmCount = count; | ||
| 1916 | |||
| 1917 | return 0; | ||
| 1918 | } | ||
| 1919 | |||
| 1920 | |||
| 1822 | /* gettimeofday should return the amount of time (in a timeval | 1921 | /* gettimeofday should return the amount of time (in a timeval |
| 1823 | structure) since midnight today. The toolbox function Microseconds | 1922 | structure) since midnight today. The toolbox function Microseconds |
| 1824 | returns the number of microseconds (in a UnsignedWide value) since | 1923 | returns the number of microseconds (in a UnsignedWide value) since |
| @@ -1946,35 +2045,6 @@ sys_time (time_t *timer) | |||
| 1946 | } | 2045 | } |
| 1947 | 2046 | ||
| 1948 | 2047 | ||
| 1949 | /* MPW strftime broken for "%p" format */ | ||
| 1950 | #ifdef __MRC__ | ||
| 1951 | #undef strftime | ||
| 1952 | #include <time.h> | ||
| 1953 | size_t | ||
| 1954 | sys_strftime (char * s, size_t maxsize, const char * format, | ||
| 1955 | const struct tm * timeptr) | ||
| 1956 | { | ||
| 1957 | if (strcmp (format, "%p") == 0) | ||
| 1958 | { | ||
| 1959 | if (maxsize < 3) | ||
| 1960 | return 0; | ||
| 1961 | if (timeptr->tm_hour < 12) | ||
| 1962 | { | ||
| 1963 | strcpy (s, "AM"); | ||
| 1964 | return 2; | ||
| 1965 | } | ||
| 1966 | else | ||
| 1967 | { | ||
| 1968 | strcpy (s, "PM"); | ||
| 1969 | return 2; | ||
| 1970 | } | ||
| 1971 | } | ||
| 1972 | else | ||
| 1973 | return strftime (s, maxsize, format, timeptr); | ||
| 1974 | } | ||
| 1975 | #endif /* __MRC__ */ | ||
| 1976 | |||
| 1977 | |||
| 1978 | /* no subprocesses, empty wait */ | 2048 | /* no subprocesses, empty wait */ |
| 1979 | 2049 | ||
| 1980 | int | 2050 | int |
| @@ -1993,13 +2063,6 @@ croak (char *badfunc) | |||
| 1993 | 2063 | ||
| 1994 | 2064 | ||
| 1995 | char * | 2065 | char * |
| 1996 | index (const char * str, int chr) | ||
| 1997 | { | ||
| 1998 | return strchr (str, chr); | ||
| 1999 | } | ||
| 2000 | |||
| 2001 | |||
| 2002 | char * | ||
| 2003 | mktemp (char *template) | 2066 | mktemp (char *template) |
| 2004 | { | 2067 | { |
| 2005 | int len, k; | 2068 | int len, k; |
| @@ -2187,20 +2250,6 @@ sys_subshell () | |||
| 2187 | } | 2250 | } |
| 2188 | 2251 | ||
| 2189 | 2252 | ||
| 2190 | int | ||
| 2191 | sigsetmask (int x) | ||
| 2192 | { | ||
| 2193 | return 0; | ||
| 2194 | } | ||
| 2195 | |||
| 2196 | |||
| 2197 | int | ||
| 2198 | sigblock (int mask) | ||
| 2199 | { | ||
| 2200 | return 0; | ||
| 2201 | } | ||
| 2202 | |||
| 2203 | |||
| 2204 | void | 2253 | void |
| 2205 | request_sigio (void) | 2254 | request_sigio (void) |
| 2206 | { | 2255 | { |
diff --git a/src/macfns.c b/src/macfns.c index 75cd7e76576..8ec05b59e19 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -22,7 +22,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | 24 | ||
| 25 | #include <signal.h> | ||
| 26 | #include <stdio.h> | 25 | #include <stdio.h> |
| 27 | #include <math.h> | 26 | #include <math.h> |
| 28 | #include <limits.h> | 27 | #include <limits.h> |
diff --git a/src/macmenu.c b/src/macmenu.c index 35615cc3796..eb870176f12 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 21 | /* Contributed by Andrew Choi (akochoi@mac.com). */ | 21 | /* Contributed by Andrew Choi (akochoi@mac.com). */ |
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <signal.h> | ||
| 25 | 24 | ||
| 26 | #include <stdio.h> | 25 | #include <stdio.h> |
| 27 | #include "lisp.h" | 26 | #include "lisp.h" |
diff --git a/src/macselect.c b/src/macselect.c index a115c9b3229..890bb62d1d4 100644 --- a/src/macselect.c +++ b/src/macselect.c | |||
| @@ -1104,9 +1104,11 @@ next communication only. After the communication, this variable is | |||
| 1104 | set to nil. */); | 1104 | set to nil. */); |
| 1105 | Vnext_selection_coding_system = Qnil; | 1105 | Vnext_selection_coding_system = Qnil; |
| 1106 | 1106 | ||
| 1107 | #ifdef MAC_OSX | ||
| 1107 | DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection, | 1108 | DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection, |
| 1108 | doc: /* Selection name for communication via Services menu. */); | 1109 | doc: /* Selection name for communication via Services menu. */); |
| 1109 | Vmac_services_selection = intern ("CLIPBOARD"); | 1110 | Vmac_services_selection = intern ("PRIMARY"); |
| 1111 | #endif | ||
| 1110 | 1112 | ||
| 1111 | QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); | 1113 | QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); |
| 1112 | QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); | 1114 | QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); |
diff --git a/src/macterm.c b/src/macterm.c index b988fb25c31..fe80b779cf3 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -3277,11 +3277,9 @@ x_clear_frame () | |||
| 3277 | BLOCK_INPUT; | 3277 | BLOCK_INPUT; |
| 3278 | XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); | 3278 | XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); |
| 3279 | 3279 | ||
| 3280 | #if 0 /* Clearing frame on Mac OS clears scroll bars. */ | ||
| 3281 | /* We have to clear the scroll bars, too. If we have changed | 3280 | /* We have to clear the scroll bars, too. If we have changed |
| 3282 | colors or something like that, then they should be notified. */ | 3281 | colors or something like that, then they should be notified. */ |
| 3283 | x_scroll_bar_clear (f); | 3282 | x_scroll_bar_clear (f); |
| 3284 | #endif | ||
| 3285 | 3283 | ||
| 3286 | XFlush (FRAME_MAC_DISPLAY (f)); | 3284 | XFlush (FRAME_MAC_DISPLAY (f)); |
| 3287 | UNBLOCK_INPUT; | 3285 | UNBLOCK_INPUT; |
| @@ -4141,12 +4139,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 4141 | static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *)); | 4139 | static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *)); |
| 4142 | static OSStatus install_scroll_bar_timer P_ ((void)); | 4140 | static OSStatus install_scroll_bar_timer P_ ((void)); |
| 4143 | static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); | 4141 | static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); |
| 4144 | static int control_part_code_to_scroll_bar_part P_((ControlPartCode)); | 4142 | static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); |
| 4145 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, | 4143 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, |
| 4146 | unsigned long, | 4144 | unsigned long, |
| 4147 | struct input_event *)); | 4145 | struct input_event *)); |
| 4148 | static OSErr get_control_part_bound P_((ControlHandle, ControlPartCode, | 4146 | static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode, |
| 4149 | Rect *)); | 4147 | Rect *)); |
| 4150 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, | 4148 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, |
| 4151 | ControlPartCode, | 4149 | ControlPartCode, |
| 4152 | unsigned long, | 4150 | unsigned long, |
| @@ -4273,7 +4271,7 @@ construct_scroll_bar_click (bar, part, timestamp, bufp) | |||
| 4273 | } | 4271 | } |
| 4274 | 4272 | ||
| 4275 | static OSErr | 4273 | static OSErr |
| 4276 | get_control_part_bound (ch, part_code, rect) | 4274 | get_control_part_bounds (ch, part_code, rect) |
| 4277 | ControlHandle ch; | 4275 | ControlHandle ch; |
| 4278 | ControlPartCode part_code; | 4276 | ControlPartCode part_code; |
| 4279 | Rect *rect; | 4277 | Rect *rect; |
| @@ -4346,8 +4344,8 @@ x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp) | |||
| 4346 | int top, top_range; | 4344 | int top, top_range; |
| 4347 | Rect r; | 4345 | Rect r; |
| 4348 | 4346 | ||
| 4349 | get_control_part_bound (SCROLL_BAR_CONTROL_HANDLE (bar), | 4347 | get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), |
| 4350 | kControlIndicatorPart, &r); | 4348 | kControlIndicatorPart, &r); |
| 4351 | 4349 | ||
| 4352 | if (GC_NILP (bar->dragging)) | 4350 | if (GC_NILP (bar->dragging)) |
| 4353 | XSETINT (bar->dragging, mouse_pos.v - r.top); | 4351 | XSETINT (bar->dragging, mouse_pos.v - r.top); |
| @@ -4675,13 +4673,11 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 4675 | BLOCK_INPUT; | 4673 | BLOCK_INPUT; |
| 4676 | 4674 | ||
| 4677 | /* If already correctly positioned, do nothing. */ | 4675 | /* If already correctly positioned, do nothing. */ |
| 4678 | if (XINT (bar->left) == sb_left | 4676 | if (!(XINT (bar->left) == sb_left |
| 4679 | && XINT (bar->top) == top | 4677 | && XINT (bar->top) == top |
| 4680 | && XINT (bar->width) == sb_width | 4678 | && XINT (bar->width) == sb_width |
| 4681 | && XINT (bar->height) == height) | 4679 | && XINT (bar->height) == height)) |
| 4682 | Draw1Control (ch); | 4680 | { |
| 4683 | else | ||
| 4684 | { | ||
| 4685 | /* Clear areas not covered by the scroll bar because it's not as | 4681 | /* Clear areas not covered by the scroll bar because it's not as |
| 4686 | wide as the area reserved for it . This makes sure a | 4682 | wide as the area reserved for it . This makes sure a |
| 4687 | previous mode line display is cleared after C-x 2 C-x 1, for | 4683 | previous mode line display is cleared after C-x 2 C-x 1, for |
| @@ -4730,11 +4726,11 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 4730 | 4726 | ||
| 4731 | /* Move the scroll bar thumb to the top. */ | 4727 | /* Move the scroll bar thumb to the top. */ |
| 4732 | SetControl32BitValue (ch, 0); | 4728 | SetControl32BitValue (ch, 0); |
| 4733 | get_control_part_bound (ch, kControlIndicatorPart, &r0); | 4729 | get_control_part_bounds (ch, kControlIndicatorPart, &r0); |
| 4734 | 4730 | ||
| 4735 | /* Move the scroll bar thumb to the bottom. */ | 4731 | /* Move the scroll bar thumb to the bottom. */ |
| 4736 | SetControl32BitValue (ch, 1); | 4732 | SetControl32BitValue (ch, 1); |
| 4737 | get_control_part_bound (ch, kControlIndicatorPart, &r1); | 4733 | get_control_part_bounds (ch, kControlIndicatorPart, &r1); |
| 4738 | 4734 | ||
| 4739 | UnionRect (&r0, &r1, &r0); | 4735 | UnionRect (&r0, &r1, &r0); |
| 4740 | XSETINT (bar->track_top, r0.top); | 4736 | XSETINT (bar->track_top, r0.top); |
| @@ -4882,7 +4878,7 @@ XTjudge_scroll_bars (f) | |||
| 4882 | static void | 4878 | static void |
| 4883 | x_scroll_bar_handle_click (bar, part_code, er, bufp) | 4879 | x_scroll_bar_handle_click (bar, part_code, er, bufp) |
| 4884 | struct scroll_bar *bar; | 4880 | struct scroll_bar *bar; |
| 4885 | int part_code; | 4881 | ControlPartCode part_code; |
| 4886 | EventRecord *er; | 4882 | EventRecord *er; |
| 4887 | struct input_event *bufp; | 4883 | struct input_event *bufp; |
| 4888 | { | 4884 | { |
| @@ -5040,6 +5036,21 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5040 | 5036 | ||
| 5041 | *time = last_mouse_movement_time; | 5037 | *time = last_mouse_movement_time; |
| 5042 | } | 5038 | } |
| 5039 | |||
| 5040 | |||
| 5041 | /* The screen has been cleared so we may have changed foreground or | ||
| 5042 | background colors, and the scroll bars may need to be redrawn. | ||
| 5043 | Clear out the scroll bars, and ask for expose events, so we can | ||
| 5044 | redraw them. */ | ||
| 5045 | |||
| 5046 | void | ||
| 5047 | x_scroll_bar_clear (f) | ||
| 5048 | FRAME_PTR f; | ||
| 5049 | { | ||
| 5050 | XTcondemn_scroll_bars (f); | ||
| 5051 | XTjudge_scroll_bars (f); | ||
| 5052 | } | ||
| 5053 | |||
| 5043 | 5054 | ||
| 5044 | /*********************************************************************** | 5055 | /*********************************************************************** |
| 5045 | Text Cursor | 5056 | Text Cursor |
| @@ -7516,7 +7527,6 @@ OSErr install_window_handler (WindowPtr); | |||
| 7516 | 7527 | ||
| 7517 | extern void init_emacs_passwd_dir (); | 7528 | extern void init_emacs_passwd_dir (); |
| 7518 | extern int emacs_main (int, char **, char **); | 7529 | extern int emacs_main (int, char **, char **); |
| 7519 | extern void check_alarm (); | ||
| 7520 | 7530 | ||
| 7521 | extern void initialize_applescript(); | 7531 | extern void initialize_applescript(); |
| 7522 | extern void terminate_applescript(); | 7532 | extern void terminate_applescript(); |
| @@ -8668,23 +8678,18 @@ profiler_exit_proc () | |||
| 8668 | #endif | 8678 | #endif |
| 8669 | 8679 | ||
| 8670 | /* These few functions implement Emacs as a normal Mac application | 8680 | /* These few functions implement Emacs as a normal Mac application |
| 8671 | (almost): set up the heap and the Toolbox, handle necessary | 8681 | (almost): set up the heap and the Toolbox, handle necessary system |
| 8672 | system events plus a few simple menu events. They also set up | 8682 | events plus a few simple menu events. They also set up Emacs's |
| 8673 | Emacs's access to functions defined in the rest of this file. | 8683 | access to functions defined in the rest of this file. Emacs uses |
| 8674 | Emacs uses function hooks to perform all its terminal I/O. A | 8684 | function hooks to perform all its terminal I/O. A complete list of |
| 8675 | complete list of these functions appear in termhooks.h. For what | 8685 | these functions appear in termhooks.h. For what they do, read the |
| 8676 | they do, read the comments there and see also w32term.c and | 8686 | comments there and see also w32term.c and xterm.c. What's |
| 8677 | xterm.c. What's noticeably missing here is the event loop, which | 8687 | noticeably missing here is the event loop, which is normally |
| 8678 | is normally present in most Mac application. After performing the | 8688 | present in most Mac application. After performing the necessary |
| 8679 | necessary Mac initializations, main passes off control to | 8689 | Mac initializations, main passes off control to emacs_main |
| 8680 | emacs_main (corresponding to main in emacs.c). Emacs_main calls | 8690 | (corresponding to main in emacs.c). Emacs_main calls XTread_socket |
| 8681 | mac_read_socket (defined further below) to read input. This is | 8691 | (defined further below) to read input. This is where |
| 8682 | where WaitNextEvent is called to process Mac events. This is also | 8692 | WaitNextEvent/ReceiveNextEvent is called to process Mac events. */ |
| 8683 | where check_alarm in sysdep.c is called to simulate alarm signals. | ||
| 8684 | This makes the cursor jump back to its correct position after | ||
| 8685 | briefly jumping to that of the matching parenthesis, print useful | ||
| 8686 | hints and prompts in the minibuffer after the user stops typing for | ||
| 8687 | a wait, etc. */ | ||
| 8688 | 8693 | ||
| 8689 | #ifdef MAC_OS8 | 8694 | #ifdef MAC_OS8 |
| 8690 | #undef main | 8695 | #undef main |
| @@ -8947,7 +8952,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8947 | case mouseUp: | 8952 | case mouseUp: |
| 8948 | { | 8953 | { |
| 8949 | WindowPtr window_ptr; | 8954 | WindowPtr window_ptr; |
| 8950 | SInt16 part_code; | 8955 | ControlPartCode part_code; |
| 8951 | int tool_bar_p = 0; | 8956 | int tool_bar_p = 0; |
| 8952 | 8957 | ||
| 8953 | #if USE_CARBON_EVENTS | 8958 | #if USE_CARBON_EVENTS |
| @@ -8991,7 +8996,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8991 | SelectWindow (window_ptr); | 8996 | SelectWindow (window_ptr); |
| 8992 | else | 8997 | else |
| 8993 | { | 8998 | { |
| 8994 | SInt16 control_part_code; | 8999 | ControlPartCode control_part_code; |
| 8995 | ControlHandle ch; | 9000 | ControlHandle ch; |
| 8996 | Point mouse_loc = er.where; | 9001 | Point mouse_loc = er.where; |
| 8997 | #ifdef MAC_OSX | 9002 | #ifdef MAC_OSX |
| @@ -9566,10 +9571,6 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9566 | pending_autoraise_frame = 0; | 9571 | pending_autoraise_frame = 0; |
| 9567 | } | 9572 | } |
| 9568 | 9573 | ||
| 9569 | #if !TARGET_API_MAC_CARBON | ||
| 9570 | check_alarm (); /* simulate the handling of a SIGALRM */ | ||
| 9571 | #endif | ||
| 9572 | |||
| 9573 | UNBLOCK_INPUT; | 9574 | UNBLOCK_INPUT; |
| 9574 | return count; | 9575 | return count; |
| 9575 | } | 9576 | } |
diff --git a/src/process.c b/src/process.c index 26d40c26cd5..84d373ff37b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5113,6 +5113,7 @@ send_process_trap () | |||
| 5113 | sigrelse (SIGPIPE); | 5113 | sigrelse (SIGPIPE); |
| 5114 | sigrelse (SIGALRM); | 5114 | sigrelse (SIGALRM); |
| 5115 | #endif /* BSD4_1 */ | 5115 | #endif /* BSD4_1 */ |
| 5116 | sigunblock (sigmask (SIGPIPE)); | ||
| 5116 | longjmp (send_process_frame, 1); | 5117 | longjmp (send_process_frame, 1); |
| 5117 | } | 5118 | } |
| 5118 | 5119 | ||
| @@ -5297,7 +5298,11 @@ send_process (proc, buf, len, object) | |||
| 5297 | 0, datagram_address[outfd].sa, | 5298 | 0, datagram_address[outfd].sa, |
| 5298 | datagram_address[outfd].len); | 5299 | datagram_address[outfd].len); |
| 5299 | if (rv < 0 && errno == EMSGSIZE) | 5300 | if (rv < 0 && errno == EMSGSIZE) |
| 5300 | report_file_error ("sending datagram", Fcons (proc, Qnil)); | 5301 | { |
| 5302 | signal (SIGPIPE, old_sigpipe); | ||
| 5303 | report_file_error ("sending datagram", | ||
| 5304 | Fcons (proc, Qnil)); | ||
| 5305 | } | ||
| 5301 | } | 5306 | } |
| 5302 | else | 5307 | else |
| 5303 | #endif | 5308 | #endif |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 1f2b4c96620..e54dbea448c 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Dump Emacs in Mach-O format for use on Mac OS X. | 1 | /* Dump Emacs in Mach-O format for use on Mac OS X. |
| 2 | Copyright (C) 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -105,6 +105,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 105 | #include <objc/malloc.h> | 105 | #include <objc/malloc.h> |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | #include <assert.h> | ||
| 109 | |||
| 108 | 110 | ||
| 109 | #define VERBOSE 1 | 111 | #define VERBOSE 1 |
| 110 | 112 | ||
| @@ -998,6 +1000,23 @@ unexec_init_emacs_zone () | |||
| 998 | malloc_set_zone_name (emacs_zone, "EmacsZone"); | 1000 | malloc_set_zone_name (emacs_zone, "EmacsZone"); |
| 999 | } | 1001 | } |
| 1000 | 1002 | ||
| 1003 | #ifndef MACOSX_MALLOC_MULT16 | ||
| 1004 | #define MACOSX_MALLOC_MULT16 1 | ||
| 1005 | #endif | ||
| 1006 | |||
| 1007 | typedef struct unexec_malloc_header { | ||
| 1008 | union { | ||
| 1009 | char c[8]; | ||
| 1010 | size_t size; | ||
| 1011 | } u; | ||
| 1012 | } unexec_malloc_header_t; | ||
| 1013 | |||
| 1014 | #if MACOSX_MALLOC_MULT16 | ||
| 1015 | |||
| 1016 | #define ptr_in_unexec_regions(p) ((((vm_address_t) (p)) & 8) != 0) | ||
| 1017 | |||
| 1018 | #else | ||
| 1019 | |||
| 1001 | int | 1020 | int |
| 1002 | ptr_in_unexec_regions (void *ptr) | 1021 | ptr_in_unexec_regions (void *ptr) |
| 1003 | { | 1022 | { |
| @@ -1011,36 +1030,75 @@ ptr_in_unexec_regions (void *ptr) | |||
| 1011 | return 0; | 1030 | return 0; |
| 1012 | } | 1031 | } |
| 1013 | 1032 | ||
| 1033 | #endif | ||
| 1034 | |||
| 1014 | void * | 1035 | void * |
| 1015 | unexec_malloc (size_t size) | 1036 | unexec_malloc (size_t size) |
| 1016 | { | 1037 | { |
| 1017 | if (in_dumped_exec) | 1038 | if (in_dumped_exec) |
| 1018 | return malloc (size); | 1039 | { |
| 1040 | void *p; | ||
| 1041 | |||
| 1042 | p = malloc (size); | ||
| 1043 | #if MACOSX_MALLOC_MULT16 | ||
| 1044 | assert (((vm_address_t) p % 16) == 0); | ||
| 1045 | #endif | ||
| 1046 | return p; | ||
| 1047 | } | ||
| 1019 | else | 1048 | else |
| 1020 | return malloc_zone_malloc (emacs_zone, size); | 1049 | { |
| 1050 | unexec_malloc_header_t *ptr; | ||
| 1051 | |||
| 1052 | ptr = (unexec_malloc_header_t *) | ||
| 1053 | malloc_zone_malloc (emacs_zone, size + sizeof (unexec_malloc_header_t)); | ||
| 1054 | ptr->u.size = size; | ||
| 1055 | ptr++; | ||
| 1056 | #if MACOSX_MALLOC_MULT16 | ||
| 1057 | assert (((vm_address_t) ptr % 16) == 8); | ||
| 1058 | #endif | ||
| 1059 | return (void *) ptr; | ||
| 1060 | } | ||
| 1021 | } | 1061 | } |
| 1022 | 1062 | ||
| 1023 | void * | 1063 | void * |
| 1024 | unexec_realloc (void *old_ptr, size_t new_size) | 1064 | unexec_realloc (void *old_ptr, size_t new_size) |
| 1025 | { | 1065 | { |
| 1026 | if (in_dumped_exec) | 1066 | if (in_dumped_exec) |
| 1027 | if (ptr_in_unexec_regions (old_ptr)) | 1067 | { |
| 1028 | { | 1068 | void *p; |
| 1029 | char *p = malloc (new_size); | 1069 | |
| 1030 | /* 2002-04-15 T. Ikegami <ikegami@adam.uprr.pr>. The original | 1070 | if (ptr_in_unexec_regions (old_ptr)) |
| 1031 | code to get size failed to reallocate read_buffer | 1071 | { |
| 1032 | (lread.c). */ | 1072 | size_t old_size = ((unexec_malloc_header_t *) old_ptr)[-1].u.size; |
| 1033 | int old_size = malloc_default_zone()->size (emacs_zone, old_ptr); | 1073 | size_t size = new_size > old_size ? old_size : new_size; |
| 1034 | int size = new_size > old_size ? old_size : new_size; | 1074 | |
| 1035 | 1075 | p = (size_t *) malloc (new_size); | |
| 1036 | if (size) | 1076 | if (size) |
| 1037 | memcpy (p, old_ptr, size); | 1077 | memcpy (p, old_ptr, size); |
| 1038 | return p; | 1078 | } |
| 1039 | } | 1079 | else |
| 1040 | else | 1080 | { |
| 1041 | return realloc (old_ptr, new_size); | 1081 | p = realloc (old_ptr, new_size); |
| 1082 | } | ||
| 1083 | #if MACOSX_MALLOC_MULT16 | ||
| 1084 | assert (((vm_address_t) p % 16) == 0); | ||
| 1085 | #endif | ||
| 1086 | return p; | ||
| 1087 | } | ||
| 1042 | else | 1088 | else |
| 1043 | return malloc_zone_realloc (emacs_zone, old_ptr, new_size); | 1089 | { |
| 1090 | unexec_malloc_header_t *ptr; | ||
| 1091 | |||
| 1092 | ptr = (unexec_malloc_header_t *) | ||
| 1093 | malloc_zone_realloc (emacs_zone, (unexec_malloc_header_t *) old_ptr - 1, | ||
| 1094 | new_size + sizeof (unexec_malloc_header_t)); | ||
| 1095 | ptr->u.size = new_size; | ||
| 1096 | ptr++; | ||
| 1097 | #if MACOSX_MALLOC_MULT16 | ||
| 1098 | assert (((vm_address_t) ptr % 16) == 8); | ||
| 1099 | #endif | ||
| 1100 | return (void *) ptr; | ||
| 1101 | } | ||
| 1044 | } | 1102 | } |
| 1045 | 1103 | ||
| 1046 | void | 1104 | void |
| @@ -1052,7 +1110,7 @@ unexec_free (void *ptr) | |||
| 1052 | free (ptr); | 1110 | free (ptr); |
| 1053 | } | 1111 | } |
| 1054 | else | 1112 | else |
| 1055 | malloc_zone_free (emacs_zone, ptr); | 1113 | malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1); |
| 1056 | } | 1114 | } |
| 1057 | 1115 | ||
| 1058 | /* arch-tag: 1a784f7b-a184-4c4f-9544-da8619593d72 | 1116 | /* arch-tag: 1a784f7b-a184-4c4f-9544-da8619593d72 |
diff --git a/src/xdisp.c b/src/xdisp.c index 23898e78774..2284c34d3bd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3474,7 +3474,10 @@ handle_display_prop (it) | |||
| 3474 | } | 3474 | } |
| 3475 | else | 3475 | else |
| 3476 | { | 3476 | { |
| 3477 | if (handle_single_display_spec (it, prop, object, position, 0)) | 3477 | int ret = handle_single_display_spec (it, prop, object, position, 0); |
| 3478 | if (ret < 0) /* Replaced by "", i.e. nothing. */ | ||
| 3479 | return HANDLED_RECOMPUTE_PROPS; | ||
| 3480 | if (ret) | ||
| 3478 | display_replaced_p = 1; | 3481 | display_replaced_p = 1; |
| 3479 | } | 3482 | } |
| 3480 | 3483 | ||
| @@ -3518,7 +3521,8 @@ display_prop_end (it, object, start_pos) | |||
| 3518 | property ends. | 3521 | property ends. |
| 3519 | 3522 | ||
| 3520 | Value is non-zero if something was found which replaces the display | 3523 | Value is non-zero if something was found which replaces the display |
| 3521 | of buffer or string text. */ | 3524 | of buffer or string text. Specifically, the value is -1 if that |
| 3525 | "something" is "nothing". */ | ||
| 3522 | 3526 | ||
| 3523 | static int | 3527 | static int |
| 3524 | handle_single_display_spec (it, spec, object, position, | 3528 | handle_single_display_spec (it, spec, object, position, |
| @@ -3833,6 +3837,11 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3833 | 3837 | ||
| 3834 | if (STRINGP (value)) | 3838 | if (STRINGP (value)) |
| 3835 | { | 3839 | { |
| 3840 | if (SCHARS (value) == 0) | ||
| 3841 | { | ||
| 3842 | pop_it (it); | ||
| 3843 | return -1; /* Replaced by "", i.e. nothing. */ | ||
| 3844 | } | ||
| 3836 | it->string = value; | 3845 | it->string = value; |
| 3837 | it->multibyte_p = STRING_MULTIBYTE (it->string); | 3846 | it->multibyte_p = STRING_MULTIBYTE (it->string); |
| 3838 | it->current.overlay_string_index = -1; | 3847 | it->current.overlay_string_index = -1; |
| @@ -7033,7 +7042,9 @@ message2_nolog (m, nbytes, multibyte) | |||
| 7033 | /* Display an echo area message M with a specified length of NBYTES | 7042 | /* Display an echo area message M with a specified length of NBYTES |
| 7034 | bytes. The string may include null characters. If M is not a | 7043 | bytes. The string may include null characters. If M is not a |
| 7035 | string, clear out any existing message, and let the mini-buffer | 7044 | string, clear out any existing message, and let the mini-buffer |
| 7036 | text show through. */ | 7045 | text show through. |
| 7046 | |||
| 7047 | This function cancels echoing. */ | ||
| 7037 | 7048 | ||
| 7038 | void | 7049 | void |
| 7039 | message3 (m, nbytes, multibyte) | 7050 | message3 (m, nbytes, multibyte) |
| @@ -7045,6 +7056,7 @@ message3 (m, nbytes, multibyte) | |||
| 7045 | 7056 | ||
| 7046 | GCPRO1 (m); | 7057 | GCPRO1 (m); |
| 7047 | clear_message (1,1); | 7058 | clear_message (1,1); |
| 7059 | cancel_echoing (); | ||
| 7048 | 7060 | ||
| 7049 | /* First flush out any partial line written with print. */ | 7061 | /* First flush out any partial line written with print. */ |
| 7050 | message_log_maybe_newline (); | 7062 | message_log_maybe_newline (); |
| @@ -7056,7 +7068,10 @@ message3 (m, nbytes, multibyte) | |||
| 7056 | } | 7068 | } |
| 7057 | 7069 | ||
| 7058 | 7070 | ||
| 7059 | /* The non-logging version of message3. */ | 7071 | /* The non-logging version of message3. |
| 7072 | This does not cancel echoing, because it is used for echoing. | ||
| 7073 | Perhaps we need to make a separate function for echoing | ||
| 7074 | and make this cancel echoing. */ | ||
| 7060 | 7075 | ||
| 7061 | void | 7076 | void |
| 7062 | message3_nolog (m, nbytes, multibyte) | 7077 | message3_nolog (m, nbytes, multibyte) |