This repository holds my emacs configuration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
merazi 2fa4c368c9 May 25 3 weeks ago
.gitignore Emacs configuration files 2 months ago [Symlink to] Show my config just by opening the repo 1 month ago
init.el 2021-05-07 1 month ago May 25 3 weeks ago


GUI Tweaks

Disable the startup screen.

  (setq inhibit-startup-screen t)

Add a useful title to the emacs frame.

  (setq-default frame-title-format '("%b"))

Disable some GUI elements.

  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tool-bar-mode -1)

Enable cursor blinking

  (blink-cursor-mode 1)

I like the default emacs theme, but the highlighted text color is too low contrast… Hey! This is the extensible text editor, I can tweak anything 😃

  (set-face-attribute 'region nil :background "#ccc")

I find the fringe to be useful, if you don't want it you can set it to minus one.

  (fringe-mode 6)

I like this font.

  (set-frame-font "Noto Sans Mono-10")

Move the custom file

I don't want it to clutter init.el

  (setq custom-file "~/.config/emacs/custom.el")
  (load-file custom-file)

Custom keyboard shortcuts

Easier window resizing.

  (global-set-key (kbd "<C-up>") 'shrink-window)
  (global-set-key (kbd "<C-down>") 'enlarge-window)
  (global-set-key (kbd "<C-left>") 'shrink-window-horizontally)
  (global-set-key (kbd "<C-right>") 'enlarge-window-horizontally)

Editing behaviour

This will allow me to just say y or n, instead of having to type "yes" or "no" each time.

  (fset 'yes-or-no-p 'y-or-n-p)

This will clean all the whitespace on the document each time I save. It only affects trailing whitespace, it doesn't affect new lines or indentation.

  (add-hook 'before-save-hook 'whitespace-cleanup)

For some reason, if I select some text and start typing, emacs doesn't replace the selected text. This tweak changes that behaviour.

  (delete-selection-mode 1)

I don't want my lines to get truncated. I preffer having to scroll in order to see the long lines instead of having them truncated on the next line.

  (set-default 'truncate-lines t)

I don't find lockfiles that useful, if you wan you can set the variable back to t.

  (setq create-lockfiles nil)

Complete and show pairs like parentheses, braces, brackets, quotes and greater/less than.

  (electric-pair-mode 1)
  (show-paren-mode 1)


Move the autosave files (~).

  (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))

Package configurations


This will allow me to have nice looking icons on the modeline.

  (use-package all-the-icons :ensure t)


This allows emojis to be displayed on emacs.

  (use-package emojify :ensure t
    (global-emojify-mode t))


My org mode config, right now it just has python stuff…

  (use-package org :ensure t

    ;; Add python to the execute list
'((python . t)))

    ;; Some keyboard shortcuts
    (global-set-key "\C-cl" 'org-store-link)
    (global-set-key "\C-ca" 'org-agenda)
    (global-set-key "\C-cc" 'org-capture)
    (global-set-key "\C-cb" 'org-switchb)

    ;; Set the path for the python executable
    (setq org-babel-python-command "~/.guix-profile/bin/python3")

    ;; Separate the Cover page, TOC and Content on org-mode latex export
    (setq org-latex-toc-command "\\clearpage \\tableofcontents \\clearpage"))

rainbow Mode

Shows css colors, very useful for editing css or similar.

  (use-package rainbow-mode :ensure t
    (global-set-key (kbd "C-x c") 'rainbow-mode))


Better completion for emacs.

  (use-package ivy :ensure t
    (ivy-mode 1))


An ido-like mode for M-x.

  ;;     (use-package smex :ensure t
  ;;       :config
  ;;       (global-set-key (kbd "M-x") 'smex)
  ;;       (global-set-key (kbd "M-X") 'smex-major-mode-commands)
  ;;       ;; the old M-x prompt
  ;;       (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command))


I use this so I can have syntax highlighting on gitignore files.

  (use-package gitignore-mode :ensure t)


  (use-package telega :ensure t
    (setq telega-use-docker t))


Magit is an interface to the version control system Git, implemented as an Emacs package.

  (use-package magit :ensure t)


This will do syntax checking for several languages.

  (use-package flycheck :ensure t
    (global-flycheck-mode t))


An improved search utility for emacs. I really enjoy using it as it is very satisfactory.

  (use-package swiper :ensure t
    (global-set-key "\C-s" 'swiper))


An improved mode for html, css, javascript and other web languages.

  (use-package web-mode :ensure t
    (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)))


This package shows a help buffer for the current key chord.

  (use-package which-key :ensure t


Give presentations in org-mode!

  (use-package org-tree-slide :ensure t
    (org-tree-slide-slide-in-effect t)
    (org-tree-slide-activate-message "Presentation started!")
    (org-tree-slide-deactivate-message "Presentation finished!")
    (org-tree-slide-header t)
    (org-tree-slide-breadcrumbs " > ")
    (org-image-actual-width nil))

User functions

I'll be adding more user functions here.

Reload the configuration file

  (defun reload-config ()
    (load-file (concat user-emacs-directory "init.el")))

Emacs own beacon

This was suggested by Lusco over on Telegram, thank you!

  (defun pulse-line (_)
    (pulse-momentary-highlight-one-line (point)))
  (setq window-selection-change-functions '(pulse-line))