Thread: Emacs init file problem

  1. #1
    Registered User
    Join Date
    Dec 2013
    Posts
    26

    Emacs init file problem

    Hi guys,

    I was trying to start customizing emacs using the .emacs file, I just wanted it to default to k&r style in c-mode, but I just get errors now.

    I hoped it would really be as simple as the online tutorial implied but it's not. The default .emacs file without any modification is causing the problem, this is what I have.
    Code:
      ;;;;
    ~(custom-set-variables
     ;; custom-set-variables was added by Custom.
     ;; If you edit it by hand, you could mess it up, so be careful.
     ;; Your init file should contain only one such instance.
     ;; If there is more than one, they won't work right.
     '(show-paren-mode t))
    (custom-set-faces
     ;; custom-set-faces was added by Custom.
     ;; If you edit it by hand, you could mess it up, so be careful.
     ;; Your init file should contain only one such instance.
     ;; If there is more than one, they won't work right.
     )
    
    (setq -default-style "k&r"
         c-basic-offset 4)
    What I wanted was for it to just start as normal but default to k&r style when going into c- mode. If I remove the last bit, it still comes up with errors.

    Kind regards

    P166

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    This is not a C question, so in the future, put such questions in the tech or general discussion sub-forums.

    Also, direct us to whatever tutorial/resources you are learning, so we can see them for ourselves.

    I'm not an emacs user, but a quick Google search and a bit of careful reading seems to show a typo in this bit (what type of default style is it you're setting?)
    Code:
    (setq -default-style "k&r"
         c-basic-offset 4)
    Last edited by anduril462; 01-14-2014 at 02:00 PM.

  3. #3
    Registered User
    Join Date
    Dec 2013
    Posts
    26
    Sorry for posting in the wrong forum. It's a little confusing when you are new to this. And no, this does not work, it is what I have at the bottom of the code. Anyone out there know this?
    Last edited by P166BUG; 01-14-2014 at 05:54 PM.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by P166BUG View Post
    Sorry for posting in the wrong forum. It's a little confusing when you are new to this. And no, this does not work, it is what I have at the bottom of the code. Anyone out there know this?
    I don't think any of the Emacs variables start with a hyphen. Did you want c-default?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. zero init data member of class in header file
    By std10093 in forum C++ Programming
    Replies: 7
    Last Post: 01-09-2014, 04:25 PM
  2. struct init
    By hubris in forum C Programming
    Replies: 13
    Last Post: 10-10-2010, 11:18 PM
  3. Replies: 0
    Last Post: 10-03-2009, 05:25 PM
  4. class problem (init. struct, itierator for 2d array)
    By avgprogamerjoe in forum C++ Programming
    Replies: 2
    Last Post: 09-24-2007, 08:00 PM
  5. Read File To Char Array with Null char init
    By MicroFiend in forum Windows Programming
    Replies: 1
    Last Post: 10-28-2003, 06:18 PM

Tags for this Thread