Function: vhdl-fill-region

vhdl-fill-region is an interactive and byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-fill-region BEG END &optional ARG)

Documentation

Fill lines for a region of code.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Code filling

(defun vhdl-fill-region (beg end &optional arg)
  "Fill lines for a region of code."
  (interactive "r\np")
  (save-excursion
    (goto-char beg)
    (let ((margin (if arg (current-indentation) (current-column))))
      (goto-char end)
      (setq end (point-marker))
      ;; remove inline comments, newlines and whitespace
      (vhdl-comment-kill-region beg end)
      (vhdl-comment-kill-inline-region beg end)
      (subst-char-in-region beg (1- end) ?\n ?\ )
      (vhdl-fixup-whitespace-region beg end)
      ;; wrap and end-comment-column
      (goto-char beg)
      (while (re-search-forward "\\s-" end t)
	(when(> (current-column) vhdl-end-comment-column)
	  (backward-char)
	  (when (re-search-backward "\\s-" beg t)
	    (replace-match "\n")
	    (indent-to margin)))))))