This blog post is a guide to installing and initially configuring Emacs, covering both the installation of the Emacs editor itself and basic customizations. It walks through downloading binaries for different operating systems, creating the initial configuration file (init.el), setting up the MELPA package archive (including proxy configuration for users in China), and basic editor settings like encoding, line endings, and appearance. The post details installing the Zenburn theme and Fira Code font, providing links to their respective GitHub repositories. It also covers some common view customizations such as maximizing the frame, toggling the scrollbar, and line numbers.
Get Emacs install binary pack
recommend to download have GUI version, good for use.
get windows version binary file
get linux version binary package
Create emacs initial file
can get help by using “C-h v user-init-file”
windows path like: C:\Users\frederick\AppData\Roaming\.emacs.d\init.el
MELPA(Milkypostman’s Emacs Lisp Package Archive)
add MELPA
consider I am in China, need add a http proxy
| |
after add,using “M-x eval-buffer” to evaluate this buffer or just “M-x load-file”. and then, using “M-x package-list-packages” to refresh local package list.
prevent MELPA refresh everytime when use “package-list-packages”
| |
After you’ve made these changes, MELPA will no longer refresh every time you use package-list-packages. Note that this may cause packages from MELPA to become outdated over time, so you may want to periodically refresh the MELPA repository manually using the “M-x package-refresh-contents” command.
Editor settings
encoding format
change prefer encoding format to utf-8
(prefer-coding-system 'utf-8)
These lines set the default EOL type to Unix (LF) for both the current buffer and new files.
;; Set default EOL type to Unix (LF)
(setq-default buffer-file-coding-system 'utf-8-unix)
;; Set default EOL type for new files to Unix (LF)
(setq-default default-buffer-file-coding-system 'utf-8-unix)
View settings
windows view
some I prefer to use settings:
| |
show line number
(global-linum-mode t)
some I give a try, but not like settings:
| |
zenburn theme install
just use “M-x package-install zenburn-theme”,and add below code:
| |
or use “M-x package-list-packages”, and then “C-s”(forward) / “C-r”(backward) to find what you want install:
- Enter “M-x package-menu-describe-package” Describe the package under cursor.
- i:(package-menu-mark-install) Mark for installation.
- u:(package-menu-mark-unmark) Unmark.
- d:(package-menu-mark-delete) Mark for deletion (removal of a installed package).
- x:(package-menu-execute) For “execute” (start install/uninstall of marked items).
- r:(package-menu-refresh) Refresh the list from server.
Fira font apply
and then go “Windows Settings –> Personalization –> Fonts –> Drag and drop to install”, drag every font file in folder over it to install FiraCode.
using “M-x menu-set-font” to preview already installed fonts. using “M-x describe-font” and TAB to list all font info.
then add code below and then apply it.
;; Font
(set-face-attribute 'default nil :font "Fira Code-12.0")