Subject: bug#63837: 29.0.91; delete-forward-char error with composed text

From: Robert Pluim <[email-masked]>
Date: Fri, 02 Jun 2023 14:05:17 +0200

>>>>> On Fri, 2 Jun 2023 10:42:29 +0000, Thiago Melo <[email-masked]> said:

    Thiago> * How to reproduce:
    Thiago> 0. Start emacs with `emacs -Q'
    Thiago> 1. Create some text composition, e.g. eval: `(insert (compose-chars ?+))'
    Thiago> 2. Move cursor to before composed character
    Thiago> 3. `M-x delete-forward-char' or press <delete> key

    Thiago> * Backtrace:

    Thiago> Debugger entered--Lisp error: (wrong-type-argument sequencep t)
    Thiago>   lgstring-glyph-boundary(t 1 2)
    Thiago>   delete-forward-char(1 nil)
    Thiago>   funcall-interactively(delete-forward-char 1 nil)
    Thiago>   call-interactively(delete-forward-char nil nil)
    Thiago>   command-execute(delete-forward-char)

How about this (for master, since your example is somewhat contrived :-))

diff --git a/lisp/simple.el b/lisp/simple.el
index 3f88fcb8d03..efe6895fabc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1527,9 +1527,11 @@ delete-forward-char
                           ;; character.
                           ((<= to pos)
                            (1+ pos))
-                          (t
+                          ((vectorp (nth 2 cmp))
                            (lgstring-glyph-boundary (nth 2 cmp)
-                                                    from (1+ pos)))))
+                                                    from (1+ pos)))
+                          (t
+                           (1+ pos))))
                      (1+ pos)))
              (setq n (1- n)))
            (delete-char (- pos start) killflag)))

Robert
--