All Projects → analyzeninvest → configuring-emacs-from-scratch

analyzeninvest / configuring-emacs-from-scratch

Licence: other
This is a repo for the video series on configuring emacs from scratch

Programming Languages

emacs lisp
2029 projects
python
139335 projects - #7 most used programming language
YASnippet
69 projects

Configuring Emacs from scratch

The small wisdom is like water in a glass: clear, transparent & pure. The great wisdom is like the water in the sea: dark, mysterious, impenetrable. -Rabindranath Tagore

Hello everyone,

I am using Emacs since 2015. Overtime the configuration file had grown to be a large 1000 line file with keybindings I do not use anymore & macros that were replaced by modern packages with newer features.

So, this got me thinking “let me clean it up!”; issue was- inertia. I didn’t wanted to clean packages one by one & fix the startup. Eventually I decided to delete my .Emacs & make a new one.

I had an even better idea. Make it a video series & post it on relevant forums. Thus I started creating the video series on: “configuring Emacs from scratch”.

In the following section, I will update my journey with the video & description for the same. This will include:

  • a small summery of the packages that I install
  • a brief description of the settings I change
  • reason for not including any specific package.

This is my effort to make the Emacs configured from scratch. Hope you like it.

Video 1: (setting up init file & org file for literate programming)

In the first video, I start by deleting my previous .emacs.d directory. Then I start by creating the init.el & settings.org file. The init.el file contained the org-babel for elisp code blocks used in settings.org file.

I liked the idea of literate programming. So org mode with the org-babel tangle feature got me really exited. Thus this became the first video on how to do so.

In the settings, I always enjoy the full screen Emacs editing with no GUI mouse click options. Thus following settings are made:

  • disable menu bar, tool bar, scroll bar, init splash screen
  • enable global linum mode
  • no auto save file

./snapshot/snap.jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Patreon

Video 2: (IDO)

In the next video, continuing with the trend, IDO (interactive Do) mode specific things are set. It is a mode that does things interactively. E.g. if I need to find a file, by default Emacs will not show the files in the directory, it only shows after 2 tabs are pressed. This is solved by IDO with a linear list of files or directory separated by ‘|’ character.

./snapshot/snap(1).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 3: (melpa package repo, ido grid mode)

In this section, I set up the melpa package repository for Emacs to load the packages. Form the repository, I installed the package for displaying the IDO find files with a grid mode, rather than the default linear one.

./snapshot/snap(2).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 4: (Themes & org bullets)

In this one, I set up the theme for the Emacs. I like to choose the theme, based on the readability of the code. I like dark contrasting colors for that job. Also I really like the org bullets package for making some cool bullets for org mode.

./snapshot/snap(3).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 5: (key bindings & other setup)

Keybinding is one of the important aspect of the Emacs. In this video I remap some of the keybindings:

  • hippie-expand
  • backward-kill-word
  • backward-delete-char
  • replace-string
  • replace-regex
  • count-matches

./snapshot/snap(4).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 6: (ivy + counsel + swiper)

The default isearch, M-x, switch-buffer of Emacs is nice, but to make it nicer, ivy + swiper (replacement of isearch) + counsel (replacement of find-file switch-buffer etc). I set the keybindings for the swiper but do not replace the find-file. I like the IDO feature for the find file.

./snapshot/snap(5).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 7: (magit)

In this video, I install & set up magit. Magit or Emacs got git is a great package for using git inside Emacs.

./snapshot/snap(6).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 8: (iedit & paredit)

For the 8Th video, I am setting up 2 very useful packages for coding.

  1. iedit:

iedit is for interactive editing. Say we need to edit the name of the variable in a defun/buffer. For that we can interactively search & replace. I find it better to use the iedit package. If I place the point below the symbol & start iedit, it replaces the symbol in the buffer. Same can be done with line, defun or in a region with narrow-region.

  1. paredit:

paredit is most useful when we use the elisp codes. It has many useful features like keeping braces & quotes balanced, burfage / slurpage of the braces, joining 2 sexp, splitting 2 sexp, making escape string etc to name a few.

./snapshot/snap(7).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 9: (company anaconda company-quickhelp company-anaconda)

Next, we need to have some sort of autocomplete features in Emacs while coding. There are 2 primary packages for doing that job:

  1. auto-complete
  2. company

Both packages are great, but personally I like company mode better. This does come with a drawback. To get all the features in autocomplete in Python, we need some more packages, namely:

  1. company-quickhelp: for displaying the doc string
  2. anaconda: for running python based autocomplete
  3. company-anaconda: for running anaconda with company

But overall I find it useful.

./snapshot/snap(8).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 10: (yasnippets with company)

In order to get some quick scripting in Emacs, we installed the package called yasnippets (yet another snippets).

The default package for yasnippets do not contain any snippets. For that, we need yasnippets snippets.

Now by default, it is expected to work seamlessly with [tabs] but that kind of conflicts with the company mode’s auto feature sometime. What I found was, we need to have an extra space to get it working. I did not lie that behaviour. So I bounded it to M-z which by default is zap-to-char, but I hardly needed that feature, so I remapped it.

./snapshot/snap(9).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Video 11: (hilight-indent-guides)

In this video, after describing the org mode readme to Github; I am showing a minor package for highlighting the indentation in the Python code. This is useful as for languages that depend on the indentation, it is handy to see the different indentation levels.

./snapshot/snap(10).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

video 12: (orgmode contrib package)

In this video, I am showing the demo on how to install orgmode contrib packages from Emacs. I am showing the demo for taskjuggler install and org-export for the same. A quick demo for the taskjuggler is also shown.

Also, lately while coding in elisp, I found that some of the paredit bindins are not available. So I am setting them too in this video.

./snapshot/snap(12).jpg

Related links for this video

settings org file

YouTube

Org contrib

DTube

Reddit

video 12: (hide show mode)

In this video, I am setting up hide-show minor mode. This is really helpfull navigating large codes and helpfull for viewing only the intended function’s definations.

./snapshot/snap(14).jpg

Related links for this video

settings org file

YouTube

DTube

Reddit

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].