From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Use symbol anchors in generic.el Date: Thu, 09 Sep 2004 21:55:56 +0900 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <874qm738kj.fsf@tc-1-100.kawasaki.gol.ne.jp> Reply-To: Miles Bader NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1094734601 6446 80.91.224.253 (9 Sep 2004 12:56:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Sep 2004 12:56:41 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 09 14:56:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C5OTS-00065f-00 for ; Thu, 09 Sep 2004 14:56:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C5OYm-0008Pl-27 for ged-emacs-devel@m.gmane.org; Thu, 09 Sep 2004 09:01:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C5OYU-0008JP-GU for emacs-devel@gnu.org; Thu, 09 Sep 2004 09:01:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C5OYS-0008H6-87 for emacs-devel@gnu.org; Thu, 09 Sep 2004 09:01:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C5OYS-0008Gt-1c for emacs-devel@gnu.org; Thu, 09 Sep 2004 09:01:36 -0400 Original-Received: from [203.216.5.72] (helo=smtp02.dentaku.gol.com) by monty-python.gnu.org with esmtp (TLSv1:RC4-SHA:128) (Exim 4.34) id 1C5OT3-0000bt-Ra; Thu, 09 Sep 2004 08:56:02 -0400 Original-Received: from localhost ([127.0.0.1]) by smtp02.dentaku.gol.com with esmtp (Dentaku) id 1C5OT1-0002PC-Qw; Thu, 09 Sep 2004 21:55:59 +0900 Original-Received: from yokohama2-61-203-152-135.ap.0038.net ([61.203.152.135] helo=tc-1-100.kawasaki.gol.ne.jp) by smtp02.dentaku.gol.com with asmtp (Dentaku) id 1C5OT0-0002P7-Vv; Thu, 09 Sep 2004 21:55:59 +0900 Original-Received: by tc-1-100.kawasaki.gol.ne.jp (Postfix, from userid 1000) id 085E6FB2; Thu, 9 Sep 2004 21:55:56 +0900 (JST) Original-To: emacs-devel@gnu.org System-Type: i686-pc-linux-gnu Original-Lines: 45 X-Virus-Scanned: by AMaViS GOL X-Abuse-Complaints: abuse@gol.com X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:26923 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26923 What do people think of the following change to generic.el, to use \_< and \_> when matching keywords, instead of \< and \>? I defined a mode (for povray) using `define-generic-mode', which uses _lots_ of keywords, and the annoying result was that the keywords were highlighted even they occurred as part of user symbols, when adjoined using `_'. I could fix this by making `_' a word-constituent instead of a symbol-constituent, but that's not really right, and makes M-f etc. behave annoyingly. The following simple patch makes my mode behave much more reasonably, and making keywords match whole symbols rather than just words seems like it would be the more correct behavior in most cases. Thanks, -Miles diff -u lisp/generic.el.\~1\~ lisp/generic.el --- lisp/generic.el.~1~ 2004-05-18 21:30:10.000000000 +0900 +++ lisp/generic.el 2004-09-09 21:47:30.000000000 +0900 @@ -405,10 +405,10 @@ The regexp is highlighted with FACE." (unless (listp keywords-list) (error "Keywords argument must be a list of strings")) - (list (concat prefix "\\<" + (list (concat prefix "\\_<" ;; Use an optimized regexp. (regexp-opt keywords-list t) - "\\>" suffix) + "\\_>" suffix) 1 face)) -- In New York, most people don't have cars, so if you want to kill a person, you have to take the subway to their house. And sometimes on the way, the train is delayed and you get impatient, so you have to kill someone on the subway. [George Carlin]