From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71525: 30.0.50; Spin in delete-region/interval_deletion_adjustment Spin in delete-region/interval_deletion_adjustment) Date: Fri, 14 Jun 2024 10:13:30 +0300 Message-ID: <86v82cxahx.fsf@gnu.org> References: <87y17a55ny.fsf@stebalien.com> <87ikydo246.fsf@stebalien.com> <86o785z8wl.fsf@gnu.org> <87tthwrh8h.fsf@stebalien.com> <867ceszvp1.fsf@gnu.org> <87r0d0rfxa.fsf@stebalien.com> <87bk44bzf4.fsf@stebalien.com> <8634pgztx0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34598"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, steven@stebalien.com, 71525@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 14 09:14:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sI18p-0008kJ-Dv for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jun 2024 09:14:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI18N-0007m9-Oj; Fri, 14 Jun 2024 03:14:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI18M-0007lq-Rs for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 03:14:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sI18M-0006oo-JS for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 03:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sI18M-0001OB-2z for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 03:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jun 2024 07:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71525 X-GNU-PR-Package: emacs Original-Received: via spool by 71525-submit@debbugs.gnu.org id=B71525.17183492235303 (code B ref 71525); Fri, 14 Jun 2024 07:14:02 +0000 Original-Received: (at 71525) by debbugs.gnu.org; 14 Jun 2024 07:13:43 +0000 Original-Received: from localhost ([127.0.0.1]:39835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sI183-0001NT-0n for submit@debbugs.gnu.org; Fri, 14 Jun 2024 03:13:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sI180-0001NA-0c for 71525@debbugs.gnu.org; Fri, 14 Jun 2024 03:13:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI17t-0006k7-VP; Fri, 14 Jun 2024 03:13:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=tbK6XGY1NPSW8J6cSlXrrI6yB0GHV0k+6uA/LYRgGAo=; b=h+U7454MDW+lXE1qscQg LYpkXdRNVzDM3/7CdHvo8NvodlBRugFU+1s08lQbDjTJAAjLqKkgl9My2BOkKsQ0fhDkge83UC6Lj foNx8+kQAI1MQZWiKEd+ZGHk2bzsopHG3jbcWtH2ryz/p4NHdzxBhtVO1QmPCiAbdwSrS3tTx3Uid VDm+WR6TjRLajQDFUO9NViaco+VN+b1sp3yZKUoBz1l8yx1H0GbGKVi521YgtXpkYim5bUFMTMrFu QM7NCTKZ8h4ZwsrWXuc/zvl6jTDlpjhAuwsfn50O/5JFuQGTQIB7GBqVlTs4+me2JPB2rughe62g9 FY5Us4oGi8Y0pQ==; In-Reply-To: (message from Dmitry Gutov on Fri, 14 Jun 2024 02:41:15 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287217 Archived-At: > Date: Fri, 14 Jun 2024 02:41:15 +0300 > From: Dmitry Gutov > Cc: jporterbugs@gmail.com, 71525@debbugs.gnu.org > > On 14/06/2024 00:47, Dmitry Gutov wrote: > > The thing is, decode_coding_c_string already calls > > adjust_markers_for_insert through > > > >   decode_coding_object->decode_coding->produce_chars->insert_from_gap > > > > And the extra call moves the markers too far. > > > > Unfortunately, it's called with BEFORE_MARKERS=nil, and the above call > > chain makes it difficult to pass through the extra argument. > > We can do it through the coding_system structure, though. > > See attached. It fixes the freezes in my testing. > > It seems like the least invasive possible fix, but better suggestions > welcome. This is the correct approach, IMO. But see some minor comments below. > @@ -7814,7 +7815,7 @@ encode_coding (struct coding_system *coding) > } while (coding->consumed_char < coding->src_chars); > > if (BUFFERP (coding->dst_object) && coding->produced_char > 0) > - insert_from_gap (coding->produced_char, coding->produced, 0); > + insert_from_gap (coding->produced_char, coding->produced, 0, coding->dst_before_markers); Here (and elsewhere in the patch) too-long lines should be broken in two. > + /* True to insert before markers in the DST_OBJECT buffer. */ > + bool_bf dst_before_markers : 1; I'd call this 'insert_before_markers' instead. Please also add a detailed comment here explaining what this flag is for and where and why used. > /* Insert a sequence of NCHARS chars which occupy NBYTES bytes > starting at GAP_END_ADDR - NBYTES (if text_at_gap_tail) and at > - GPT_ADDR (if not text_at_gap_tail). */ > + GPT_ADDR (if not text_at_gap_tail). > + > + If BEFORE_MARKERS is true, insert before markers. */ This commentary should also mention process.c as the single caller using this facility in unconventional ways. > extern void insert_from_gap_1 (ptrdiff_t, ptrdiff_t, bool text_at_gap_tail); > -extern void insert_from_gap (ptrdiff_t, ptrdiff_t, bool text_at_gap_tail); > +extern void insert_from_gap (ptrdiff_t, ptrdiff_t, bool text_at_gap_tail, > + bool before_markers); We don't have names of arguments in prototypes, only their types. (Yes, it means the original prototype, and the ones around it, were also wrong.) > --- a/src/process.c > +++ b/src/process.c > @@ -6415,6 +6415,7 @@ read_and_insert_process_output (struct Lisp_Process *p, char *buf, > specpdl_ref count1 = SPECPDL_INDEX (); > > XSETBUFFER (curbuf, current_buffer); > + process_coding->dst_before_markers = true; Please also add a comment here explaining why this is done. Thanks.