<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Evan Klitzke wrote:
<blockquote cite="mid:1239253749.5924.8.camel@localhost.localdomain"
 type="cite">
  <pre wrap="">I know, this is an emacs question and not a fedora question per se. But
I've asked my question on the emacs help news group without a response,
and I know there are some emacs users lurking around these parts, so I
thought I'd try here :-)

My question is stated previously at:
<a class="moz-txt-link-freetext" href="http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/785fb0e6542eda80/1ad000e4fa700e1e">http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/785fb0e6542eda80/1ad000e4fa700e1e</a>

Basically, emacs uses a big complex regular expression to figure out
what words to highlight in different modes. There seems to be a command
font-lock-remove-keyword that can be used to safely edit the regular
expression and remove a keyword from it; but the documentation is pretty
vague, and the source code for the function is way over my head.

Thanks for any help!

  </pre>
</blockquote>
The elisp function that you should try is font-lock-remove-keywords as
you mentioned.&nbsp; The Emacs help for this function shows the syntax as:<br>
&nbsp;&nbsp;&nbsp; (font-lock-remove-keywords&nbsp;&nbsp; mode&nbsp;&nbsp; keywords)<br>
<br>
I have not used this function, though I have used its counterpart
font-lock-add-keywords.&nbsp; Try the following and see if it does what you
want:<br>
<br>
&nbsp;&nbsp;&nbsp; ;;; Define a list of keywords to be removed from the list of Python
keywords<br>
&nbsp;&nbsp;&nbsp; ;;; note: your list may consist of just one keyword or multiple<br>
&nbsp;&nbsp;&nbsp; (defconst my-python-non-keywords&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; ;; constant name<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '("\\bself\\b" "\\bTrue\\b" "\\bFalse\\b")&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;&nbsp; ;; constant value<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "My list of Python Keywords that I do not highlighted")&nbsp; ;;
constant description/comment<br>
<br>
&nbsp;&nbsp;&nbsp; ;;; Remove Keywords from Python font-lock-keywords-alist<br>
&nbsp;&nbsp;&nbsp; (font-lock-remove-keywords&nbsp;&nbsp; 'python-mode&nbsp;&nbsp; my-python-non-keywords)<br>
<br>
You may have to play around with the list of keywords.&nbsp; I am not sure
what the regular expression should look like.&nbsp; It may be that you only
need the keywords without the extra regular expressions to remove them;
I have only added keywords so I am not sure about this point.&nbsp; In other
words, if "\\bself\\b" does not work, try "self" next.&nbsp; If neither of
them work, then you are going to have to experiment and/or seek more
help in the forums.<br>
<br>
The example that I used above, "\\bTEXT\\b", works for C++ keywords.&nbsp;
The "\\b" causes the regular expression to select TEXT when it is a
word and ignore it when it part of another word like "anyTEXT".<br>
<br>
You do not need to do the two step code that I wrote.&nbsp; You can replace
the my-python-non-keywords variable/constant name with the actual value
'("\\bself\\b").&nbsp; I prefer creating the constant first because then I
can list the constant to verify that the list is actual what I think it
is using the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp; Control-H&nbsp;&nbsp; v &nbsp; my-python-non-keywords<br>
<br>
I used a constant in my original C++ keyword code.&nbsp; You can use a
constant or a variable.&nbsp; <br>
&nbsp;&nbsp;&nbsp; (defvar name value comment)<br>
The only difference is that if you use a variable you can change the
value.<br>
<br>
When I tried something similar, many years ago, I actually created a
complete list of C++ keywords used by the compiler that I was using
then and replaced the entire list:<br>
&nbsp;&nbsp;&nbsp; (font-lock-add-keywords 'c++-mode my-c++-keywords nil)<br>
<br>
The last argument is set to nil to replace or t to append.&nbsp; I no longer
recommend the complete replacement of the keyword list since you must
remain active to keep the list up to date.&nbsp; But it is an option that
can be used when all else fails.<br>
<br>
Good luck and let us know when you are successful.<br>
<br>
<div class="moz-signature">-- <br>
<div>&nbsp;&nbsp;Steven F. LeBrun<br>
<p>
Quote: <em>"The objection to fairy stories is that they tell children
there are dragons. But children have always known there are dragons.
Fairy stories tell children that dragons can be killed."</em><br>
&nbsp;&nbsp;&nbsp;&nbsp; -- G.K. Chesterton</p>
</div>
</div>
</body>
</html>