all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there a way to make emacs display different functions in different colors?
@ 2014-09-16 22:45 yoyobeermam
  2014-09-16 23:08 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: yoyobeermam @ 2014-09-16 22:45 UTC (permalink / raw)
  To: help-gnu-emacs

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? I would be using Monodevelop, but it refuses to open, and because I'm renting my machine from my high school (MacBook Air) it has strong parental controls and I cannot dig around in the system for a solution. I'm still new to programming, so having these functions in different colors really helps me to know if i entered it correctly, and helps me locate things when debugging. If you can't, could you let me know of a script editor that supports C# and this functionality?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-16 22:45 Is there a way to make emacs display different functions in different colors? yoyobeermam
@ 2014-09-16 23:08 ` Emanuel Berg
  2014-09-17 12:15 ` Gian Uberto Lauri
       [not found] ` <mailman.9030.1410956159.1147.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-16 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

yoyobeermam@gmail.com 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

or:

#!/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
particular).

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
set.

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-16 22:45 Is there a way to make emacs display different functions in different colors? yoyobeermam
  2014-09-16 23:08 ` Emanuel Berg
@ 2014-09-17 12:15 ` Gian Uberto Lauri
  2014-09-18  7:23   ` Tassilo Horn
       [not found]   ` <mailman.9083.1411025573.1147.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.9030.1410956159.1147.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 9+ messages in thread
From: Gian Uberto Lauri @ 2014-09-17 12:15 UTC (permalink / raw)
  To: yoyobeermam; +Cc: help-gnu-emacs

yoyobeermam@gmail.com 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.

Try putting

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

in the .emacs file in your home directory (create a new .emacs file if
it does not exist).

If it does what you need type ESC-x and list-faces-display at the
prompt. The faces whose name starts by font-lock can be customized
for color an weight (move the cursor on the face and hit return).

For a color list, type ESC-x and list-colors-display at the prompt.

I hope this helps.

-- 
 /\           ___                                    Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____               African word
  //--\| | \|  |   Integralista GNUslamico            meaning "I can
\/                 coltivatore diretto di software       not install
     già sistemista a tempo (altrui) perso...                Debian"

Warning: gnome-config-daemon considered more dangerous than GOTO



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
       [not found] ` <mailman.9030.1410956159.1147.help-gnu-emacs@gnu.org>
@ 2014-09-17 21:14   ` Emanuel Berg
  2014-09-17 21:24     ` Stefan Monnier
  2014-09-18  7:40     ` Gian Uberto Lauri
  0 siblings, 2 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-17 21:14 UTC (permalink / raw)
  To: help-gnu-emacs

"Gian Uberto Lauri" <saint@eng.it> writes:

> Try putting
>
>     (global-font-lock-mode t)
>     (setq font-lock-maximum-decoration t)
>
> in the .emacs file

For me, those are both t by default (with 'emacs -Q').

-- 
underground experts united


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-17 21:14   ` Emanuel Berg
@ 2014-09-17 21:24     ` Stefan Monnier
  2014-09-18  7:42       ` Gian Uberto Lauri
  2014-09-18  7:40     ` Gian Uberto Lauri
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2014-09-17 21:24 UTC (permalink / raw)
  To: help-gnu-emacs

>> Try putting
>> (global-font-lock-mode t)
>> (setq font-lock-maximum-decoration t)
> For me, those are both t by default (with 'emacs -Q').

Indeed, the first since Emacs-22 IIRC, and the second "for ever".


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-17 12:15 ` Gian Uberto Lauri
@ 2014-09-18  7:23   ` Tassilo Horn
       [not found]   ` <mailman.9083.1411025573.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Tassilo Horn @ 2014-09-18  7:23 UTC (permalink / raw)
  To: Gian Uberto Lauri; +Cc: help-gnu-emacs, yoyobeermam

"Gian Uberto Lauri" <saint@eng.it> writes:

Hi!

>  > 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.
>
> Try putting
>
> (global-font-lock-mode t)
> (setq font-lock-maximum-decoration t)
>
> in the .emacs file in your home directory (create a new .emacs file if
> it does not exist).

I don't think he uses an Emacs version that's so old not to have
font-lock enabled by default.  But stock emacs doesn't come with a C#
mode, and it seems he programs in that (because he compares with
Monodevelop).  So he should install csharp-mode [1] which is also
installable using the emacs package manager from either the marmalade or
MELPA repositories.

Bye,
Tassilo

[1] https://code.google.com/p/csharpmode/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-17 21:14   ` Emanuel Berg
  2014-09-17 21:24     ` Stefan Monnier
@ 2014-09-18  7:40     ` Gian Uberto Lauri
  1 sibling, 0 replies; 9+ messages in thread
From: Gian Uberto Lauri @ 2014-09-18  7:40 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Emanuel Berg writes:
 > "Gian Uberto Lauri" <saint@eng.it> writes:
 > 
 > > Try putting
 > >
 > >     (global-font-lock-mode t)
 > >     (setq font-lock-maximum-decoration t)
 > >
 > > in the .emacs file
 > 
 > For me, those are both t by default (with 'emacs -Q').

I am carrying them around since I switched to font-lock from hilit...

-- 
 /\           ___                                    Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____               African word
  //--\| | \|  |   Integralista GNUslamico            meaning "I can
\/                 coltivatore diretto di software       not install
     già sistemista a tempo (altrui) perso...                Debian"

Warning: gnome-config-daemon considered more dangerous than GOTO



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
  2014-09-17 21:24     ` Stefan Monnier
@ 2014-09-18  7:42       ` Gian Uberto Lauri
  0 siblings, 0 replies; 9+ messages in thread
From: Gian Uberto Lauri @ 2014-09-18  7:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier writes:
 > >> Try putting
 > >> (global-font-lock-mode t)
 > >> (setq font-lock-maximum-decoration t)
 > > For me, those are both t by default (with 'emacs -Q').
 > 
 > Indeed, the first since Emacs-22 IIRC, and the second "for ever".

So I can save some bytes out of my .emacs? Niiiice!

-- 
 /\           ___                                    Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____               African word
  //--\| | \|  |   Integralista GNUslamico            meaning "I can
\/                 coltivatore diretto di software       not install
     già sistemista a tempo (altrui) perso...                Debian"

Warning: gnome-config-daemon considered more dangerous than GOTO



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Is there a way to make emacs display different functions in different colors?
       [not found]   ` <mailman.9083.1411025573.1147.help-gnu-emacs@gnu.org>
@ 2014-09-18 21:09     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-18 21:09 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> I don't think he uses an Emacs version that's so old
> not to have font-lock enabled by default. But stock
> emacs doesn't come with a C# mode, and it seems he
> programs in that (because he compares with
> Monodevelop). So he should install csharp-mode [1]
> which is also installable using the emacs package
> manager from either the marmalade or MELPA
> repositories.
>
> ...
>
> [1] https://code.google.com/p/csharpmode/

So there is a C# package. Yeah, I suspected that much.
Great that you know exactly where, nevertheless.

If you write the code in that Emacs C# mode and then
use the Mono CLI tools to compile into the intermediate
representation for the .NET virtual machine to execute
- sure, why not? It is worth a shot.

-- 
underground experts united


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-18 21:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 22:45 Is there a way to make emacs display different functions in different colors? yoyobeermam
2014-09-16 23:08 ` Emanuel Berg
2014-09-17 12:15 ` Gian Uberto Lauri
2014-09-18  7:23   ` Tassilo Horn
     [not found]   ` <mailman.9083.1411025573.1147.help-gnu-emacs@gnu.org>
2014-09-18 21:09     ` Emanuel Berg
     [not found] ` <mailman.9030.1410956159.1147.help-gnu-emacs@gnu.org>
2014-09-17 21:14   ` Emanuel Berg
2014-09-17 21:24     ` Stefan Monnier
2014-09-18  7:42       ` Gian Uberto Lauri
2014-09-18  7:40     ` Gian Uberto Lauri

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.