Using Emacs/C++/g++

Discussion in 'Mac Programming' started by bjb.butler, Jan 11, 2009.

  1. bjb.butler macrumors 6502a

    bjb.butler

    Joined:
    Aug 18, 2008
    Location:
    Southern California
    #1
    Hey everyone

    In school, I am learning to program. We use linux (CentOS). I usually just open a terminal and type ' emacs & ' , and that will open emacs in a new window, and i wil be able to use the terminal also. When i do this on mac, I get cryptic messages like:

    [1] 2768

    or

    [2] 2769

    [1]+ Stopped emacs

    -------------------------------

    when i type just 'emacs' It opens up emacs in the terminal, which is not what I want.

    How do you open a new emacs window from the terminal?

    thanks,bj
     
  2. firestarter macrumors 603

    firestarter

    Joined:
    Dec 31, 2002
    Location:
    Green and pleasant land
    #2
    Just a quick guess (because I never use Emacs). At school you probably have X windows running, and your DISPLAY environment variable is set. emacs & will start emacs running under X, as a background task.

    On the Mac in a regular terminal, Emacs probably thinks you want to run using terminal emulation, since X isn't running by default, or configured. So it starts up in the background, can't figure out what it's supposed to do (since it has no terminal to write to) and quits.

    You should learn vi anyway, if you want to program properly. :cool:
     
  3. bjb.butler thread starter macrumors 6502a

    bjb.butler

    Joined:
    Aug 18, 2008
    Location:
    Southern California
    #3
    Can you explain a little clearer about emacs running under X?

    At school we use CentOS linux, when you type the program name, it launches the program separately.
    How do I make this action happen the same on Leopard?

    And also, we can use any editor we want, but I was just stating emacs because that's what the default is. What are the advantages of using vi over emacs?
     
  4. MacRumors Guy macrumors member

    Joined:
    Sep 17, 2008
    #4
    It didn't quit, emacs is running on the backgroud.

    Type "fg %1" to bring it back.
     
  5. firestarter macrumors 603

    firestarter

    Joined:
    Dec 31, 2002
    Location:
    Green and pleasant land
    #5
    OK - I just read somewhere that OSX Emacs isn't compiled to use X windows (although it was a post from a couple of years back - but I can't get it to work under X, so I believe it).

    You have 4 options:
    • Use Emacs in the terminal (ie, don't background it). If you want a new terminal window, just select 'New Window' in the terminal menu.
    • Download a full X version of Emacs (go to macports.org)
    • Use vi (which is small, light, fast, simple and powerful)
    • Buy TextMate or BBEdit. These two are stunning programmer's editors - very productive with code templates etc.
     
  6. alaceo macrumors member

    Joined:
    Feb 21, 2008
    #6
    If you want to use Emacs, open two terminal windows - type "emacs" in one to launch Emacs, then just use the other as a terminal. The others have explained why, but this will give you roughly the same environment (minus X11). Vi/Vim is also another option, and there are also several graphical text editors such as Xcode, Smultron, TextWrangler, etc.
     
  7. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #7
    Like the others said, leave off the ampersand (I'm guessing on you linux box, emacs is aliased in your shell to the XEmacs program).

    Also in your Mac, you have the option of installing and running Emacs.app or Aquaemacs, both of which provide an nice Aqua wrapper around emacs.
     
  8. gotzero macrumors 68040

    Joined:
    Jan 6, 2007
    Location:
    Mid-Atlantic, US
    #8
    Can you access your school's system though SSH on terminal or X11 and use the program that way?

    On OSX, I cop out and use Aquamacs.
     
  9. bjb.butler thread starter macrumors 6502a

    bjb.butler

    Joined:
    Aug 18, 2008
    Location:
    Southern California
    #9
    Ok thanks for the replies everyone.

    I've downloaded Aquamacs, and will start using that, but I can't figure out how to turn on the syntax highlighting. I've went through the menus, and have looked at the documentation. How do you turn on syntax highlighting?
     

Share This Page