unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Eli Zaretskii <eliz@gnu.org>, Steven Allen <steven@stebalien.com>
Cc: jporterbugs@gmail.com, 71525@debbugs.gnu.org
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 00:47:40 +0300	[thread overview]
Message-ID: <d4beaef6-0417-43e1-95f2-e0f1fec9ad6a@gutov.dev> (raw)
In-Reply-To: <8634pgztx0.fsf@gnu.org>

On 13/06/2024 19:31, Eli Zaretskii wrote:
>> From: Steven Allen<steven@stebalien.com>
>> Cc:71525@debbugs.gnu.org
>> Date: Thu, 13 Jun 2024 09:06:07 -0700
>>
>>
>> Steven Allen<steven@stebalien.com>  writes:
>>> Eli Zaretskii<eliz@gnu.org>  writes:
>>>> I see a couple of Eshell-related changes, but no obvious suspects.
>>>>
>>>> Can someone please reproduce this and post a detailed backtrace,
>>>> including Lisp backtrace?  Jim, are you looking into this?
>>> It's hanging in the C code, not lisp. I believe the issue is:
>>>
>>> https://lists.gnu.org/archive/html/emacs-devel/2024-06/msg00241.html
>>>
>>> So I'm trying that patch now.
>>>
>>> If that doesn't work, I'll produce a backtrace sometime later today.
>> I can confirm that the linked patch fixes the issue. Would you still
>> like me to produce a backtrace?
> No need, thanks.  That issue is already on someone's table.

I think I see it now.

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.

Perhaps we should do this?

diff --git a/src/process.c b/src/process.c
index eb526311c53..3c6cbe9b188 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6423,9 +6423,17 @@ read_and_insert_process_output (struct 
Lisp_Process *p, char *buf,
        specbind (Qinhibit_modification_hooks, Qt);
        decode_coding_c_string (process_coding,
  			      (unsigned char *) buf, nread, curbuf);
-      adjust_markers_for_insert (PT, PT_BYTE,
-				 PT + process_coding->produced_char,
-				 PT_BYTE + process_coding->produced, true);
+      /* The previous call adjusts the markers, except for those
+	exactly at PT (it inserts with BEFORE_MARKERS=nil). */
+      struct Lisp_Marker *m;
+      for (m = BUF_MARKERS (current_buffer); m; m = m->next)
+	{
+	  if (m->bytepos == PT_BYTE)
+	    {
+	      m->bytepos = PT_BYTE + process_coding->produced;
+	      m->charpos = PT + process_coding->produced_char;
+	    }
+	}
        unbind_to (count1, Qnil);

        read_process_output_set_last_coding_system (p, process_coding);


That doesn't adjust the overlays, however (the 
adjust_overlays_for_insert call inside adjust_markers_for_insert). And 
doing the same trick with them seems more difficult.





  reply	other threads:[~2024-06-13 21:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12 19:20 bug#71525: 30.0.50; Spin in delete-region/interval_deletion_adjustment Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] ` <handler.71525.B.171822007123849.ack@debbugs.gnu.org>
2024-06-13  5:14   ` bug#71525: Acknowledgement (30.0.50; Spin in delete-region/interval_deletion_adjustment) Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13  5:52     ` bug#71525: 30.0.50; Spin in delete-region/interval_deletion_adjustment " Eli Zaretskii
2024-06-13 15:32       ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13 15:52         ` Eli Zaretskii
2024-06-13 16:00           ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13 16:06             ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13 16:31               ` Eli Zaretskii
2024-06-13 21:47                 ` Dmitry Gutov [this message]
2024-06-13 23:41                   ` Dmitry Gutov
2024-06-14  7:13                     ` Eli Zaretskii
2024-06-14 16:51                       ` Dmitry Gutov
2024-06-14 18:14                         ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-14 18:17                       ` Dmitry Gutov
2024-06-14 18:46                         ` Eli Zaretskii
2024-06-14 19:13                           ` Dmitry Gutov
2024-06-13 19:18           ` Jim Porter
2024-06-13 19:42             ` Steven Allen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13  5:49 ` bug#71525: 30.0.50; Spin in delete-region/interval_deletion_adjustment Eli Zaretskii

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=d4beaef6-0417-43e1-95f2-e0f1fec9ad6a@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=71525@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=steven@stebalien.com \
    /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).