http://howardism.org/Technical/Emacs/literate-programming-tutorial.html
https://github.com/limist/literate-clojure-ants
RAW: https://raw.githubusercontent.com/limist/literate-clojure-ants/master/literate-ants.org
| ;; https://gist.github.com/tangrammer/5959b2c422e884451d144830e296e3b9 | |
| ;; http://emacsrocks.com/ | |
| ;; https://cider.readthedocs.io/en/latest/additional_packages/ | |
| ;; http://fgiasson.com/blog/index.php/2016/06/14/my-optimal-gnu-emacs-settings-for-developing-clojure-revised/ | |
| (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
| ("marmalade" . "https://marmalade-repo.org/packages/") | |
| ("melpa" . "https://melpa.org/packages/"))) | |
| (package-initialize) | |
| ;; remove tool-bar | |
| (tool-bar-mode 0) | |
| ;; osx keys | |
| (setq default-input-method "MacOSX") | |
| (setq mac-command-modifier 'meta) | |
| (setq mac-option-modifier 'none) | |
| ;;(global-linum-mode 1) | |
| ;; Emacs package that displays available keybindings in popup | |
| ;; https://github.com/justbur/emacs-which-key | |
| (which-key-mode) | |
| (which-key-setup-side-window-right) | |
| ;; CIDER related | |
| (add-hook 'cider-repl-mode-hook #'eldoc-mode) | |
| ;; autocompletion | |
| (global-company-mode) | |
| (global-set-key (kbd "TAB") #'company-indent-or-complete-common) | |
| (with-eval-after-load 'company | |
| (company-flx-mode +1)) | |
| ;; https://github.com/magnars/expand-region.el | |
| (global-set-key (kbd "C-=") 'er/expand-region) | |
| ;; http://emacsrocks.com/e09.html | |
| ;; https://www.emacswiki.org/emacs/HideShow | |
| (global-set-key (kbd "M-+") 'hs-show-block) | |
| (global-set-key (kbd "M-*") 'hs-show-all) | |
| (global-set-key (kbd "M--") 'hs-hide-block) | |
| (global-set-key (kbd "M-Ç") 'hs-hide-level) | |
| (global-set-key (kbd "M-:") 'hs-hide-all) | |
| (add-hook 'clojure-mode-hook 'hs-minor-mode) | |
| (add-hook 'cider-mode-hook 'hs-minor-mode) | |
| (add-hook 'lisp-mode-hook 'hs-minor-mode) | |
| ;; https://www.emacswiki.org/emacs/RainbowDelimiters | |
| (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) | |
| ;; https://github.com/Fuco1/smartparens | |
| ;; https://ebzzry.github.io/emacs-pairs.html | |
| (add-hook 'clojure-mode-hook 'smartparens-mode) | |
| (add-hook 'cider-mode-hook 'smartparens-mode) | |
| (add-hook 'lisp-mode-hook 'smartparens-mode) | |
| ;; https://github.com/magnars/multiple-cursors.el | |
| ;; http://emacsrocks.com/e13.html | |
| (add-hook 'clojure-mode-hook 'multiple-cursors-mode) | |
| (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) | |
| (global-set-key (kbd "C->") 'mc/mark-next-like-this) | |
| (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) | |
| (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) | |
| (load-theme 'leuven t) | |
| ;; Set the default comment column to 70 | |
| (setq-default comment-column 70) | |
| (set-language-environment "UTF-8") | |
| ;; Every time a window is started, make sure it get maximized | |
| (add-to-list 'default-frame-alist '(fullscreen . maximized)) | |
| ;; switch to other frame http://stackoverflow.com/questions/93058/emacs-switching-to-another-frame-mac-os-x | |
| (global-set-key (kbd "M-o") 'other-frame) | |
| ;; save all open buffers | |
| ;; (global-set-key | |
| ;; (kbd "C-X C-S") | |
| ;; (lambda () | |
| ;; (interactive) | |
| ;; (save-some-buffers t))) | |
| ;; http://projectile.readthedocs.io/en/latest/usage/ | |
| (projectile-global-mode) | |
| ;; ORG-MODE + LITERATE PROGRAMMING | |
| ;; http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code | |
| ;; LITERATE PROGRAMMING + CLOJURE | |
| ;; http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html | |
| (add-to-list 'load-path "/Users/tangrammer/tools/org-mode/lisp") | |
| (setq org-edit-src-content-indentation 0 | |
| org-src-tab-acts-natively t | |
| org-src-fontify-natively t | |
| org-confirm-babel-evaluate nil | |
| org-support-shift-select 'always) | |
| ;; Remove the markup characters, i.e., "/text/" becomes (italized) "text" | |
| (setq org-hide-emphasis-markers t) | |
| ;; No timeout when executing calls on Cider via nrepl | |
| (setq org-babel-clojure-nrepl-timeout nil) | |
| ;; Turn on visual-line-mode for Org-mode only | |
| ;; Note: you have to install "adaptive-wrap" from elpa | |
| (add-hook 'org-mode-hook 'turn-on-visual-line-mode) | |
| ;; Enable Confluence export (or any other contributed export formats) | |
| (add-to-list 'load-path "/Users/tangrammer/tools/org-mode/contrib/lisp") | |
| (require 'ox-confluence) | |
| (if (require 'toc-org nil t) | |
| (add-hook 'org-mode-hook 'toc-org-enable) | |
| (warn "toc-org not found")) | |
| (require 'org) | |
| (require 'ob-clojure) | |
| (require 'ob-dot) | |
| (require 'ob-sh) | |
| (org-babel-do-load-languages | |
| 'org-babel-load-languages | |
| '((clojure . t) | |
| (dot . t) | |
| (shell . t) | |
| (emacs-lisp . t))) | |
| (setq org-babel-clojure-backend 'cider) | |
| (require 'cider) | |
| (org-defkey org-mode-map "\C-x\C-e" 'cider-eval-last-sexp) | |
| (org-defkey org-mode-map "\C-c\C-d" 'cider-doc) | |
| (org-defkey org-mode-map "\C-c\M-j" 'cider-jack-in) | |
| (require 'htmlize) | |
| ;;(repeat-complex-command 1) | |
| ;;http://ergoemacs.org/emacs/emacs_novel_reading_mode.html | |
| (defun xah-toggle-read-novel-mode () | |
| "Setup current buffer to be suitable for reading long novel/article text. | |
| • Line wrap at word boundaries. | |
| • Set a right margin. | |
| • line spacing is increased. | |
| • variable width font is used. | |
| Call again to toggle back. | |
| URL `http://ergoemacs.org/emacs/emacs_novel_reading_mode.html' | |
| Version 2016-01-16" | |
| (interactive) | |
| (if (null (get this-command 'state-on-p)) | |
| (progn | |
| (set-window-margins | |
| nil 0 | |
| (if (> fill-column (window-body-width)) | |
| 0 | |
| (progn | |
| (- (window-body-width) fill-column)))) | |
| (variable-pitch-mode 1) | |
| (setq line-spacing 0.4) | |
| (setq word-wrap t) | |
| (put this-command 'state-on-p t)) | |
| (progn | |
| (set-window-margins nil 0 0) | |
| (variable-pitch-mode 0) | |
| (setq line-spacing nil) | |
| (setq word-wrap nil) | |
| (put this-command 'state-on-p nil))) | |
| (redraw-frame (selected-frame))) | |
| (setq ido-enable-flex-matching t) | |
| (setq ido-everywhere t) | |
| (ido-mode 1) | |
| ;; emacs live bindings => /Users/tangrammer/.emacs.d.seg-bis/packs/dev/bindings-pack/config/default-bindings.el | |
| ;;https://www.emacswiki.org/emacs/idomenu.el | |
| (global-set-key (kbd "C-x C-i") 'idomenu) | |
| ;; Magit | |
| (global-set-key (kbd "C-x g") 'magit-status) | |
| ;; Show documentation/information with M-RET | |
| (define-key lisp-mode-shared-map (kbd "M-RET") 'live-lisp-describe-thing-at-point) | |
| (define-key cider-repl-mode-map (kbd "M-RET") 'cider-doc) | |
| (define-key cider-mode-map (kbd "M-RET") 'cider-doc) | |
| (require 'win-switch) | |
| (global-set-key (kbd "C-x o") 'win-switch-dispatch) |