Subject: Re: bug#53598: 28.0.91; occur-after-change function errors with args-out-of-range in occur-edit-mode

From: Jack Henahan <[email-masked]>
Date: Fri, 28 Jan 2022 23:38:49 +0000

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)

Similarly,

M-s o buffer RET
C-x o
n
C-r ( RET
e
DEL

Debugger entered--Lisp error: (args-out-of-range "(setq minibuffer-prompt-pes" 27 0)
  occur-after-change-function(50 50 1)
  delete-backward-char(1 nil)
  funcall-interactively(delete-backward-char 1 nil)
  command-execute(delete-backward-char)

Trying to grok what all's going on in the code to hopefully be more helpful than just finding the thing.

Testing in 27.2 shows no errors in these edge cases. In the latter example, deleting backward past the occurrence's first char deletes into the line indicator, but with no effect on the buffer. This is weird to look at, but at least not totally surprising. I'm attempting to learn enough about text-property to see if I can figure out how to make only the occur-items writable and leave everything else read-only.