diff options
| author | Richard M. Stallman | 1995-06-14 14:10:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-06-14 14:10:27 +0000 |
| commit | 306230858e0b02b7383004fb904bb4167e7c4f0a (patch) | |
| tree | e73bee2d3cb62401c0059cbbbe75d1c943b63592 /src/process.c | |
| parent | 624bbdc475206a6937201204f3e62635a24482ca (diff) | |
| download | emacs-306230858e0b02b7383004fb904bb4167e7c4f0a.tar.gz emacs-306230858e0b02b7383004fb904bb4167e7c4f0a.zip | |
(status_notify): Undo May 18 change.
Set update_tick at the beginning not at end.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 151 |
1 files changed, 74 insertions, 77 deletions
diff --git a/src/process.c b/src/process.c index 9cf17dc17ec..667dcb9ae66 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3391,7 +3391,6 @@ status_notify () | |||
| 3391 | register Lisp_Object proc, buffer; | 3391 | register Lisp_Object proc, buffer; |
| 3392 | Lisp_Object tail, msg; | 3392 | Lisp_Object tail, msg; |
| 3393 | struct gcpro gcpro1, gcpro2; | 3393 | struct gcpro gcpro1, gcpro2; |
| 3394 | Lisp_Object old_process_alist; | ||
| 3395 | 3394 | ||
| 3396 | tail = Qnil; | 3395 | tail = Qnil; |
| 3397 | msg = Qnil; | 3396 | msg = Qnil; |
| @@ -3401,97 +3400,95 @@ status_notify () | |||
| 3401 | reference. */ | 3400 | reference. */ |
| 3402 | GCPRO2 (tail, msg); | 3401 | GCPRO2 (tail, msg); |
| 3403 | 3402 | ||
| 3404 | do | 3403 | /* Set this now, so that if new processes are created by sentinels |
| 3404 | that we run, we get called again to handle their status changes. */ | ||
| 3405 | update_tick = process_tick; | ||
| 3406 | |||
| 3407 | for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) | ||
| 3405 | { | 3408 | { |
| 3406 | old_process_alist = Vprocess_alist; | 3409 | Lisp_Object symbol; |
| 3407 | for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) | 3410 | register struct Lisp_Process *p; |
| 3411 | |||
| 3412 | proc = Fcdr (Fcar (tail)); | ||
| 3413 | p = XPROCESS (proc); | ||
| 3414 | |||
| 3415 | if (XINT (p->tick) != XINT (p->update_tick)) | ||
| 3408 | { | 3416 | { |
| 3409 | Lisp_Object symbol; | 3417 | XSETINT (p->update_tick, XINT (p->tick)); |
| 3410 | register struct Lisp_Process *p; | ||
| 3411 | 3418 | ||
| 3412 | proc = Fcdr (Fcar (tail)); | 3419 | /* If process is still active, read any output that remains. */ |
| 3413 | p = XPROCESS (proc); | 3420 | if (XINT (p->infd) >= 0) |
| 3421 | while (! EQ (p->filter, Qt) | ||
| 3422 | && read_process_output (proc, XINT (p->infd)) > 0); | ||
| 3414 | 3423 | ||
| 3415 | if (XINT (p->tick) != XINT (p->update_tick)) | 3424 | buffer = p->buffer; |
| 3416 | { | ||
| 3417 | XSETINT (p->update_tick, XINT (p->tick)); | ||
| 3418 | 3425 | ||
| 3419 | /* If process is still active, read any output that remains. */ | 3426 | /* Get the text to use for the message. */ |
| 3420 | if (XINT (p->infd) >= 0) | 3427 | if (!NILP (p->raw_status_low)) |
| 3421 | while (! EQ (p->filter, Qt) | 3428 | update_status (p); |
| 3422 | && read_process_output (proc, XINT (p->infd)) > 0); | 3429 | msg = status_message (p->status); |
| 3423 | 3430 | ||
| 3424 | buffer = p->buffer; | 3431 | /* If process is terminated, deactivate it or delete it. */ |
| 3432 | symbol = p->status; | ||
| 3433 | if (CONSP (p->status)) | ||
| 3434 | symbol = XCONS (p->status)->car; | ||
| 3425 | 3435 | ||
| 3426 | /* Get the text to use for the message. */ | 3436 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) |
| 3427 | if (!NILP (p->raw_status_low)) | 3437 | || EQ (symbol, Qclosed)) |
| 3428 | update_status (p); | 3438 | { |
| 3429 | msg = status_message (p->status); | 3439 | if (delete_exited_processes) |
| 3440 | remove_process (proc); | ||
| 3441 | else | ||
| 3442 | deactivate_process (proc); | ||
| 3443 | } | ||
| 3430 | 3444 | ||
| 3431 | /* If process is terminated, deactivate it or delete it. */ | 3445 | /* Now output the message suitably. */ |
| 3432 | symbol = p->status; | 3446 | if (!NILP (p->sentinel)) |
| 3433 | if (CONSP (p->status)) | 3447 | exec_sentinel (proc, msg); |
| 3434 | symbol = XCONS (p->status)->car; | 3448 | /* Don't bother with a message in the buffer |
| 3449 | when a process becomes runnable. */ | ||
| 3450 | else if (!EQ (symbol, Qrun) && !NILP (buffer)) | ||
| 3451 | { | ||
| 3452 | Lisp_Object ro, tem; | ||
| 3453 | struct buffer *old = current_buffer; | ||
| 3454 | int opoint; | ||
| 3435 | 3455 | ||
| 3436 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) | 3456 | ro = XBUFFER (buffer)->read_only; |
| 3437 | || EQ (symbol, Qclosed)) | ||
| 3438 | { | ||
| 3439 | if (delete_exited_processes) | ||
| 3440 | remove_process (proc); | ||
| 3441 | else | ||
| 3442 | deactivate_process (proc); | ||
| 3443 | } | ||
| 3444 | 3457 | ||
| 3445 | /* Now output the message suitably. */ | 3458 | /* Avoid error if buffer is deleted |
| 3446 | if (!NILP (p->sentinel)) | 3459 | (probably that's why the process is dead, too) */ |
| 3447 | exec_sentinel (proc, msg); | 3460 | if (NILP (XBUFFER (buffer)->name)) |
| 3448 | /* Don't bother with a message in the buffer | 3461 | continue; |
| 3449 | when a process becomes runnable. */ | 3462 | Fset_buffer (buffer); |
| 3450 | else if (!EQ (symbol, Qrun) && !NILP (buffer)) | 3463 | opoint = point; |
| 3451 | { | 3464 | /* Insert new output into buffer |
| 3452 | Lisp_Object ro, tem; | 3465 | at the current end-of-output marker, |
| 3453 | struct buffer *old = current_buffer; | 3466 | thus preserving logical ordering of input and output. */ |
| 3454 | int opoint; | 3467 | if (XMARKER (p->mark)->buffer) |
| 3455 | 3468 | SET_PT (marker_position (p->mark)); | |
| 3456 | ro = XBUFFER (buffer)->read_only; | 3469 | else |
| 3457 | 3470 | SET_PT (ZV); | |
| 3458 | /* Avoid error if buffer is deleted | 3471 | if (point <= opoint) |
| 3459 | (probably that's why the process is dead, too) */ | 3472 | opoint += XSTRING (msg)->size + XSTRING (p->name)->size + 10; |
| 3460 | if (NILP (XBUFFER (buffer)->name)) | 3473 | |
| 3461 | continue; | 3474 | tem = current_buffer->read_only; |
| 3462 | Fset_buffer (buffer); | 3475 | current_buffer->read_only = Qnil; |
| 3463 | opoint = point; | 3476 | insert_string ("\nProcess "); |
| 3464 | /* Insert new output into buffer | 3477 | Finsert (1, &p->name); |
| 3465 | at the current end-of-output marker, | 3478 | insert_string (" "); |
| 3466 | thus preserving logical ordering of input and output. */ | 3479 | Finsert (1, &msg); |
| 3467 | if (XMARKER (p->mark)->buffer) | 3480 | current_buffer->read_only = tem; |
| 3468 | SET_PT (marker_position (p->mark)); | 3481 | Fset_marker (p->mark, make_number (point), p->buffer); |
| 3469 | else | 3482 | |
| 3470 | SET_PT (ZV); | 3483 | SET_PT (opoint); |
| 3471 | if (point <= opoint) | 3484 | set_buffer_internal (old); |
| 3472 | opoint += XSTRING (msg)->size + XSTRING (p->name)->size + 10; | ||
| 3473 | |||
| 3474 | tem = current_buffer->read_only; | ||
| 3475 | current_buffer->read_only = Qnil; | ||
| 3476 | insert_string ("\nProcess "); | ||
| 3477 | Finsert (1, &p->name); | ||
| 3478 | insert_string (" "); | ||
| 3479 | Finsert (1, &msg); | ||
| 3480 | current_buffer->read_only = tem; | ||
| 3481 | Fset_marker (p->mark, make_number (point), p->buffer); | ||
| 3482 | |||
| 3483 | SET_PT (opoint); | ||
| 3484 | set_buffer_internal (old); | ||
| 3485 | } | ||
| 3486 | } | 3485 | } |
| 3487 | } /* end for */ | 3486 | } |
| 3488 | } while (! EQ (old_process_alist, Vprocess_alist)); | 3487 | } /* end for */ |
| 3489 | 3488 | ||
| 3490 | update_mode_lines++; /* in case buffers use %s in mode-line-format */ | 3489 | update_mode_lines++; /* in case buffers use %s in mode-line-format */ |
| 3491 | redisplay_preserve_echo_area (); | 3490 | redisplay_preserve_echo_area (); |
| 3492 | 3491 | ||
| 3493 | update_tick = process_tick; | ||
| 3494 | |||
| 3495 | UNGCPRO; | 3492 | UNGCPRO; |
| 3496 | } | 3493 | } |
| 3497 | 3494 | ||