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

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

Re: Simple syntax table stuff


From: David Hansen
Subject: Re: Simple syntax table stuff
Date: Sun, 15 Apr 2007 08:43:53 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux)

On Sat, 14 Apr 2007 23:21:45 -0700 thorne wrote:

> Hello.  I would like to be able to font-lock strings in a text-mode
> type buffer.  I have figured out i can do this:
>
> (defun fontify-strings ()
>   "Add font-lock to double-quoted strings in the current buffer."
>   (interactive)
>   (modify-syntax-entry ?\" "\"")
>   (font-lock-fontify-buffer))
>
> Which does work, but it is permanant--i don't know how to write code
> to turn the feature off.  Is there a way to do that (i assume there
> must be)?

Turn off font-lock-mode or change the syntax back to punctuation.
Maybe it's not a bad idea to define some new major mode (probably
via `define-derived-mode') which just changes the syntax-table entry.

> Also, is there a way to define comment delimiters in syntax such that
> a character is a comment start if and only if it is in column 1?

Use `font-lock-syntactic-keywords'.

David





reply via email to

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