unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Simple syntax table stuff
@ 2007-04-15  6:21 thorne
  2007-04-15  6:43 ` David Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: thorne @ 2007-04-15  6:21 UTC (permalink / raw)
  To: help-gnu-emacs


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

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?

-- 
þ    theron tlåx    þ
(compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Simple syntax table stuff
  2007-04-15  6:21 Simple syntax table stuff thorne
@ 2007-04-15  6:43 ` David Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: David Hansen @ 2007-04-15  6:43 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-15  6:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-15  6:21 Simple syntax table stuff thorne
2007-04-15  6:43 ` David Hansen

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