You are not logged in.

#1 2011-09-13 15:28:25

yu3k
Member
Registered: 2011-09-02
Posts: 5

Enable syntax highlighting with configuration file in emacs

When editing configuration files such as .procmailrc, .fetchmailrc, Emacs won't automatically highlight syntax for me.
I can enable syntax highlighting in Vim by appending "syntax on"  to the .vimrc.
I tried adding "global-font-lock-mode t" in the .emacs file, but it didn't solve my problem.
What is the solution?

Offline

#2 2011-09-13 16:42:27

mjheagle8
Member
From: /home/mjheagle8
Registered: 2009-07-12
Posts: 186

Re: Enable syntax highlighting with configuration file in emacs

i dont use emacs, but this looks like that you want:

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

Desktop/Laptop - DWM :: VM - screen
Registered Linux User Number 483137 :: Victory! :: GitHub

Offline

#3 2011-09-14 03:57:06

yu3k
Member
Registered: 2011-09-02
Posts: 5

Re: Enable syntax highlighting with configuration file in emacs

mjheagle8 wrote:

i dont use emacs, but this looks like that you want:

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

    No, that doesn't solve my problem.

Offline

#4 2011-09-14 08:41:11

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Enable syntax highlighting with configuration file in emacs

Some of my config file have this (using conf-unix-mode)

# this is .somerc
# -*- conf-unix -*-
...

Or using this in your .emacs

(add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode))

Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#5 2011-09-14 09:49:04

yu3k
Member
Registered: 2011-09-02
Posts: 5

Re: Enable syntax highlighting with configuration file in emacs

igndenok wrote:

Some of my config file have this (using conf-unix-mode)

# this is .somerc
# -*- conf-unix -*-
...

Or using this in your .emacs

(add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode))

I followed your advice, and it does have some syntax highlighting, but less than Vim does.
For example, Vim will highlight all the names of colors in the .muttrc file, but Emacs doesn't.
I guess Emacs is not as strong as Vim when it comes to editing configuration files.

Last edited by yu3k (2011-09-14 10:06:47)

Offline

#6 2011-09-14 10:49:12

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Enable syntax highlighting with configuration file in emacs

Because vim has its own syntax coloring style for muttrc (you can see it in /usr/share/vim/vim73/syntax) while emacs doesn't.
And yes, syntax highlighting in vim is more colorful than emacs.


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#7 2011-09-15 04:31:10

yu3k
Member
Registered: 2011-09-02
Posts: 5

Re: Enable syntax highlighting with configuration file in emacs

Hi igndenok,
you are right, thank you.

Offline

Board footer

Powered by FluxBB