GNU bug report logs - #53598
28.0.91; occur-after-change function errors with args-out-of-range in occur-edit-mode

Previous Next

Package: emacs;

Reported by: Jack Henahan <root <at> proofte.ch>

Date: Fri, 28 Jan 2022 09:07:01 UTC

Severity: normal

Found in version 28.0.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 53598 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jack Henahan <root <at> proofte.ch>, Mattias EngdegÄrd
 <mattiase <at> acm.org>
Cc: 53598 <at> debbugs.gnu.org
Subject: Re: 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
> Date: Fri, 28 Jan 2022 07:28:47 +0000
> From: Jack Henahan <root <at> 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)))




This bug report was last modified 3 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.