unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: andlind@gmail.com
Subject: Re: How to get syntax information in batch mode?
Date: 19 May 2006 04:19:13 -0700	[thread overview]
Message-ID: <1148037553.263866.74570@38g2000cwa.googlegroups.com> (raw)
In-Reply-To: 1148018293.918822.151520@38g2000cwa.googlegroups.com

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)))

  reply	other threads:[~2006-05-19 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-19  5:58 How to get syntax information in batch mode? Davin Pearson
2006-05-19 11:19 ` andlind [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-20 13:25 martin rudalics
2006-05-21  6:55 ` Davin Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1148037553.263866.74570@38g2000cwa.googlegroups.com \
    --to=andlind@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).