Function: tpu-add-at-bol

tpu-add-at-bol is an interactive and byte-compiled function defined in tpu-edt.el.gz.

Signature

(tpu-add-at-bol TEXT)

Documentation

Add text to the beginning of each line in a region, or each line in the entire buffer if no region is selected.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/tpu-edt.el.gz
(defun tpu-add-at-bol (text)
  "Add text to the beginning of each line in a region,
or each line in the entire buffer if no region is selected."
  (interactive
   (list (tpu-string-prompt "String to add: " 'tpu-add-at-bol-hist)))
  (if (string= "" text) (tpu-error "No string specified."))
  (cond ((tpu-mark)
	 (save-excursion
	   (if (> (point) (tpu-mark)) (exchange-point-and-mark))
	   (while (and (< (point) (tpu-mark)) (re-search-forward "^" (tpu-mark) t))
	     (if (< (point) (tpu-mark)) (replace-match text))))
	 (tpu-unselect t))
	(t
	 (save-excursion
	   (goto-char (point-min))
	   (while (and (re-search-forward "^" nil t) (not (eobp)))
	     (replace-match text))))))