> I have written an automatic code indentation function in ELisp and I
> want to be able to invoke this function from Emacs' batch mode so that
> it can be invoked from a Makefile, without needing to start Emacs
> interactively.
>
> However the function get-char-property always seems to return nil when
> noninteractive is set to t. Am I correct about this deduction?
>
> I use get-char-property to tell the automatic indentation function
> whether or not we are currently inside a string or a comment. Is
> there a different function for telling whether or not we are currently
> inside a string or a comment?
By default, Emacs doesn't fontify text that is not displayed. Hence, in
general, your function might not work interactively either.
You have two basic ways to achieve what you want:
Use font-lock and text-properties: A brute force approach is to call
`font-lock-fontify-buffer' before doing the indentation.