Last active
October 25, 2021 08:14
-
-
Save luposlip/b2527a99fd175b53aadfecc07a06c16e to your computer and use it in GitHub Desktop.
My Emacs init.el for Clojure/ErgoEmacs/ParEdit joy (hopefully)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(prefer-coding-system 'utf-8) | |
;; with emacs 26.1 on Ubuntu Budgie 19.04 I couldn't get ergoemacs-mode to work from melpa. | |
;; So I had to clone from git: | |
;; cd ~/.emacs.d | |
;; git clone -b master --single-branch https://github.com/ergoemacs/ergoemacs-mode.git | |
(add-to-list 'load-path "~/.emacs.d/ergoemacs-mode") | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/") t) | |
;; Load and activate emacs packages. Do this first so that the | |
;; packages are loaded before you start trying to modify them. | |
;; This also sets the load path. | |
(package-initialize) | |
;; NB!! Comment out these 3 lines after initial install! Otherwise Emacs will initialize slowly.. | |
(unless package-archive-contents ;; Refresh the packages descriptions | |
(package-refresh-contents)) | |
(setq package-load-list '(all)) ;; List of packages to load | |
(defvar my-packages | |
'(adoc-mode | |
ag | |
aggressive-indent | |
avy | |
beacon | |
better-defaults | |
cider | |
clj-refactor | |
clojure-mode | |
clojure-mode-extra-font-locking | |
company | |
dash | |
ergoemacs-mode | |
flx-ido | |
ido-completing-read+ | |
magit | |
monokai-theme | |
org | |
paredit | |
projectile | |
rainbow-delimiters | |
smex | |
flycheck-clj-kondo)) | |
(dolist (p my-packages) | |
(when (not (package-installed-p p)) | |
(package-install p))) | |
(require 'flycheck-clj-kondo) | |
(require 'smex) | |
(require 'ergoemacs-mode) | |
(require 'clojure-mode-extra-font-locking) | |
(setq ergoemacs-theme nil) ;; Uses Standard Ergoemacs keyboard theme | |
(setq ergoemacs-keyboard-layout "us") ;; Assumes QWERTY keyboard layout | |
(ergoemacs-mode 1) | |
;;; Highlight the cursor | |
(beacon-mode 1) | |
;;; Smex | |
(autoload 'smex "smex" | |
"Smex is a M-x enhancement for Emacs, it provides a convenient interface to | |
your recently and most frequently used commands.") | |
(global-set-key (kbd "C-c g") 'magit-status) | |
(global-set-key (kbd "C-c a") 'avy-goto-char-2) | |
(global-set-key (kbd "C-c M-g") 'magit-dispatch-popup) | |
(global-set-key (kbd "TAB") 'company-complete) | |
(global-set-key (kbd "C-c p s s") 'projectile-ag) | |
(global-set-key (kbd "C-<prior>") 'switch-to-prev-buffer) | |
(global-set-key (kbd "C-<next>") 'switch-to-next-buffer) | |
(global-set-key (kbd "M-x") 'smex) | |
;; always reload changed files | |
(global-auto-revert-mode t) | |
;; org mode | |
;; The following lines are always needed. Choose your own keys. | |
;;(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-iswitchb) | |
;; AsciiDoc Mode | |
(autoload 'adoc-mode "adoc-mode" nil t) | |
(add-to-list 'auto-mode-alist (cons "\\.adoc\\'" 'adoc-mode)) | |
(show-paren-mode 1) | |
(setq show-paren-delay 0) | |
;;ido related init | |
(require 'ido) | |
(setq ido-enable-flex-matching t) | |
(setq ido-everywhere t) | |
(ido-mode 1) | |
(require 'ido-completing-read+) | |
(ido-ubiquitous-mode 1) | |
(require 'flx-ido) | |
;; disable ido faces to see flx highlights. | |
(setq ido-enable-flex-matching t) | |
(setq ido-use-faces nil) | |
(setq projectile-indexing-method 'alien) | |
;; clojure mode hooks | |
(add-hook 'clojure-mode-hook 'paredit-mode) | |
(add-hook 'clojure-mode-hook 'aggressive-indent-mode) | |
(add-hook 'clojure-mode-hook 'projectile-mode) | |
(add-hook 'clojure-mode-hook 'eldoc-mode) | |
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'clojure-mode-hook 'subword-mode) | |
(add-hook 'clojure-mode-hook 'flycheck-mode) | |
;; cider-mode hooks | |
(add-hook 'cider-mode-hook 'paredit-mode) | |
(add-hook 'cider-mode-hook 'aggressive-indent-mode) | |
(add-hook 'cider-mode-hook 'projectile-mode) | |
(add-hook 'cider-mode-hook 'eldoc-mode) | |
(add-hook 'cider-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'cider-mode-hook 'subword-mode) | |
(add-hook 'cider-repl-mode-hook 'rainbow-delimiters-mode) | |
;; company-mode hooks | |
(defun start-lisp-basic-minor-modes () | |
(paredit-mode 1) | |
(show-paren-mode 1)) | |
(defun start-lisp-minor-modes () | |
(start-lisp-basic-minor-modes) | |
(company-mode 1) | |
(eldoc-mode 1)) | |
(add-hook 'clojure-mode-hook #'start-lisp-basic-minor-modes) | |
(add-hook 'cider-repl-mode-hook #'start-lisp-minor-modes) | |
(add-hook 'cider-mode-hook #'start-lisp-minor-modes) | |
;; projectile-mode hooks | |
(add-hook 'after-init-hook 'projectile-global-mode) | |
;; JSON Snatcher! | |
(defun js-mode-bindings () | |
"Sets a hotkey for using the json-snatcher plugin" | |
(when (string-match "\\.json$" (buffer-name)) | |
(local-set-key (kbd "C-c C-g") 'jsons-print-path))) | |
(add-hook 'js-mode-hook 'js-mode-bindings) | |
(add-hook 'js2-mode-hook 'js-mode-bindings) | |
;; Theme! | |
(load-theme 'monokai t) | |
;;(add-hook 'after-make-frame-functions | |
;; (lambda (frame) | |
;; (let ((mode (if (display-graphic-p frame) 'dark 'dark))) | |
;; (set-frame-parameter frame 'background-mode mode) | |
;; (set-terminal-parameter frame 'background-mode mode)) | |
;; (enable-theme 'solarized-dark))) | |
;;from http://bzg.fr/emacs-strip-tease.html | |
;; Prevent the cursor from blinking | |
(blink-cursor-mode 0) | |
;; Transparent bg | |
(set-frame-parameter (selected-frame) 'alpha '(100 . 95)) | |
(add-to-list 'default-frame-alist '(alpha . (100 . 95))) | |
;; Don't use messages that you don't read | |
(setq initial-scratch-message "") | |
(setq inhibit-startup-message t) | |
;; Don't let Emacs hurt your ears | |
(setq visible-bell t) | |
(tool-bar-mode 0) | |
(menu-bar-mode 0) | |
;; Default font-size | |
(set-face-attribute 'default nil :font "Courier 10 Pitch" :height 125) | |
;; Default clojure mode | |
(setq-default major-mode 'clojure-mode) | |
(setq default-directory "~/my/favorite/project") | |
(setq cider-overlays-use-font-lock t) ;; Syntax highlighting for overlays | |
(setq cider-test-show-report-on-success t) | |
(global-linum-mode t) | |
(setq linum-format "%d") | |
;;(global-hl-line-mode 1) | |
(eval-after-load 'clojure-mode | |
'(progn | |
(define-key clojure-mode-map (kbd "C-c C-h") #'clojure-cheatsheet))) | |
(eval-after-load 'cider-repl-mode | |
'(progn | |
(define-key cider-mode-map (kbd "C-c C-h") #'clojure-cheatsheet))) | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(default ((t (:inherit nil :stipple nil :background "gray10" :foreground "#f8f8f2" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 124 :width normal :family "Hack"))))) | |
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(cider-test-show-report-on-success nil) | |
'(compilation-message-face 'default) | |
'(custom-safe-themes | |
'("8ed752276957903a270c797c4ab52931199806ccd9f0c3bb77f6f4b9e71b9272" "4486ade2acbf630e78658cd6235a5c6801090c2694469a2a2b4b0e12227a64b9" "70403e220d6d7100bae7775b3334eddeb340ba9c37f4b39c189c2c29d458543b" "1dffeecd1565d04cd2059234e872cd80fcbe813488602d5c42b5c9e576924d9f" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)) | |
'(magit-diff-use-overlays nil) | |
'(package-selected-packages | |
'(markdown-preview-mode beacon undo-tree monokai-theme clojure-mode-extra-font-locking magit-todos magithub yaml-mode avy org-ac markdown-mode clojure-mode color-theme-sanityinc-tomorrow paganini-theme 4clojure gruvbox-theme ergoemacs-status highlight-tail smooth-scrolling smooth-scroll org zoutline use-package swiper stylus-mode persistent-soft iedit ido-ubiquitous exec-path-from-shell company better-defaults assemblage-theme aggressive-indent aggressive-fill-paragraph ag ace-window)) | |
'(pos-tip-background-color "#FFFACE") | |
'(pos-tip-foreground-color "#272822") | |
'(weechat-color-list | |
(unspecified "#272822" "#3C3D37" "#F70057" "#F92672" "#86C30D" "#A6E22E" "#BEB244" "#E6DB74" "#40CAE4" "#66D9EF" "#FB35EA" "#FD5FF0" "#74DBCD" "#A1EFE4" "#F8F8F2" "#F8F8F0"))) | |
(put 'downcase-region 'disabled nil) |
After upgrading 41 packages (via M-x
, package-refresh-contents
, package-list-packages
, Shift-U
, x
and then package-autoremove
) the toolbar showed.
So, removed it in the newest version.
Updated set-face-attribute
to have a explicit default font (line 136). Change this, if you don't have Courier 10 Pitch
on you system.
Added magit and avy, plus keyboard shortcuts for both
Added subtle background transparency when window is inactive.
clj-kondo-flycheck, JSON Snatcher and ASCII-doc hooks.
Add hook for clojure-mode
-> flycheck-mode
, and remove some themes etc. that isn't used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upgraded to cider 0.15.1 (London) etc.
To do this, I deleted the
.emacs.d/elpa
folder, and restarted Emacs.Also to make
smex
work with new versions of packages, I had to add arequire
ofsmex
.