LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices



Reply
 
Search this Thread
Old 12-02-2010, 11:51 AM   #1
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Rep: Reputation: 15
Enable color coding in Emacs?


I want to get Emacs (GNU Emacs 23.2 for Windows, to be precise, but I'm hoping it'd be the same answer for Linux!) to display colors. Googling turns up a lot of responses that see to involve writing code, downloading stuff from strange websites, etc. Maybe I'm searching for the wrong thing / don't know the correct term.
 
Old 12-02-2010, 12:10 PM   #2
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,387

Rep: Reputation: 181Reputation: 181
See if this site helps:

http://geosoft.no/development/emacs.html

It has tips for Windows and unix-like systems.
 
Old 12-02-2010, 12:15 PM   #3
Bertical
Member
 
Registered: Oct 2008
Distribution: Slackware
Posts: 66

Rep: Reputation: 5
You need this in your .emacs config file
Code:
(setq global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

Last edited by Bertical; 12-02-2010 at 12:15 PM. Reason: comfig :D
 
Old 12-02-2010, 12:36 PM   #4
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Bertical View Post
You need this in your .emacs config file
Code:
(setq global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
That didn't work.

FWIW... %HOME% is H: My .emacs file is in H:\ and contains nothing but the above two lines. Emacs is able to create .emacs.d/ in H:\

What am I missing?

Thanks.
 
Old 12-02-2010, 01:33 PM   #5
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,543

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
I just downloaded Emacs 23.2 (for Windows) and colours are on by default. Where did get your copy, and how are you running it?

Last edited by ntubski; 12-02-2010 at 01:33 PM. Reason: add (for Windows)
 
Old 12-02-2010, 01:51 PM   #6
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ntubski View Post
I just downloaded Emacs 23.2 (for Windows) and colours are on by default. Where did get your copy, and how are you running it?
I downloaded it from GNU and ran it. Since there's no install, no DLLs, no registry settings... I don't see how I could have screwed anything up. But it does not show colors. Text is all dark on a white background.
 
Old 12-02-2010, 02:04 PM   #7
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,543

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Do you not see something like http://www.gnu.org/software/emacs/to...ges/splash.png when you open Emacs?
 
Old 12-02-2010, 02:14 PM   #8
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ntubski View Post
Do you not see something like http://www.gnu.org/software/emacs/to...ges/splash.png when you open Emacs?
That's exactly what I see. I then open a file... and see no colors.
 
Old 12-02-2010, 02:23 PM   #9
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,543

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Emacs chooses syntax colouring based on the filename extension, so what is the extension of the file you opened?
 
Old 12-02-2010, 02:29 PM   #10
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,140
Blog Entries: 52

Rep: Reputation: Disabled
This site's good for everything to do with Emacs:
http://www.emacswiki.org/

There's a few available for Windows, but I think the ntemacs (CVS) is the best:
http://www.emacswiki.org/emacs/CategoryWThirtyTwo
 
Old 12-02-2010, 03:06 PM   #11
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ntubski View Post
Emacs chooses syntax colouring based on the filename extension, so what is the extension of the file you opened?
Ahh, now that's useful to know!

At the moment, a .VBS (VBScript) I believe we also want a .BAT (perl script) to be in color, too. Preferably, any script.
 
Old 12-03-2010, 08:30 AM   #12
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Original Poster
Rep: Reputation: 15
How do I get Emacs to recognize .VBS files as something that should be color-coded?
 
Old 12-03-2010, 08:33 AM   #13
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,613
Blog Entries: 1

Rep: Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052
This might be helpful.
http://www.emacswiki.org/emacs/ColorTheme

It's a set of colour themes for emacs.
 
Old 12-03-2010, 08:35 AM   #14
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,613
Blog Entries: 1

Rep: Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052Reputation: 1052
Quote:
Originally Posted by jnojr View Post
How do I get Emacs to recognize .VBS files as something that should be color-coded?
You need to install this extension:
http://xahlee.org/visual_basic/emacs...asic_mode.html
 
Old 12-03-2010, 10:42 AM   #15
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,543

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Quote:
Originally Posted by jnojr View Post
Ahh, now that's useful to know!

At the moment, a .VBS (VBScript)
Emacs doesn't know about VBScript out of the box, so you will need to download to get that. See VisualBasicMode.

Quote:
I believe we also want a .BAT (perl script) to be in color, too. Preferably, any script.
Is that a DOS batch script or a perl script? Emacs comes with a perl-mode but it's associated with .pl, .pm or .perl files by default, if your .bat files are perl scripts (kind of strange) you should add this to your .emacs file:
Code:
(add-to-list 'auto-mode-alist '("\\.bat" . perl-mode))
Or use .pl as your file extension.
 
  


Reply

Tags
emacs, visual basic


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vi or vim doesn't have color coding (highlighting) for c?? knockout_artist Linux - Newbie 4 02-06-2008 09:36 PM
Yast/You Color coding linda Suse/Novell 1 08-22-2005 07:07 PM
Emacs module for better perl coding rose_bud4201 Linux - Software 3 04-27-2005 03:39 PM
vim php color coding? Longinus Linux - Software 4 04-11-2004 06:56 AM
Shell and file/directory color coding? l0f33t Linux - General 9 08-07-2003 11:19 PM


All times are GMT -5. The time now is 02:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration