From: Miles Bader <miles@gnu.org>
Subject: Use symbol anchors in generic.el
Date: Thu, 09 Sep 2004 21:55:56 +0900 [thread overview]
Message-ID: <874qm738kj.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)
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]
next reply other threads:[~2004-09-09 12:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-09 12:55 Miles Bader [this message]
2004-09-09 13:14 ` Use symbol anchors in generic.el Kim F. Storm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874qm738kj.fsf@tc-1-100.kawasaki.gol.ne.jp \
--to=miles@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.