Function: picture-insert
picture-insert is a byte-compiled function defined in picture.el.gz.
Signature
(picture-insert CH ARG)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/picture.el.gz
;; Picture insertion and deletion.
(defun picture-insert (ch arg)
(let* ((width (char-width ch))
;; We must be sure that the succeeding insertion won't delete
;; the just inserted character.
(picture-horizontal-step
(if (and (= picture-vertical-step 0)
(> width 1)
(< (abs picture-horizontal-step) 2))
(* picture-horizontal-step 2)
picture-horizontal-step))
actual-col)
(while (> arg 0)
(setq arg (1- arg))
(if (/= picture-desired-column (current-column))
(setq actual-col (move-to-column picture-desired-column t))
(setq actual-col picture-desired-column))
(let ((col (+ actual-col width)))
(or (eolp)
(let ((pos (point))
(col0 (current-column))
col1)
(setq col1 (move-to-column col t))
;; We count columns, not width, because move-to-column
;; could insert TABs, which width depends on horizontal
;; position.
(let ((old-width (- (max col0 col1) (min col0 col1))))
(delete-region pos (point))
(when (> old-width width)
(insert-char ? (- old-width width))
(goto-char pos))))))
(insert ch)
(forward-char -1)
(picture-move))))