简体   繁体   中英

Trying to edit init.el to customize emacs

So I'm relatively new in trying to customize emacs. But I really need to customize is asap. Tabs are a pain in emacs as they are two spaces, and the text is all messed up when it is opened with any other editor after that.

Currently, I only have few lines in my ~/emacs.d/init.el file:

(setq load-path (concat (getenv "HOME") "/.emacs.d/"))

(set-scroll-bar-mode 'right)

(require 'linum)
(global-linum-mode t)

I get an error while starting up emacs:

Loading encoded-kb...done


An error has occurred while loading `/Users/mycomp/.emacs.d/init.el':

Symbol's function definition is void: set-scroll-bar-mode

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

I tried srtating it with the --debug-init option, but my lisp knowledge is not enough to help me figure out what's wrong. Any help on how to get this working or redirecting me to some GOOD tutorials on editing init.el files will be really helpful (yes i did google tutorials on editing the initialization file, but every one of them was terrible).

I'm assuming my code for getting line numbers on the left is also wrong. Could someone please help me with this? Thanks a lot.

I think this line may be the problem:

(setq load-path (concat (getenv "HOME") "/.emacs.d/"))

First of all, I don't think this is required to load ~/emacs.d/init.el . Secondly, if you do want to add a directory to your load-path , you should probably be doing it like this instead:

(add-to-list 'load-path "~/.emacs.d/")

This code adds the directory to the load-path , your code just clobbers it with the single directory.

Use 'Mx apropos' and 'Mx customize-apropos'. For now, those will make your life much easier when you want to customize things.

For instance, to customize things to do with scrolling, 'Mx customize-apropos RET scroll RET' will give you a list of all things that you can customize that have 'scroll' in them. You can look around and find the things that you want by searching the buffer. If you find a particular thing that you want, there's usually a group that it belongs to. You can click on that, and just customize those particular values. Make sure you save the settings.

It might take you a while to figure out what things are called. If you've got an idea, try the apropos search. If that doesn't turn up anything, google can probably sort it out for you.

For now, don't worry about hacking the elisp. This method will write values to your startup file (probably the .emacs?) and you can look and check the syntax later if you're really interested. I customize most of my stuff this way; I only bother actually modifying the file by hand when I'm trying to write my own hooks or functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM