How to configure emacs? Thank!

This is a discussion on How to configure emacs? Thank! within the Tech Board forums, part of the Community Boards category; I am using emacs to write c++ code. How to configure it to let the system highlight C++ keywords, variables, ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    How to configure emacs? Thank!

    I am using emacs to write c++ code. How to configure it to let the system highlight C++ keywords, variables, etc; and let it automatically indent, just like a common C++ IDE does?

    Any suggestions? Thanks!
    Last edited by meili100; 06-15-2007 at 10:28 AM.

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    You want to turn on global font lock for highlighting. You can do this by hand by typing "meta-x" (usually "alt-x"), then start typing global-font-lock and use the tab completion to get the name right.

    If you want it on by default add the appropriate line to your .emacs file... look here
    http://www.google.com/search?q=globa...-US:unofficial

    If the file extension is .c or .cpp you'll get proper indentation just by push tab anywhere on a line. To (re)indent an entire file, select all ("ctrl-x h") then run indent region (not sure if there's a default binding for this, just use "meta-x indent-region").

  3. #3
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Go on the menu bar to Options > Customize Emacs and explore, and you'll find lots of simple ways to make customizations. Don't ask me what the difference between 'options' and 'settings' are, though.

    If you're using XEmacs, you're in luck, possibly -- in my experience it is much easier to customize.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. emacs characters size and feel
    By hamsteroid in forum Tech Board
    Replies: 10
    Last Post: 03-29-2007, 02:51 PM
  2. Emacs frames
    By frenchfry164 in forum Tech Board
    Replies: 2
    Last Post: 12-28-2003, 02:04 PM
  3. copying and pasting from emacs
    By curlious in forum Linux Programming
    Replies: 1
    Last Post: 12-13-2003, 10:08 PM
  4. Telnet Emacs
    By gnu-ehacks in forum Linux Programming
    Replies: 8
    Last Post: 12-10-2001, 01:02 PM
  5. configuring emacs
    By greenRoom in forum Linux Programming
    Replies: 2
    Last Post: 10-25-2001, 06:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21