unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: /* FIXME: Call signal_after_change!  */ in callproc.c.  Well, why not?
Date: Sat, 21 Dec 2019 20:11:01 +0200	[thread overview]
Message-ID: <83k16pzgzu.fsf@gnu.org> (raw)
In-Reply-To: <20191221172324.GA8692@ACM> (message from Alan Mackenzie on Sat,  21 Dec 2019 17:23:24 +0000)

> Date: Sat, 21 Dec 2019 17:23:24 +0000
> From: Alan Mackenzie <acm@muc.de>
> 
>  	      /* FIXME: Call signal_after_change!  */
> +              beg = PT;

Can you tell why you needed this variable and the assignment?  AFAIK,
PT doesn't change when we call decode_coding_c_string.

>  	      decode_coding_c_string (&process_coding,
>  				      (unsigned char *) buf, nread, curbuf);
>  	      unbind_to (count1, Qnil);
> +              signal_after_change (beg, 0, PT - beg);
>  	      if (display_on_the_fly
>  		  && CODING_REQUIRE_DETECTION (&saved_coding)
>  		  && ! CODING_REQUIRE_DETECTION (&process_coding))
> 
> 
> , and this appears to solve the OP's problem.
> 
> However, a few lines further on, there's a del_range_2 call inside a condition
> I don't understand (though might, with a great deal of study).  I suspect that
> the call to signal_after_change ought to take this del_range_2 into account,
> possibly coming after it.
> 
> Would somebody who's familiar with this bit of callproc.c please help me out
> here, and explain what this call to del_range_2 is doing, and whether there's
> anything basically wrong with my simple-minded addition of
> signal_after_change.

I'm not sure what you want to hear.  The del_range_2 call deletes the
just-inserted text, because the condition means that text was inserted
using the wrong coding-system to decode the incoming bytes.  What does
that mean for the modification hooks, I don't know: the
before-change-functions were already called, but nothing was inserted
from the Lisp application's POV, so if you insist on having before and
after hooks to be called in pairs, you are in a conundrum.

It's possible that we should simplify all this by calling the before
hooks just once before the loop and the after hooks just once after
the loop, instead of calling them for each individual chunk inside the
loop, but again I don't know what that means for applications which
expects these hook calls to pair.



  reply	other threads:[~2019-12-21 18:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21 17:23 /* FIXME: Call signal_after_change! */ in callproc.c. Well, why not? Alan Mackenzie
2019-12-21 18:11 ` Eli Zaretskii [this message]
2019-12-21 21:47   ` Alan Mackenzie
2019-12-22 18:38     ` Eli Zaretskii
2019-12-24  9:47       ` Alan Mackenzie
2019-12-24 12:51         ` Alan Mackenzie
2019-12-24 15:58           ` Eli Zaretskii
2019-12-24 15:47         ` Eli Zaretskii
2019-12-29 13:34           ` Alan Mackenzie
2019-12-29 16:23             ` Stefan Monnier
2020-01-03  8:45             ` Eli Zaretskii
2020-01-04 22:47               ` Alan Mackenzie
2020-01-05 18:17                 ` Eli Zaretskii
2020-01-05 18:48                   ` Alan Mackenzie
2020-01-21 20:34                     ` Alan Mackenzie
2020-01-22  3:27                       ` Eli Zaretskii
2020-01-22 20:05                         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83k16pzgzu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).