Emacs Is Great!

Table of Contents

--mode:org; coding: utf-8;--

This is my Emacs configuration.

Fork on gitlab.

The init.el is being generated from this org-mode file on save so you won't find here a init.el.

1 Some initial settings

Make sure that we are using a coding system that can handle international characters

(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)

2 UI Tweaks

2.1 Menu-bar

Turn off the menu bar. It can still be accessed with F10.

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

2.2 Mode-line

2.2.1 TODO Keep the mode-line clean

Can use delight/diminish to hide minor-modes from the mode line

2.3 Scroll-bars

(scroll-bar-mode -1)

2.4 TODO don't bg unless in terminal.

3 DONE Package Manager / Use Package

3.1 Setting up package-archives and Install use-package

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)


3.2 TODO add custom packages

Need to be able to load packages that I install by hand or that I'm working on my self. Eventually I should move to something like borg.

(let ((libpaths (directory-files
                 (concat user-emacs-directory (convert-standard-filename "lib/")) t
  (dolist (libpath libpaths)
    (if (file-directory-p libpath)
        (push libpath load-path)
(unless (package-installed-p 'use-package )
  (package-install 'use-package ))

(require 'use-package)

3.3 DONE configure use package

Always ensure packages, so we don't have to specify, this is usually what we want.

(setq use-package-always-ensure t)

Use `ensure-system-package`, this will let us automatically install system binaries if they are missing.


(use-package use-package-ensure-system-package
  :ensure t)

3.4 TODO Make packages lazy loading

Right now using package-initialize will add a bunch of auto loaders so we lose the benifits of deffered loading.

3.5 TODO Advanced package management

  • Lazy loading / installing
  • Contribute back to packages
  • Options:
    • Quelpa : works package.el specify other branches
    • Borg : Treats all of your packages as git sub-modules.
    • Straight.el : Works from a init.el configuration ( like use-package ),but clones from the VC and allows to use custom forks. Looks a bit complicated though.

4 Customize

Using a custom file for customization

I want to move my location of customized variables so they don't get over written on tangle and so I can put environment specific settings in there.

(setq custom-file (locate-user-emacs-file "custom.el"))
(if (file-readable-p custom-file)
    (load custom-file))

5 Window Management

5.1 Ace-window

Ace window will let you jump quickly around windows. Use the prefix to switch, and 2x prefix to kill window.

ace-window-display-mode adds the window number to the mode line

(use-package ace-window
  :bind ("M-o" . ace-window)
  :config (ace-window-display-mode 1)

6 Editing

6.1 TODO pair editing

6.1.1 electric-pair/show-paren

makes inserting pairs easier. built in functions, I turn these off because using smartparens.

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

6.1.2 smartparens

Gives some great editing capabilities for pairs, it combines features from other pair editing packages, like paraedit.

(use-package smartparens
  :config (require 'smartparens-config)
  (show-smartparens-global-mode 1)
  (smartparens-global-mode 1)

6.1.3 expand region

Easily mark logical regions, much easier way to navigate pairs than remembering 100s of bindings for smartparens.

(use-package expand-region
  :commands ( er/expand-region er/contract-region )
  :bind  ("C-=" . er/expand-region)
  :bind  ("C--" . er/contract-region)
  :ensure t

6.2 TODO multiple cursors

6.3 I18n

6.3.1 Unicode fonts

(use-package unicode-fonts
  :ensure t
  (setq unicode-fonts-block-font-mapping '())
  (setf (alist-get "Hebrew" unicode-fonts-block-font-mapping nil nil 'string-equal) '(("Miriam Mono CLM:weight=bold"))
        (alist-get "Emoticons" unicode-fonts-block-font-mapping nil nil 'string-equal) '(("EmojiOne Color")))

6.3.2 Hebrew / Bidirectional text

  1. reordering

    Bidirectional automatic reordering hurts performance and is annoying, keep it off to start with, toggle on as needed.

    (setq-default bidi-display-reordering nil)
    (defun bidi-reordering-toggle ()
      "Toggle bidirectional display reordering."
      (setq bidi-display-reordering (not bidi-display-reordering))
      (message "bidi reordering is %s" bidi-display-reordering))
    1. Turn on automatically for text-mode.

      Most of the time, text mode will want to guess the right order for bidi text.

      (defun bidi-display-reordering-on ()
        "Sets bidi-display-reordering-on"
        (setq-local bidi-display-reordering t))
      (add-hook 'text-mode-hook 'bidi-display-reordering-on)
  2. Paragraph direction

    By default Emacs tries to guess the Paragraph direction for bidi-text. This ends up with mixed up looking buffers.

    (setq-default bidi-paragraph-direction 'left-to-right)
     (defun bidi-direction-toggle ()
       "Will switch the explicit direction of text for current
    buffer. This will set BIDI-DISPLAY-REORDERING to T"
       (interactive "")
       (setq bidi-display-reordering t)
       (if (equal bidi-paragraph-direction 'right-to-left)
           (setq bidi-paragraph-direction 'left-to-right)
         (setq bidi-paragraph-direction 'right-to-left)
       (message "%s" bidi-paragraph-direction))
  3. TODO get printing working

    see this mastodon conversation

    About type setting non Roman fonts.
    I have not been able to get Hebrew working. I am exporting from orgmode so that just makes it a bit more
     |   Yisrael Dov :emacs: (@yisraeldov) 2019-03-27 04:40:49
    @yisraeldov @xahlee You'll probably want to use XeLaTeX or LuaLaTeX. It's easy to set Hebrew or Arabic or the like.
     |   B. Slade :gnu: :emacs: (@_emacsomancer@linuxrocks.online) 2019-03-27 04:44:29
    Do you have an example of getting it to work with orgmode? I really appreciate it.
    I got emacs to print Hebrew but it comes out backwards, better than nothing.
     |   Yisrael Dov :emacs: (@yisraeldov) 2019-03-27 06:27:01
    @yisraeldov Try this:
    1) eval/use in your init.el:
    (setq org-latex-compiler "xelatex")
    2) Add the following to the header of your org file (or set your default LaTeX packages and header information in
    #+LATEX_HEADER: \usepackage{fontspec}
    #+LATEX_HEADER: \setmainfont{Noto Sans Hebrew}
     |   B. Slade :gnu: :emacs: (@_emacsomancer@linuxrocks.online) 2019-03-27 06:51:38
    @yisraeldov @xahlee (Or choose some other font in place of 'Noto Sans Hebrew')
     |   B. Slade :gnu: :emacs: (@_emacsomancer@linuxrocks.online) 2019-03-27 06:53:14
    @yisraeldov @xahlee Hmm... actually you may need a few other packages. Try:
    #+LATEX_HEADER: \usepackage{fontspec}
    #+LATEX_HEADER: \usepackage{polyglossia}
    #+LATEX_HEADER: \setdefaultlanguage{hebrew}
    #+LATEX_HEADER: \usepackage{bidi}
    #+LATEX_HEADER: \setmainfont{Noto Sans Hebrew}
    for headers (I'm not used to working with RtL scripts).

6.4 Autofill

Auto fill will hard wrap lines, good for non-programming modes, so lets turn it on for text modes.

(add-hook 'text-mode-hook 'turn-on-auto-fill)

7 Searching

7.1 Ag mode

Searching using AG, the silver searcher.

Using ripgrep instead:

(use-package ag
:commands (ag)
:config (setq ag-highlight-search t
              ag-group-matches nil

7.1.1 TODO conditionally enable ag if ripgrep is missing

7.2 Wgrep Mode

Allows editing of grep buffers, great tool for refactoring.

(use-package wgrep)

7.2.1 wgrep-ag

Only seems to work if results are not grouped, ag-group-matches set to nil.

(use-package wgrep-ag
:requires (ag)

7.3 Rip Grep

(use-package rg
:commands (rg rg-project rg-dwim ))

You may need to install the ripgrep executable.

I did this on Ubuntu 16.4 like this

curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep_0.10.0_amd64.deb
sudo gdebi ripgrep_0.10.0_amd64.deb

If you are in a newer version of Ubuntu or Debian it is in the repo so use apt-get install ripgrep, otherwise see the instructions above.

8 Spelling/Linting

8.1 Flyspell

(use-package flyspell
  :hook (
         (prog-mode . flyspell-prog-mode)
         (text-mode . flyspell-mode))

8.2 Flycheck

(use-package flycheck
  (defun disable-fylcheck-in-org-src-block ()
    "Disables flychecks that could be problematic in org-mode "
    (setq-local flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
  :hook ((prog-mode . flycheck-mode)
         (org-src-mode . disable-fylcheck-in-org-src-block))

8.2.1 TODO Don't complain about elips code-snippets

9 Org-mode

9.1 Get the newest version of orgmode

(use-package org
  :ensure org-plus-contrib
  :pin org

9.2 Configure org

9.2.1 make fonts nice in code snippets

This will use the native fonts for source code snippets and make your org look cool

(setq org-src-fontify-natively t)

9.2.2 get back easy templates

(require 'org-tempo)

9.2.3 Add more Languages to bable

 '((emacs-lisp . t)
   (python . t)))

9.2.4 org-capture

  1. org-protocol


    (require 'server)
    (unless (server-running-p) (server-start))
    (require 'org-protocol)
    (customize-set-value 'org-capture-templates
                         '(("t" "Task" entry (file+headline "" "Tasks")
                            "* TODO %?\n  %u\n  %a")
                           ("n" "Note" entry (file+headline "" "Inbox")
                            "* %? %a \n %i")

9.3 org-sync

This will allow you to sync tasks/todos in an orgmode file to some external task manager, like gitlab. (I contributed to this)

(use-package org-sync
  :config (require 'org-sync-gitlab)
  (setq org-sync-gitlab-auth-token (secrets-get-secret "Login" "yisraeldov^forge @ gitlab.com/api/v4"))

10 Task Juggler

(use-package tj3-mode)

11 Auto-complete

11.1 DONE auto-complete

I currently use auto-complete and it works fine, but it hasn't been updated in a long time

Add to the list ac-sources to get more default auto-complete sources.

(use-package fuzzy )
(use-package auto-complete
  :after fuzzy
  (setq ac-use-fuzzy 1)
  (add-to-list 'ac-sources 'ac-source-yasnippet)
  (global-auto-complete-mode -1))

11.1.1 Get fuzzy matching to work.

Fuzzy matching will only work when you manually call the auto-complete function.

11.2 YA-Snippets

(use-package yasnippet-snippets)

11.3 Company

company is an alternative auto completion framework. It is more active than auto-complete and there are many newer packages that prefer or only support company.

Also it is what jweigly, purcell and bbatsov use, so it must be good.

(use-package company
  ;; manually enable company for now
  (setq company-tooltip-align-annotations t
        company-minimum-prefix-length 1
        company-idle-delay 0.1)

  ;; Use builtin faces instead of ugly ones set by company
     ((t (:foreground "darkgray" :underline t))))
     ((t (:inherit company-preview :weight bold))))
     ((t (:inherit popup-face))))
     ((t (:inherit popup-scroll-bar-background-face))))
     ((t (:inherit popup-scroll-bar-foreground-face))))
     ((t (:inherit popup-menu-selection-face))))
     ((((type x)) (:inherit company-tooltip :weight bold))
      (t (:inherit company-tooltip))))
     ((((type x)) (:inherit company-tooltip-selection :weight bold))
      (t (:inherit company-tooltip-selection)))))
  (global-company-mode 1) ;; why is nil to enable and t Disables

11.3.1 TODO Try company packages

  1. TODO company-quickhelp
  2. TODO company-flx
  3. TODO company-statistics
  4. TODO prescient
  5. TODO company-box requires emacs 26

12 Figlet / Other demo type stuff

12.1 TODO Use figlet to make the banners

12.2 Command Log Mode

Command log mode will show the Emacs commands and key used in a separate buffer. I prefer this to something like screen key because not everyone is going to have the same keys bound to the same commands. Additionally it isn't going to show passwords or spam you with arrows.

(use-package command-log-mode
  :commands (command-log-mode)
  :bind ("C-c o" . clm/toggle-command-log-buffer)

12.3 Screen Shot

Will take a screeshot of the current frame

(defun screenshot-frame ()
  "Takes a screenshot of the current frame. Requires imagemagic. "
  (let (screenshot-file)
    (setq screenshot-file (format "~/Pictures/screenshot-%s.png" (format-time-string "%FT%H%M%S")))
    (start-process "screenshot" "*screenshot*"
                   "import" "-window" (frame-parameter (selected-frame) 'outer-window-id)
                   (expand-file-name screenshot-file)

12.4 font scalling

by default text-scale only works on the current buffer, when doing demos it is good to be able to increase the font size everywhere.

12.4.1 default-text-scale

This will let you increase the size of the default font.

I don't want it on all the time, only before doing demos.

(use-package default-text-scale)

12.5 demo-setup

This is a function for setting up demo environment.

(defun demo-setup (arg)
  "Sets up some defaults for running demos"
  (interactive "P")
  (global-command-log-mode 1)
  (clm/open-command-log-buffer 1)
  (default-text-scale-increment 30)

13 Projectile

For managing projects (not project management)

(use-package projectile
  :config (projectile-mode 1)
  (use-package counsel-projectile
    :after counsel
    :config (counsel-projectile-mode))
  (setq projectile-project-search-path '("~/Projects"))
  (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
  (define-key projectile-mode-map (kbd "C-c C-p") 'projectile-command-map)
  (projectile-register-project-type 'phpspec '("phpspec.yml")
                                  :compile "phpspec run"
                                  :test "phpspec run"
                                  :test-suffix "Spec"
                                  :test-dir "spec/"
                                  :src-dir "src/"))

14 Convenience/Matching

14.1 ivy/counsel

Flx package makes ivy matching better

(use-package flx)

Settings for ivy

(use-package ivy
  :defer 0.1
  :config (ivy-mode)
  (setq ivy-initial-inputs-alist nil)
  (setq ivy-re-builders-alist
        '((t . ivy--regex-fuzzy)))

Setting counsel mode

(use-package counsel
  :config (counsel-mode)
  :defer 1

15 Version control / git

15.1 magit

Magit is an interface to git. This is a must have. It is probably the best git interface that exists. Use C-x g to launch.

15.1.1 Xah Lee doesn't know what he is talking about.

  1. Formatting of commit messages

    Magit provides some nice hints so that you follow proper formatting conventions in your commit messages. Xah, thinks this is "idiocy." Maybe it is that he doesn't understand.

    Also I assume that all this can be disabled!

    1. 70 Char line width

      Xah things this is a stupid convention, but it's there for good reason, so that we can easily read on the terminal or other text based UI.

    2. Break between first and rest lines

      This breaks up the "subject" of the commit and any notes.

    3. Prompting you not to be an idiot.

      If you try to make a commit that doesn't follow conversions, magit asks you to confirm (that you really are an idiot.)

15.1.2 Installing magit

(use-package magit
  :commands ( magit-status)
  :bind ("C-x g" . magit-status)

15.2 TODO magit forge

(use-package forge
  :after magit
  (setq ghub-use-workaround-for-emacs-bug nil) ;; fixies an issue where are workaround breaks gitlab
  ;; https://github.com/magit/forge/issues/140
  (setq forge-topic-list-columns ;; get more details in the list of topics
        '(("#" 5
           (lambda (a b)
             (> (car a) (car b)))
           (:right-align t) number nil)
          ("Title" 35 t nil title  nil)
          ("Milestone" 4 t nil milestone nil)
          ("State" 4 t nil state nil)
          ("Updated" 10 t nill updated nil)
  (defun forge-create-secret-auth ()
    "Prompts for and creates the git forge secret. Mostly for gitlab."
         (repo (forge-get-repository 'full))
         (host (oref repo apihost))
         (username (ghub--username host  'gitlab))
         (user (concat username "^forge"))
      (setq token (read-passwd (format "Enter your token for %s @ %s: " username host)))
       "Login" (format "%s @ %s" user host)
       :host host
       :user user

See: https://github.com/magit/ghub/issues/89

15.3 live git info

(use-package diff-hl
:ensure t
(global-diff-hl-mode 1)
(diff-hl-flydiff-mode 1)
(unless (display-graphic-p) (diff-hl-margin-mode 1))
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)

15.4 Quicker commits.

Sometimes working with Magit can be too slow. If you want to do a quick, stage,and commit of the current file you can use the built in vc-next-action, by default it is bound to C-x v v.

15.5 Gitlab

15.5.1 gitlab-ci

(use-package gitlab-ci-mode)

15.5.2 gitlab auto complete

(use-package ac-gitlab
  :load-path "lib/ac-gitlab"
  :hook ((git-commit-mode . ac-gitlab-set-up)
         (forge-post-mode . ac-gitlab-set-up)
         (markdown-mode . ac-gitlab-set-up))
  (add-to-list 'ac-modes 'git-commit-mode)
  (add-to-list 'ac-modes 'forge-post-mode)
  (add-to-list 'ac-modes 'markdown-mode)

16 TODO docker

Highlighting for docker files and dockercompose.yaml

(use-package dockerfile-mode)
(use-package docker-compose-mode)

There is a mode for interacting with docker.

(use-package docker)

17 Rainbow-mode

Show colors for color strings like #fff or red depending on the mode.

(use-package rainbow-mode
:hook (prog-mode . rainbow-mode ))

18 Languages

18.1 Emacs-lisp

18.1.1 TODO litable

Cool looking package that shows live "light-table" results of elisp.

For some reason I can't get it to work

(use-package litable
:commands (litable-mode))

18.2 Common Lisp

18.2.1 Slime

SLIME is the ``Superior Lisp Interaction Mode for Emacs.''

SLIME extends Emacs with support for interactive programming in Common Lisp. The features are centered around slime-mode, an Emacs minor-mode that complements the standard lisp-mode. While lisp-mode supports editing Lisp source files, slime-mode adds support for interacting with a running Common Lisp process for compilation, debugging, documentation lookup, and so on.

(use-package slime
  :config (setq inferior-lisp-program "ecl"))

18.3 Web-mode

web-mode.el is an autonomous emacs major-mode for editing web templates. HTML documents can embed parts (CSS / JavaScript) and blocks (client / server side).

(use-package web-mode)

18.4 PHP

You will need to have Composer installed for most of this to work.

18.4.1 PHP-mode

Gives highlighting and other basic php editing stuff.

(use-package php-mode
  :mode (("\\.php\\'" . php-mode))
  (setq php-mode-coding-style (quote psr2))
  (setq php-search-documentation-browser-function 'eww-browse-url )
  (setq php-style-delete-trailing-whitespace 1)
  :hook ((php-mode. ydl/php-mode-hook-for-ac)
  (php-mode . subword-mode))

18.4.2 Linting

  1. Be sure that you have all of the linters installed
    composer global require --prefer-source -n phpmd/phpmd \
     squizlabs/php_codesniffer \
     phpunit/phpunit \
    composer global update --prefer-source
  2. Set up paths for linters/tools to use the composer version
        (file-exists-p "~/.config/composer/vendor/bin" )
        (setq flycheck-php-phpcs-executable "~/.config/composer/vendor/bin/phpcs"
              flycheck-php-phpmd-executable "~/.config/composer/vendor/bin/phpmd"
              phpcbf-executable "~/.config/composer/vendor/bin/phpcbf"
              phpunit-program "~/.config/composer/vendor/bin/phpunit")
      (warn "Can't find composer bin directory, some tools might not work")
  3. Configure php-codesniffer
    (setq flycheck-phpcs-standard "PSR12")
  4. PHP code beautifier

    Keeps our code up to standards when possible

    (use-package phpcbf
      :after php-mode
      :commands (phpcbf)
      :ensure t
      :hook (php-mode . phpcbf-enable-on-save)
  5. PHPstan
    (use-package flycheck-phpstan
      :after php-mode
      :ensure nil
      (setq-default phpstan-level "max")
      ;; without this phpstan clobbers other checkers
      (flycheck-add-next-checker 'php 'phpstan) 
      (flycheck-add-next-checker 'phpstan 'php-phpmd)

18.4.3 PHP auto complete

Getting auto-complete running can be a bit of a challenge

(use-package ac-php
  :after php-mode
  :init (setq ac-php-auto-update-intval 180)
  :commands (ac-php-core-eldoc-setup ac-php-remake-tags ac-php-remake-all-tags)
  :config (defun ydl/php-mode-hook-for-ac ()
            "Sets up ac-php"
            (yas-global-mode t)
            (auto-complete-mode t)
            (setq ac-sources  '(
                        ac-source-yasnippet ))
  :bind ((:map php-mode-map
               ;;original bindings
               ("C-]" . ac-php-find-symbol-at-point)
               ("C-t" . ac-php-location-stack-back)
               ;;overwrite the xref bindings
               ("M-." . ac-php-find-symbol-at-point)
               ("M-," . ac-php-location-stack-back)
  :hook (
         (php-mode . ydl/php-mode-hook-for-ac)
         (php-mode . ac-php-remake-tags)
         (projectile-idle-timer . ac-php-remake-tags)

18.4.4 PHP actor

#+beginsrc emacs-lisp


18.5 SQL

18.5.1 TODO sql repl

18.5.2 TODO sql in orgmode

18.6 Markdown

(use-package markdown-mode)

18.7 Python

18.7.1 Virtual Environment

(use-package virtualenvwrapper
:config (setq projectile-switch-project-action 'venv-projectile-auto-workon)

18.7.2 Poetry mode

(use-package poetry)

18.7.3 Anaconda

Anaconda mode provides the following features

  • context-sensitive code completion
  • jump to definitions
  • find references
  • view documentation
  • virtual environment
  • eldoc mode
  • all this stuff inside vagrant, docker and remote hosts
(use-package anaconda-mode
  :hook ((python-mode . anaconda-mode)
         (python-mode . anaconda-eldoc-mode)))
  1. company-anaconda

    Provides auto completion from Anaconda

    (use-package company-anaconda
      :after company
      :config (push '(company-anaconda :with company-capf) company-backends))
  2. TODO Start inferior-python when trying to run code, if not running.

18.7.4 Auto Completing

  1. Jedi-mode

    Doesn't work so well with Virtual Environment, and not with tramp.

    (use-package jedi
      ;; Standard Jedi.el setting
      :hook ((python-mode . jedi:setup))
      :init (setq jedi:complete-on-dot t)
      :config (jedi:install-server)
      ((jedi . "pip install jedi")
       (virtualenv . "pip install virtualenv")
       (epc . "pip install epc"))
  2. Anaconda

18.7.5 Elpy

There is a built in python mode but, to use elpy to get more IDE like stuff. It is too opinionated for me, wants company and flymake.

(use-package elpy
  :ensure t
  :defer t
  (advice-add 'python-mode :before 'elpy-enable)
  ((pip )
   (jedi   . "pip install jedi")
   (flake8 . "pip install flake8")
   (autopep8 ."pip install autopep8")
   (yapf . "pip install yapf")
   (black . "pip install black")))

18.7.6 Hy-lang

(use-package hy-mode
  ((jedhy . "pip3 install jedhy")))

18.8 Clojure

18.8.1 Cider

CIDER is the Clojure(Script) Interactive Development Environment that Rocks!

(use-package cider :pin melpa-stable)

18.8.2 Linting

  1. clj-kondo

    A linter for Clojure code that sparks joy.

    ;; First install the package:
    (use-package flycheck-clj-kondo
      :ensure t)
    ;; then install the checker as soon as `clojure-mode' is loaded
    (use-package clojure-mode
      :ensure t
      (require 'flycheck-clj-kondo))

18.9 Systemd

(use-package systemd)

19 Superfluous eye-candy

19.1 Icons

19.1.1 All-the-icons

(use-package all-the-icons)

first time need to run:

  1. Ivy all-the-icons

    Get some icons in ivy

    (use-package all-the-icons-ivy
    :init (all-the-icons-ivy-setup)
  2. Dired all-the-icons

    Adds file icons in dired-mode.

    (use-package all-the-icons-dired
      :hook (dired-mode . all-the-icons-dired-mode))

19.2 Color Emoji

You can have emojis in emacs! No need for VS code! :smile:

(use-package emojify
  :config (if (display-graphic-p)
               (setq emojify-display-style 'image)
             (setq emojify-display-style 'unicode)
             (setq emojify-emoji-set "emojione-v2.2.6")
  :init (global-emojify-mode 1))

19.2.1 TODO Auto install custom emojis

There are lots of sites that can use custom emojis, I'd like to dynamically download and install them into emojify.

For example mastodon.

They have an api for fetching emojis.

Emojify has the variable emojify-user-emojis that can be used for adding custom emojis.

For now emojify-logos adds a bit more.

(use-package emojify-logos
:after emojify)

19.2.2 Auto complete emojis

(use-package ac-emoji
  :init (ac-emoji-setup))

20 TODO Make source code blocks default to emacs-lisp

20.1 YA-Snippets

Turned on yasnippet auto-complete.

20.2 Autocomplete orgmode

This will auto complete in orgmode, but uses AutoComplete and trying to switch to company.

(use-package org-ac
  :init (org-ac/config-default))

20.2.1 TODO Conditionally enable org-ac if using ac

20.3 TODO builtin shortcuts

20.4 TODO smartparens

21 TODO Time tracking

21.1 TODO wakatime

Be sure that the app is installed, this is done with ensure-system-package.

pip3 install wakatime

Need to be sure that your API key is set, I set mine in the wakatime config file, .wakatime.cfg.

The documentation says that you will be prompted for API key but I found that wasn't the case.

(use-package wakatime-mode
  :ensure-system-package (wakatime . "pip install wakatime")
  :custom                (wakatime-cli-path (executable-find "wakatime")) ;; find the pip version of wakatime
  :init                  (global-wakatime-mode))

21.2 TODO Activity watch

You need to have activity watch installed for this


(use-package activity-watch-mode
  :init (global-activity-watch-mode))

22 notifications

(use-package notifications
  :config (notifications-notify
           :title "Notifications"
           :body "Notifications enabled"
           :timeout 3000)

22.1 Compile finish

(defun notify-after-compile (comp-buffer exit-string)
  "notify when compile is done."
  (let ((successful (not (string-match-p "exited abnormally" exit-string))))
       (notifications-notify :title "compile"
                             :body (concat
                                    (if successful "✅" "⛔")
                                    (buffer-name comp-buffer) " : " exit-string)
                             :timeout 5000
                             :urgency (if successful `low `critical) 
(add-hook 'compilation-finish-functions 'notify-after-compile)

23 Communication/Internet

23.1 RSS

(use-package elfeed
  :commands (elfeed)
  :bind ((:map elfeed-show-mode-map
               ("p" . browse-url-mpv-open)))

23.2 Mastodon

(use-package mastodon)

23.3 Twitter

(use-package twittering-mode)

Be sure to set mastodon-instance-url

23.4 Web Browsing

Using the w3 browser for better browsing experience .

(use-package w3m
  :config (setq w3m-key-binding 'info) ;; don't use stupid vim bindings
  :commands (w3m))

24 Media

24.1 Video ( You Tube )

24.1.1 Searching YouTube

Using the elfeed method of browsing youtube does not let you search. The package ivy-youtube can search and play. You need to set up ivy-youtube-key with a google api key. I used customize so that it gets stored separately from init.el.

By default it will open the browser, using ivy-youtube-play-at you can use an external application, like mpv.

(use-package ivy-youtube
  :config (setq ivy-youtube-play-at "mpv")
  :commands (ivy-youtube)

24.1.2 Watch media urls with mpv

For this to work correctly you need to have mpv installed.

If you want to watch youtube videos using mpv, you will need to have youtube-dl installed. You can add the option --mark-watched to have it mark the videos as watched, but you will need to have a way to authorise youtube-dl to user your youtube account.

(defun browse-url-mpv-open (url &optional ignored)
  "Pass the specified URL to the \"mpv\" command.
xdg-open is a desktop utility that calls your preferred web browser.
The optional argument IGNORED is not used."
  (interactive (browse-url-interactive-arg "URL: "))
  (call-process "mpv" nil 0 nil url))

24.2 Pdf

24.2.1 pdf-tools

(use-package pdf-tools
  :config (pdf-tools-install)

24.2.2 org-pdf-view

(use-package org-pdfview
  :after org)

(use-package pdfgrep)

25 Financial

25.1 Ledger

(use-package hledger-mode
  :config (add-to-list 'ac-modes 'hledger-mode)
           (add-hook 'hledger-mode-hook
                     (lambda ()
                       (setq-local ac-sources '(hledger-ac-source)))))

(use-package flycheck-ledger
   :pin melpa-stable
   :after flycheck)

26 Local Variables

Author: Yisrael Dov

Created: 2020-09-29 Tue 13:27