From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: is there a human readable way to display syntax table? Date: Fri, 17 Oct 2008 07:50:54 -0600 Message-ID: References: <483eaf97-fc85-423c-8f05-ecd42a0c1507@t18g2000prt.googlegroups.com> <5e70cb60-bbe9-4e9f-8d37-5e8f2786d81b@42g2000pry.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224251500 27823 80.91.229.12 (17 Oct 2008 13:51:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Oct 2008 13:51:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 17 15:52:41 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kqpkl-00064h-Q5 for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Oct 2008 15:52:32 +0200 Original-Received: from localhost ([127.0.0.1]:47423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kqpjh-0003mg-0L for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Oct 2008 09:51:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqpjM-0003kR-DL for help-gnu-emacs@gnu.org; Fri, 17 Oct 2008 09:51:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqpjJ-0003hk-TC for help-gnu-emacs@gnu.org; Fri, 17 Oct 2008 09:51:03 -0400 Original-Received: from [199.232.76.173] (port=59928 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqpjJ-0003hK-KK for help-gnu-emacs@gnu.org; Fri, 17 Oct 2008 09:51:01 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:47020 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KqpjI-0007HO-Ue for help-gnu-emacs@gnu.org; Fri, 17 Oct 2008 09:51:01 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KqpjD-0001US-7s for help-gnu-emacs@gnu.org; Fri, 17 Oct 2008 13:50:55 +0000 Original-Received: from c-67-161-145-183.hsd1.co.comcast.net ([67.161.145.183]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Oct 2008 13:50:55 +0000 Original-Received: from kevin.d.rodgers by c-67-161-145-183.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Oct 2008 13:50:55 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-67-161-145-183.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) In-Reply-To: <5e70cb60-bbe9-4e9f-8d37-5e8f2786d81b@42g2000pry.googlegroups.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58873 Archived-At: Xah wrote: > 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? From the "Syntax Basics" node of the Emacs Lisp manual: A syntax table is a char-table (*note Char-Tables::). The element at index C describes the character with code C. The element's value should be a list that encodes the syntax of the character in question. ... A syntax table can inherit the data for some characters from the standard syntax table, while specifying other characters itself. The "inherit" syntax class means "inherit this character's syntax from the standard syntax table." Just changing the standard syntax for a character affects all syntax tables that inherit from it. From the "Char-Tables" node: A char-table is much like a vector, except that it is indexed by character codes. Any valid character code, without modifiers, can be used as an index in a char-table. You can access a char-table's elements with `aref' and `aset', as with any array. In addition, a char-table can have "extra slots" to hold additional data not associated with particular character codes. Char-tables are constants when evaluated. ... -- Function: make-char-table subtype &optional init Return a newly created char-table, with subtype SUBTYPE. Each element is initialized to INIT, which defaults to `nil'. You cannot alter the subtype of a char-table after the char-table is created. There is no argument to specify the length of the char-table, because all char-tables have room for any valid character code as an index. > (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 ...) -- Kevin Rodgers Denver, Colorado, USA