Function: expand-region-abbrevs

expand-region-abbrevs is an interactive and byte-compiled function defined in abbrev.el.gz.

Signature

(expand-region-abbrevs START END &optional NOQUERY)

Documentation

For each abbrev occurrence in the region, offer to expand it.

Ask the user to type y or n for each occurrence. A prefix argument means don't query; expand all abbrevs.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/abbrev.el.gz
(defun expand-region-abbrevs (start end &optional noquery)
  "For each abbrev occurrence in the region, offer to expand it.
Ask the user to type `y' or `n' for each occurrence.
A prefix argument means don't query; expand all abbrevs."
  (interactive "r\nP")
  (save-excursion
    (goto-char start)
    (let ((lim (- (point-max) end))
	  pnt string)
      (while (and (not (eobp))
		  (progn (forward-word 1)
			 (<= (setq pnt (point)) (- (point-max) lim))))
	(if (abbrev-expansion
	     (setq string
		   (buffer-substring-no-properties
		    (save-excursion (forward-word -1) (point))
		    pnt)))
	    (if (or noquery (y-or-n-p (format-message "Expand `%s'? " string)))
		(expand-abbrev)))))))