diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 37 | ||||
| -rw-r--r-- | src/dispnew.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 4 | 
3 files changed, 37 insertions, 6 deletions
diff --git a/src/callproc.c b/src/callproc.c index 52b89504205..6bd4ae22f63 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -746,6 +746,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,        int carryover = 0;        bool display_on_the_fly = display_p;        struct coding_system saved_coding = process_coding; +      ptrdiff_t prepared_pos = 0; /* prepare_to_modify_buffer was last +                                     called here.  */        while (1)  	{ @@ -773,6 +775,33 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,  	      if (display_on_the_fly)  		break;  	    } +          /* CHANGE FUNCTIONS +             For each iteration of the enclosing while (1) loop which +             yields data (i.e. nread > 0), before- and +             after-change-functions are each invoked exactly once. +             This is done directly from the current function only, by +             calling prepare_to_modify_buffer and signal_after_change. +             It is not done here by directing another function such as +             insert_1_both to call them.  The call to +             prepare_to_modify_buffer follows this comment, and there +             is one call to signal_after_change in each of the +             branches of the next `else if'. + +             Exceptionally, the insertion into the buffer is aborted +             at the call to del_range_2 ~45 lines further down, this +             function removing the newly inserted data.  At this stage +             prepare_to_modify_buffer has been called, but +             signal_after_change hasn't.  A continue statement +             restarts the enclosing while (1) loop.  A second, +             unwanted, call to `prepare_to_modify_buffer' is inhibited +             by the test perpared_pos < PT.  The data are inserted +             again, and this time signal_after_change gets called, +             balancing the previous call to prepare_to_modify_buffer.  */ +          if ((prepared_pos < PT) && nread) +            { +              prepare_to_modify_buffer (PT, PT, NULL); +              prepared_pos = PT; +            }  	  /* Now NREAD is the total amount of data in the buffer.  */ @@ -780,15 +809,16 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,  	    ;  	  else if (NILP (BVAR (current_buffer, enable_multibyte_characters))  		   && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) -	    insert_1_both (buf, nread, nread, 0, 1, 0); +            { +              insert_1_both (buf, nread, nread, 0, 0, 0); +              signal_after_change (PT, 0, nread); +            }  	  else  	    {			/* We have to decode the input.  */  	      Lisp_Object curbuf;  	      ptrdiff_t count1 = SPECPDL_INDEX ();  	      XSETBUFFER (curbuf, current_buffer); -	      /* FIXME: Call signal_after_change!  */ -	      prepare_to_modify_buffer (PT, PT, NULL);  	      /* We cannot allow after-change-functions be run  		 during decoding, because that might modify the  		 buffer, while we rely on process_coding.produced to @@ -824,6 +854,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,  	      TEMP_SET_PT_BOTH (PT + process_coding.produced_char,  				PT_BYTE + process_coding.produced); +              signal_after_change (PT, 0, process_coding.produced_char);  	      carryover = process_coding.carryover_bytes;  	      if (carryover > 0)  		memcpy (buf, process_coding.carryover, diff --git a/src/dispnew.c b/src/dispnew.c index d094ca61798..d79ae836c56 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -4361,7 +4361,7 @@ scrolling_window (struct window *w, int tab_line_p)    /* Can't scroll the display of w32 GUI frames when position of point       is indicated by the system caret, because scrolling the display -     will then "copy" the pixles used by the caret.  */ +     will then "copy" the pixels used by the caret.  */  #ifdef HAVE_NTGUI    if (w32_use_visible_system_caret)      return 0; diff --git a/src/xdisp.c b/src/xdisp.c index a5efbb39bed..68a504fb2d4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19193,7 +19193,7 @@ try_window_reusing_current_matrix (struct window *w)    /* Can't scroll the display of w32 GUI frames when position of point       is indicated by the system caret, because scrolling the display -     will then "copy" the pixles used by the caret.  */ +     will then "copy" the pixels used by the caret.  */  #ifdef HAVE_NTGUI    if (w32_use_visible_system_caret)      return false; @@ -20185,7 +20185,7 @@ try_window_id (struct window *w)    /* Can't let scroll_run_hook below run on w32 GUI frames when       position of point is indicated by the system caret, because -     scrolling the display will then "copy" the pixles used by the +     scrolling the display will then "copy" the pixels used by the       caret.  */  #ifdef HAVE_NTGUI    if (FRAME_W32_P (f) && w32_use_visible_system_caret)  | 
