[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to make emacs display different functions in differen

From: Emanuel Berg
Subject: Re: Is there a way to make emacs display different functions in different colors?
Date: Wed, 17 Sep 2014 01:08:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

address@hidden writes:

> For example, in Monodevelop, when you make a comment
> in your script like this
> //This text is only a filler
> it will turn it green. Other functions have differing
> colors too. I would like to know if it is possible to
> make Emacs do this?

Indeed, this is known as syntax highlighting and in the
Emacs world it is sometimes called font-lock.

Normally you don't need to worry about that, you only
need to put Emacs in the correct mode.

Try open a C source file (a file with a .c extension) -
that should put you in the C mode, with highlighting
included (specific highlighting for the C language).

For scripts, there is something called the hash-bang
line (hash = #, bang = !) in the beginning of the
script (the first line). For zsh scripts, it can look
like this:

#! /bin/zsh



the path (/bin/zsh) is the path to the program that
will execute the script if it is executed, in this
case, the zsh interpreter itself.

Scripts often don't have an extension (a suffix, like
.c in the other example) which is why the hash-bang,
rather than the suffix, is used by Emacs to put the
buffer in the correct mode, which in turn will get you
mode-specific highlighting.

> you let me know of a script editor that supports C#
> and this functionality?

C# (and all other .NET things) on Linux must be done
with tools like Mono, which I would strongly discourage
from. Why don't you do C, or C++, instead?

If you must do C# there might be a mode for that, as
well (use Google - check out MELPA and the EmacsWiki in

If there isn't a C# mode, you can use the C++ or C
mode: try M-x and then c-mode or c++-mode, after
opening the C# source file - C# isn't that different.
Then, take your completed file to Mono and you are all

But trust me: the thing with the MS tools (and Apple
for that matter) is, if you can stand them, they
actually work and you can do wonderful things. If you
can't stand them, but your boss or teacher tells you
you must use them, just say that won't work, period.

If you think you can sneak around the problem, using
the Linux power tools and Emacs and all, my experience
is that that will only make you more frustrated and
involve even more overhead.

Anyway, good luck!

underground experts united

reply via email to

[Prev in Thread] Current Thread [Next in Thread]