Created
December 12, 2013 19:30
-
-
Save riccardomurri/7933952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun check-cfengine-block-length (filename) | |
(save-excursion | |
(find-file filename) | |
(goto-char (point-min)) | |
(while (re-search-forward "\\[%CFEngine +BEGIN *%\\]" nil 'noerror) | |
(let ((start (match-end 0)) | |
(start-line (what-line))) | |
(if (re-search-forward "\\[%CFEngine +END *%\\]" nil 'noerror) | |
(let ((end (match-beginning 0)) | |
(end-line (what-line))) | |
(if (> (- end start) 4096) | |
(message "CFEngine block between lines %s and %s larger than 4096 characters." start-line end-line)))))) | |
(kill-buffer (current-buffer)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment