- Context: using Emacs 26.2
I would like to write Emacs Lisp code that inserts or over-types text depending of the state of the overwrite-mode. I would call this function to insert text instead of the standard
insert function. When code uses the standard
insert function while
t, text is inserted and not overwritten.
I could write and use the following function, but I would have thought that such functionality would already be built-in Emacs. I can't find it. Does Emacs already provide a similar function?
(defun insert-or-overwrite (text) "Insert or overwrite text depending of overwrite-mode status." (when overwrite-mode (delete-char (length text))) (insert text))