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

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

RE: new major mode doubts


From: Doug Lewan
Subject: RE: new major mode doubts
Date: Thu, 17 Jan 2013 14:53:26 +0000

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 religion. 
- Abraham Lincoln

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Luca Ferrari
> Sent: Thursday, 2013 January 17 03:08
> To: help-gnu-emacs
> Subject: new major mode doubts
> 
> 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:
> 
> 1) in the keyword list I specified a regexp for uppercase keywords as
> follows:
> 
>  (defconst dataflex-font-lock-keywords-minimal
>   (list
> 
> '("\\<\\(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" )
> 
> 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)?
> 
> 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)))
> 
> but while it works for M-; comment, commenting out  awhole region
> causes each line to be included into a couple of // as
> 
> a line of code
> 
> becoming
> 
> // a line of code        //
> 
> 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?
> 
> Thanks,
> Luca




reply via email to

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