In a recent Emacs master (as provided in Silex's Docker image): $ emacs --batch --eval "(with-temp-buffer (insert \"\n;;;###autoload\n(defun ...)\n\") (goto-char 1) (print (re-search-forward \"^[[:space:]]*;;;###autoload[[:space:]]*$\" nil t)))" Prints nil. With every stable version of Emacs I have this prints 16. Paul