Skip to content

Instantly share code, notes, and snippets.

@riccardomurri
Created December 12, 2013 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riccardomurri/7933952 to your computer and use it in GitHub Desktop.
Save riccardomurri/7933952 to your computer and use it in GitHub Desktop.
(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