[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get syntax information in batch mode?
From: |
andlind |
Subject: |
Re: How to get syntax information in batch mode? |
Date: |
19 May 2006 04:19:13 -0700 |
User-agent: |
G2/0.2 |
Many years ago (at least ten) I wrote a stand-alone "print" utility
that invoked Emacs, loaded a file, started font-lock and executed
ps-print-buffer-with-faces, so I know it's possible to do what you want
to do.
After looking at the font-lock source, I think that all you have to do
is setting "noninteractive" to nil, e.g.:
(let ((noninteractive nil))
(font-lock-mode t))
However, this is just a speculation, I leave all the fun
trial-end-error stuff to you. ;)
-- Anders
Davin Pearson skrev:
> 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?
>
> If there is no such function, then could Emacs be modified so that
> text properties are online in batch mode?
>
> Here is an example of a function that always prints nil when invoked
> noninteractively.
>
> (defun test ()
> (find-file "~/a.java")
> (font-lock-mode)
> (goto-char (point-min))
> (while (< (point) (point-max))
> (message "%s\n" (get-char-property (point) 'face))
> (forward-char 1)))