A super cool method to set the configuration of emacs, following DistroTube
Emacs requires tweaking the init.el
file in the .emacs.d
dir in home
init.el
is written in emacs-lisp and a bit obscure to understand
One can use the wonderful emacs org-mode
to code the init.el
by using an auxiliary config.org
placed in any directory
The steps are described below (generated by emacs org-mode)
In addition to set a proper configuration, it also useful to use emacs as a client, which speeds up running emacs.
This is done, first running the emacs daemon
/usr/bin/emacs --daemon
And then any time we launch emacs we use
emacsclient -c -a 'emacs'
In Linux systems, the emacs daemon can be launched at startup by adding the service to the systemd
as detailed here
Table of Contents
1 How to configure emacs by a emacsconfig.org file
1.1 Set your init.el in .emacs.d
Write the following init.el in .emacs.d
(org-babel-load-file
(expand-file-name
"~/org/emacsconfig.org"
user-emacs-directory))
Here emacsconfig.org is the org configuration file with its path You can set any file
In this file we have various functions
- Org Babel
Org Babel is a wonderful tool to use different languages in a single org file
- org-babel-load-file
Loads Emacs Lisp source blocks in the org file
- expand-file-name
Replace the file name with absolute path
- user-emacs-directory
Is the directory where the Emacs-specific files are placed .emacs.d typically, where the search of the file starts
1.2 Write emacsconfig.org
In the .org file for the configuration we will write different parts as pieces of emacs lisp code. For example
* FRAME SIZE #+begin_src emacs-lisp (add-to-list 'default-frame-alist '(width . 180)) (add-to-list 'default-frame-alist '(height . 90)) #+end_src * FONTSIZE #+begin_src emacs-lisp (set-face-attribute 'default (selected-frame) :height 150) #+end_src