all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Use symbol anchors in generic.el
@ 2004-09-09 12:55 Miles Bader
  2004-09-09 13:14 ` Kim F. Storm
  0 siblings, 1 reply; 2+ messages in thread
From: Miles Bader @ 2004-09-09 12:55 UTC (permalink / 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]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Use symbol anchors in generic.el
  2004-09-09 12:55 Use symbol anchors in generic.el Miles Bader
@ 2004-09-09 13:14 ` Kim F. Storm
  0 siblings, 0 replies; 2+ messages in thread
From: Kim F. Storm @ 2004-09-09 13:14 UTC (permalink / raw)
  Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

> What do people think of the following change to generic.el, to use \_<
> and \_> when matching keywords, instead of \< and \>?
>

I don't see any problems with it.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-09 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09 12:55 Use symbol anchors in generic.el Miles Bader
2004-09-09 13:14 ` Kim F. Storm

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.