Function: vhdl-do-same-indent

vhdl-do-same-indent is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-do-same-indent FUNCTION &optional SPACING)

Documentation

Apply FUNCTION to block of lines with same indent.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-do-same-indent (function &optional spacing)
  "Apply FUNCTION to block of lines with same indent."
  (let ((indent (current-indentation))
	beg end)
    ;; search for first line with same indent
    (save-excursion
      (while (and (not (bobp))
		  (or (looking-at "^\\s-*\\(--.*\\)?$")
		      (= (current-indentation) indent)))
	(unless (looking-at "^\\s-*$")
	  (back-to-indentation) (setq beg (point)))
	(beginning-of-line -0)))
    ;; search for last line with same indent
    (save-excursion
      (while (and (not (eobp))
		  (or (looking-at "^\\s-*\\(--.*\\)?$")
		      (= (current-indentation) indent)))
	(if (looking-at "^\\s-*$")
	    (beginning-of-line 2)
	  (beginning-of-line 2)
	  (setq end (point)))))
    ;; run FUNCTION
    (funcall function beg end spacing)))