all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Jack Henahan" <root@proofte.ch>, "Mattias Engdegård" <mattiase@acm.org>
Cc: 53598@debbugs.gnu.org
Subject: bug#53598: 28.0.91; occur-after-change function errors with args-out-of-range in occur-edit-mode
Date: Fri, 28 Jan 2022 16:27:57 +0200	[thread overview]
Message-ID: <83ilu4c4uq.fsf@gnu.org> (raw)
In-Reply-To: <iMPZvA3147LTj4j89iYeFsZci-s6hH06eeAYSw-ngNoA4Vue3ubpQGOVxk6nrymD_guy3osJZmpXnv6iPFZMmggb4_ABWtD09ZhL3Ju0jcA=@proofte.ch> (message from Jack Henahan on Fri, 28 Jan 2022 07:28:47 +0000)

> Date: Fri, 28 Jan 2022 07:28:47 +0000
> From: Jack Henahan <root@proofte.ch>
> 
> >From `emacs -Q':
> 
> M-x toggle-debug-on-error
> M-s o buffer RET
> C-x o
> C-s buffer C-s C-s RET
> e
> DEL DEL DEL
> 
> Debugger entered--Lisp error: (args-out-of-range ";; This buf is for text that is not saved, and for..." 11 -57)
>   occur-after-change-function(64 64 1)
>   delete-backward-char(1 nil)
>   funcall-interactively(delete-backward-char 1 nil)
>   command-execute(delete-backward-char)
> 
> Similar stack traces arise if you choose an arbitrary place in an
> occurrence and, say
> 
> M-d M-d M-d

Thanks.  Does the patch below give good results?

diff --git a/lisp/replace.el b/lisp/replace.el
index 45bd05d..a784388 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1413,7 +1413,10 @@ occur-after-change-function
                             (length s1)))))
                      (prefix-len (funcall common-prefix buf-str text))
                      (suffix-len (funcall common-prefix
-                                          (reverse buf-str) (reverse text))))
+                                          (reverse (substring
+                                                    buf-str prefix-len))
+                                          (reverse (substring
+                                                    text prefix-len)))))
                 (setq beg-pos (+ beg-pos prefix-len))
                 (setq end-pos (- end-pos suffix-len))
                 (setq text (substring text prefix-len (- suffix-len)))





  reply	other threads:[~2022-01-28 14:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  7:28 bug#53598: 28.0.91; occur-after-change function errors with args-out-of-range in occur-edit-mode Jack Henahan
2022-01-28 14:27 ` Eli Zaretskii [this message]
2022-01-28 16:02   ` Jack Henahan
2022-01-28 23:38     ` Jack Henahan
2022-01-29  7:57       ` Eli Zaretskii
2022-01-30  2:11         ` Jack Henahan
2022-01-30  6:51           ` 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

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

  git send-email \
    --in-reply-to=83ilu4c4uq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=53598@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    --cc=root@proofte.ch \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.