[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is there a human readable way to display syntax table?
From: |
Xah |
Subject: |
Re: is there a human readable way to display syntax table? |
Date: |
Thu, 16 Oct 2008 14:21:38 -0700 (PDT) |
User-agent: |
G2/1.0 |
Xah wrote:
«I'm mostly interested in seeing which of the ascii chars's classes,
in the standard-syntax-table, text-mode- syntaxt-table, or c-mode-
syntax-table.»
Nikolaj Schumacher wrote:
> (with-syntax-tablec-mode-syntax-table
> (let ((c 0))
> (while (< c ?~)
> (insert (format "%c: %c\n" c (char-syntaxc)))
> (incf c))))
Drew Adams wrote:
«`C-h s', which is `describe-syntax', shows the current syntax table
in human-readable form.»
Thanks guys.
When i write a new mode from the ground up (not using derived-mode or
generic mode), how do i go about defining the syntax table?
For example, i'm writing a mode for the LSL language, which uses a
sytax like C/Java.
So, i start by copying example from text-mode:
(defvar text-mode-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?\" ". " st)
(modify-syntax-entry ?\\ ". " st)
;; We add `p' so that M-c on 'hello' leads to 'Hello' rather than
'hello'.
(modify-syntax-entry ?' "w p" st)
st)
"Syntax table used while in `text-mode'.")
In my case, the LSL is basically ascii based lang. So, do i go thru
each printable ascii char, and add a modify-syntax-entry for it using
the above template?
Another question... i tried to study syntax table, which is a char
table, which is a specialized vector with extra things ... not so easy
to understand... but looking at the syntax table for text mode, it has
some 800 entries. Is a syntax table meant to cover all unicode char?
(am avoiding copying from c mode's syntax table for the moment so i
get more understanding by doing more from the basics... the cc-mode
source seems much complex to dig ...)
Xah
∑ http://xahlee.org/
☄