[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#53598: 28.0.91; occur-after-change function errors with args-out-of-
From: |
Eli Zaretskii |
Subject: |
bug#53598: 28.0.91; occur-after-change function errors with args-out-of-range in occur-edit-mode |
Date: |
Sat, 29 Jan 2022 09:57:10 +0200 |
> Date: Fri, 28 Jan 2022 23:38:49 +0000
> From: Jack Henahan <root@proofte.ch>
> Cc: Mattias EngdegÄrd <mattiase@acm.org>, 53598@debbugs.gnu.org
>
> I may have spoken too soon. It looks like there's an edge case on either end
> of an occurrence line. With the attached reproducer file in `emacs -Q':
>
> M-s o buffer RET
> C-x o
> n
> C-e
> e
> DEL
>
> Debugger entered--Lisp error: (args-out-of-range "(setq minibuffer-prompt-pe"
> 26 0)
> occur-after-change-function(77 77 1)
> delete-backward-char(1 nil)
> funcall-interactively(delete-backward-char 1 nil)
> command-execute(delete-backward-char)
Thanks, this is a separate problem. The following patch should solve
that one as well:
diff --git a/lisp/replace.el b/lisp/replace.el
index 45bd05d..b1cfd7e 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1413,10 +1413,15 @@ 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)))
+ (setq text (substring text prefix-len
+ (and (not (zerop suffix-len))
+ (- suffix-len))))
(delete-region beg-pos end-pos)
(goto-char beg-pos)
(insert text)))