The Basics of Emacs Configuration
emacs configuration file
~/.emacsor~/.emacs.el, old schema;~/.emacs.d/init.el, main configuration schema;~/.config/emacs/init.el, linux schema configuration.
basic configurations
Emacs configuration file is written in Elisp programming language. E(macs)lisp language belongs to the lisp programming language category.
Emacs configuration file is all about:
- configure features by setting variables;
- enable or disable features by calling functions.
setting variable value
(setq inhibit-startup-message t)setq, is a function;inhibit-startup-message, is a variable name;t, means true as at the contrarynilmeans false.
To evaluate a function:
- put the cursor inside of it and type
C-M-x; - put the cursor next to the last bracket and type
C-x C-e.
Tunrinig mode on or off
Setting mode on or off is all about set the variable with a positive or negative value, conventionally is to set -1 to disable or 1 to enable.
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)Load themes
(load-theme 'deeper-blue t)Basically setting true the variable related to said theme. The symbol ' before the variable tell Emacs Please do not evalute the following.
Some key-bindings
C-g, quit current undefined command;C-x C-f, open a file (also a new one);C-x C-s, save current file;C-M-x, evaluate function where cursor is inside;C-M-i, completion inside buffer;q, from inside a window (ususally) close the window.
Copy/cut and paste
C-SPC, start mark at point;<arrow-key>, to select a region;C-w, cut;M-w, copy;C-y, paste.
Getting help
C-h v,M-x describe-variable, show documentation for variable;C-h f,M-x describe-functions, show documentation for function;C-h o,M-x describe-symbol, start typing for search variables and functions.
Pressing C-h v or C-h f with coursor over a function or variable the default action is to show description of said variable/function.