Skip to content

cc errors on first line of string-edit buffer: text-read-only #2005

@bcc32

Description

@bcc32

From emacs -Q -L <path-to-evil> -l evil -l string-edit:

(read-string-from-buffer "prompt:" "")

Pressing cc on the input text entered (whether it is empty or not), when there is no line following it, signals the following error:

Text is read-only

With debug-ignored-errors set to nil and debug-on-error turned on, here is the backtrace:

Debugger entered--Lisp error: (text-read-only)
  evil-delete(10 31 line nil nil)
  evil-change(10 31 line nil nil)
  funcall-interactively(evil-change 10 31 line nil nil)
  command-execute(evil-change)
  read-string-from-buffer("prompt:" "")
  (progn (read-string-from-buffer "prompt:" ""))
  eval((progn (read-string-from-buffer "prompt:" "")) t)
  elisp--eval-last-sexp(nil)
  #f(compiled-function () #<bytecode 0x29a45fce0186a>)()
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

Without inputting any text, the backtrace instead says that the beg and end arguments are both 10. It seems unintuitive that evil-mode would attempt to delete the trailing newline in the prompt, which is marked read-only. cc works out of the box in analogous buffers like eshell due to avoiding crossing fields, but marking that text with the field text property also doesn't work in this particular case.

additional info

M-x emacs-version
GNU Emacs 30.1.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2026-02-26
evil version 20250318.1816 from MELPA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions