Index Emagician Base Install Meta Interface Programming Text Org Lamp Journal Snippets jonnay.netFork on Github

Lisp

Table of Contents

1 Set up a generalized Lisp mode hook

(defvar generic-lisp-mode-hook '()
  "Generic lisp hooks to run")
(defun run-lisp-mode-hooks ()
  "Run standard lisp mode hooks"
  (run-hooks 'generic-lisp-mode-hook))
(dolist (hook '(scheme-mode-hook clojure-mode-hook lisp-mode-hook emacs-lisp-mode-hook))
  (add-hook hook 'run-lisp-mode-hooks))

2 Editing

2.1 Paredit

(use-package paredit
  :ensure t
  :diminish "⒫"
  :init
  (emagician/minor-in-major-mode paredit-mode generic-lisp-mode-hook))

2.2 Smart Parens

Turn this shit off on lisps

(add-hook 'generic-lisp-mode-hook #'turn-off-smartparens-mode t)

3 Individual Lisps

3.1 Elisp

3.1.1 Editing

3.1.1.1 Highlighting
(with-eval-after-load 'dash
  (dash-enable-font-lock))
3.1.1.2 Eldoc
(use-package eldoc
  :diminish ""
  :init 
    (setq eldoc-idle-delay 0.1)
    (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
  :config
    (set-face-attribute 'eldoc-highlight-function-argument nil
                        :underline t :foreground "green"
                        :weight 'bold))
3.1.1.3 Auto Complete
(emagician/defhook emagician/ac-set-elisp-sources emacs-lisp-mode
  (setq ac-sources
        '(ac-source-yasnippet
          ac-source-functions
          ac-source-features
          ac-source-variables
          ac-source-symbols
          ac-source-files-in-current-dir
          ac-source-words-in-buffer
          ac-source-words-in-same-mode-buffers)))
3.1.1.4 Indentation
(put 'use-package 'lisp-indent-function 1)
(put 'lexically 'lisp-indent-function 0)
3.1.1.5 Package checking
(use-package flycheck-package
  :config 
  (flycheck-package-setup))
3.1.1.5.1 Turn off in orc-src buffers

Don't flycheck in emacs-lisp-mode org-src buffers! SO ANNOYING!

(emagician/defhook turn-off-flycheck-in-emacs-lisp org-src-mode-hook
  (when (equal mode-name "Emacs-Lisp")
    (flycheck-mode -1)))

3.1.2 Environment

3.2 Scheme

3.2.1 Editing

3.2.1.1 Intenting
;; Indenting module body code at column 0
(defun scheme-module-indent (state indent-point normal-indent) 0)
(put 'module 'scheme-indent-function 'scheme-module-indent)

(put 'and-let* 'scheme-indent-function 1)
(put 'parameterize 'scheme-indent-function 1)
(put 'handle-exceptions 'scheme-indent-function 1)
(put 'when 'scheme-indent-function 1)
(put 'unless 'scheme-indent-function 1)
(put 'match 'scheme-indent-function 1)

3.2.2 Interface

3.2.2.1 Geiser REPL
(use-package geiser
  :init
  (setq geiser-active-implementations '(chicken))
  :config 
  (emagician/defhook emagician/ac-set-scheme-sources scheme-mode-hook))

Author: Jonathan Arkell

Created: 2018-05-18 Fri 10:30

Validate