help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get syntax information in batch mode?


From: Davin Pearson
Subject: Re: How to get syntax information in batch mode?
Date: Sun, 21 May 2006 18:55:02 +1200

On 21/05/06, martin rudalics <rudalics@gmx.at> wrote:
 > 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.

That works for me!

Thank you very much for your helpful advice!


--
Davin Pearson    http://www.davinpearson.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]