473,506 Members | 11,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax highlightening

I would like to change the pre-defined colors in the Emacs
python mode, but I don't have any clue on how to do it.
Somebody can help here?
TIA,

Michele
Jul 18 '05 #1
3 1595
mi**@pitt.edu (Michele Simionato) writes:
I would like to change the pre-defined colors in the Emacs
python mode, but I don't have any clue on how to do it.
Somebody can help here?
Move point over the color you want to change. Execute "M-x
customize-face", hit return and play around.

There may be a more systematic way of doing this, but I don't know
what...

Cheers,
mwh

-- Look I don't know. Thankyou everyone for arguing me round in
circles.

No need for thanks, ma'am; that's what we're here for.
-- LNR & Michael M Mason, cam.misc
Jul 18 '05 #2
mi**@pitt.edu (Michele Simionato) writes:
I would like to change the pre-defined colors in the Emacs
python mode, but I don't have any clue on how to do it.
Somebody can help here?
TIA,

Michele

The coloring is controlled by "font-lock". python-mode.el (found in
e.g., share/emacs/21.3/lisp/progmodes) maps specific words to
font-lock attributes. E.g., "if" is a font-lock-keyword., "print" is
a font-lock-builtin. However, you can probably guess the attributes
you want to change from the font-lock.el, without having to look at
python-mode.el:

(defvar font-lock-comment-face 'font-lock-comment-face
"Face name to use for comments.")

(defvar font-lock-string-face 'font-lock-string-face
"Face name to use for strings.")

(defvar font-lock-doc-face 'font-lock-doc-face
"Face name to use for documentation.")

(defvar font-lock-keyword-face 'font-lock-keyword-face
"Face name to use for keywords.")

(defvar font-lock-builtin-face 'font-lock-builtin-face
"Face name to use for builtins.")

(defvar font-lock-function-name-face 'font-lock-function-name-face
"Face name to use for function names.")

(defvar font-lock-variable-name-face 'font-lock-variable-name-face
"Face name to use for variable names.")

(defvar font-lock-type-face 'font-lock-type-face
"Face name to use for type and class names.")

(defvar font-lock-constant-face 'font-lock-constant-face
"Face name to use for constant and label names.")

(defvar font-lock-warning-face 'font-lock-warning-face
"Face name to use for things that should stand out.")

(defvar font-lock-reference-face 'font-lock-constant-face
"This variable is obsolete. Use `font-lock-constant-face'.")
Once you know the proper font-lock attribute, you can change the color
by settings in you personal .emacs, e.g.:
(defun python-initialise ()
(interactive)
(setq default-tab-width 4)
(setq indent-tabs-mode nil)
(set-face-foreground `font-lock-comment-face "green")
(set-face-background `font-lock-comment-face "red")
)

--
ha************@boeing.com
6-6M31 Knowledge Management
Phone: (425) 342-5601
Jul 18 '05 #3
Harry George <ha************@boeing.com> wrote in message news:<xqxoevxepjb.
<snip>

That was very interesting. I will try it and see what I can get.
Thanks,
Michele
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
33325
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
22
3391
by: Tuang | last post by:
I'm checking out Python as a candidate for replacing Perl as my "Swiss Army knife" tool. The longer I can remember the syntax for performing a task, the more likely I am to use it on the spot if...
14
2280
by: Sandy Norton | last post by:
If we are going to be stuck with @decorators for 2.4, then how about using blocks and indentation to elminate repetition and increase readability: Example 1 --------- class Klass: def...
16
2586
by: George Sakkis | last post by:
I'm sure there must have been a past thread about this topic but I don't know how to find it: How about extending the "for <X> in" syntax so that X can include default arguments ? This would be very...
23
2496
by: Carter Smith | last post by:
http://www.icarusindie.com/Literature/ebooks/ Rather than advocating wasting money on expensive books for beginners, here's my collection of ebooks that have been made freely available on-line...
19
2934
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
4
3772
by: Jeremy Yallop | last post by:
Looking over some code I came across a line like this if isalnum((unsigned char)c) { which was accepted by the compiler without complaint. Should the compiler have issued a diagnostic in this...
177
6856
by: C# Learner | last post by:
Why is C syntax so uneasy on the eye? In its day, was it _really_ designed by snobby programmers to scare away potential "n00bs"? If so, and after 50+ years of programming research, why are...
4
7595
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax...
3
16191
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.