From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: new major mode doubts Date: Thu, 17 Jan 2013 14:53:26 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9828E503D2@DAKIYA1.pegasus.local> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1358434318 14864 80.91.229.3 (17 Jan 2013 14:51:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Jan 2013 14:51:58 +0000 (UTC) To: Luca Ferrari , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 17 15:52:15 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TvqpC-0004tU-Nf for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Jan 2013 15:52:14 +0100 Original-Received: from localhost ([::1]:49888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvqow-00075Z-3N for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Jan 2013 09:51:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvqoq-00074r-BJ for help-gnu-emacs@gnu.org; Thu, 17 Jan 2013 09:51:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvqon-0006AV-GZ for help-gnu-emacs@gnu.org; Thu, 17 Jan 2013 09:51:52 -0500 Original-Received: from webmail.shubertorg.com ([207.246.209.200]:54198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvqon-00069y-Dd for help-gnu-emacs@gnu.org; Thu, 17 Jan 2013 09:51:49 -0500 Original-Received: from dakiya1.pegasus.local ([172.16.208.201]) by DAKIYA1.pegasus.local ([172.16.208.201]) with mapi id 14.01.0339.001; Thu, 17 Jan 2013 09:53:26 -0500 Thread-Topic: new major mode doubts Thread-Index: AQHN9In4KRZ8lhxdukC6eu0Q2X6XyphNmrTw In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88672 Archived-At: WRT Possible camel case: RE-matching in emacs is generally case-insensitive= unless you make case-fold-search nil. So, you should get what you want for= free. ,Douglas Douglas Lewan Shubert Ticketing (201) 489-8600 ext 224 When I do good, I feel good. When I do bad, I feel bad and that's my religi= on. - Abraham Lincoln > -----Original Message----- > From: help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org > [mailto:help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On > Behalf Of Luca Ferrari > Sent: Thursday, 2013 January 17 03:08 > To: help-gnu-emacs > Subject: new major mode doubts >=20 > Hi all, > as an exercise I'm trying to implement my own major mode for a > programming language (dataflex, for what it matters). I'm following > the Mode Tutorial http://emacswiki.org/emacs/ModeTutorial and so far > I've the skeleton of the mode to work for me. > However, I've got a couple of doubts: >=20 > 1) in the keyword list I specified a regexp for uppercase keywords as > follows: >=20 > (defconst dataflex-font-lock-keywords-minimal > (list >=20 > '("\\<\\(BEGIN\\|E\\(?:LSE\\|ND\\)\\|FOR\\|IF\\|LOOP\\|MOVE\\|||T\\(?:H > EN\\|O\\)\\|WHILE\\)\\>" > . font-lock-builtin-face ) > '("\\('\\w*'\\)" . font-lock-variable-name-face) ) > "Main (and minimal) highlighting for the Dataflex mode keywords" ) >=20 > however my keywords could be camel case (therefore BEGIN, begin, bEgin > are all the same). Do I have to specify upper and lower case words > individually (avoiding the mess of the camel case) or is there a > smarter way to do it (e.g., checking the font lock against lowercased > words)? >=20 > 2) the commenting is behaving in a strange manner: I've c++ comments, > therefore // .... and so I've defined the following: > (defun dataflex-comment-dwim (arg) > "Comment (in/out) a Dataflex piece of source code. It is based on > comment-dwin > of newcomment.el" > (interactive "*P") > (require 'newcomment) > (let ( (comment-start "//") (comment-end "") ) > (comment-dwim arg))) >=20 > but while it works for M-; comment, commenting out awhole region > causes each line to be included into a couple of // as >=20 > a line of code >=20 > becoming >=20 > // a line of code // >=20 > it seems as it comments out the region and for each line places an > empty comment at the end. Any idea on what I'm missing? >=20 > Thanks, > Luca