From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davin Pearson" Newsgroups: gmane.emacs.help Subject: Re: How to get syntax information in batch mode? Date: Sun, 21 May 2006 18:55:02 +1200 Message-ID: <8d7d1e6d0605202355r20bf3d8emb908432ef23372ec@mail.gmail.com> References: <446F18E0.2090102@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1148225022 1042 80.91.229.2 (21 May 2006 15:23:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 21 May 2006 15:23:42 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 21 17:23:39 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fhpm9-0003Ga-GJ for geh-help-gnu-emacs@m.gmane.org; Sun, 21 May 2006 17:23:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fhpm8-0007OU-U0 for geh-help-gnu-emacs@m.gmane.org; Sun, 21 May 2006 11:23:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FhhqE-0006nP-VG for help-gnu-emacs@gnu.org; Sun, 21 May 2006 02:55:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FhhqD-0006nD-Jn for help-gnu-emacs@gnu.org; Sun, 21 May 2006 02:55:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FhhqD-0006nA-Em for help-gnu-emacs@gnu.org; Sun, 21 May 2006 02:55:05 -0400 Original-Received: from [66.249.92.171] (helo=ug-out-1314.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fhhtv-0000wQ-AW for help-gnu-emacs@gnu.org; Sun, 21 May 2006 02:58:55 -0400 Original-Received: by ug-out-1314.google.com with SMTP id y2so1067043uge for ; Sat, 20 May 2006 23:55:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ssLMW+XDMNTj0KzpbsBAeb3J98ksA5ELgaYFypTx6UCb084F7ghZyHi6hN6WMbBMD+/NusTHaKT4eF5POhR27pKYcYAkt0DLoOR0pFcBJ6hYz8oSNH/Yk5EbCsznuc1JlruUT9DSldDhIjCiyTA9U8DtC0D1ck+HM3eHpNroCnA= Original-Received: by 10.78.39.16 with SMTP id m16mr892035hum; Sat, 20 May 2006 23:55:02 -0700 (PDT) Original-Received: by 10.78.51.2 with HTTP; Sat, 20 May 2006 23:55:02 -0700 (PDT) Original-To: "martin rudalics" In-Reply-To: <446F18E0.2090102@gmx.at> Content-Disposition: inline X-Mailman-Approved-At: Sun, 21 May 2006 11:23:14 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35187 Archived-At: On 21/05/06, martin rudalics 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