From ac9c0574c652e41f8234c8a5782600e09d50d0fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 12:50:13 +0200 Subject: Emacs: Remove unnecessary SRC blocks Outorg and friends don't seem to require them --- emacs/.emacs.d/main.el | 321 ------------------------------------------------- 1 file changed, 321 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d07dfe1c..f27f51f4 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -12,45 +12,36 @@ ;;;; Basics ;;;;; Startup ;; Open Emacs with just a plain window. No graphics or messages, please! -;; #+BEGIN_SRC emacs-lisp (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) (add-hook 'after-init-hook (lambda () (setq gc-cons-threshold 800000))) (remove-hook 'find-file-hooks #'vc-refresh-state) -;; #+END_SRC ;; Are we running on Windows via the WSL? -;; #+BEGIN_SRC emacs-lisp (when (file-exists-p "/proc/sys/kernel/osrelease") (with-temp-buffer (insert-file-contents-literally "/proc/sys/kernel/osrelease") (decode-coding-region (point-min) (point-max) 'utf-8 t) (when (string-match "Microsoft$" (buffer-string)) (setq system-type 'gnu/linux/windows)))) -;; #+END_SRC ;;;;; Compatibility -;; #+BEGIN_SRC emacs-lisp (if (version< emacs-version "25.0") (defmacro with-eval-after-load (file &rest body) `(eval-after-load ,file (lambda () ,@body)))) -;; #+END_SRC ;;;;; Scratch buffers ;; I usually use scratch buffers for any sort of text. If I need a ;; programming mode in one, then I’ll just call it manually. I also like ;; the buffer to be empty. -;; #+BEGIN_SRC emacs-lisp (setq initial-scratch-message "" initial-major-mode 'text-mode) -;; #+END_SRC ;;;;; Personal Information -;; #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") ;; #+end_src @@ -59,7 +50,6 @@ ;;;;; Use-package -;; #+BEGIN_SRC emacs-lisp (eval-and-compile (require 'seq) (defun is-nix-emacs () @@ -101,7 +91,6 @@ (setq use-package-always-ensure (not nix-emacs) use-package-always-demand (daemonp) package-enable-at-startup nil) -;; #+END_SRC ;;;;; Helpers @@ -111,10 +100,8 @@ ;; modification and removal, without the boilerplate of an extra function ;; definition. -;; #+BEGIN_SRC emacs-lisp (eval-and-compile (use-package hook-helpers)) -;; #+END_SRC ;;;; Customize ;; I don’t really like using customize for normal configuration. @@ -123,22 +110,17 @@ ;; that it’s not important whether the file exists or not, which is why I ;; pass =:noerror= to =load= -;; #+BEGIN_SRC emacs-lisp (setq custom-file "~/.emacs.d/custom.el") (load custom-file :noerror :nomessage) -;; #+END_SRC ;;;; Styles ;; I prefer an always-visible cursor. Feels less distracting. -;; #+BEGIN_SRC emacs-lisp (when (fboundp #'blink-cursor-mode) (blink-cursor-mode -1)) -;; #+END_SRC ;; Disable all the bars, unless on OSX, in which case, keep the menu bar. -;; #+BEGIN_SRC emacs-lisp (when (and menu-bar-mode (not (eq window-system 'ns))) (menu-bar-mode -1)) (with-eval-after-load 'scroll-bar @@ -147,22 +129,18 @@ (tooltip-mode -1)) (with-eval-after-load 'tool-bar (tool-bar-mode -1)) -;; #+END_SRC ;; Ring the bell sometimes, but not so often -;; #+BEGIN_SRC emacs-lisp (setq ring-bell-function (lambda () (unless (memq this-command '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) (ding)))) -;; #+END_SRC ;;;;; Colours ;; White-theme. Sounds like a good idea. -;; #+BEGIN_SRC emacs-lisp (use-package white-theme :if (or window-system (daemonp)) @@ -173,15 +151,12 @@ '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) '(font-lock-string-face ((t (:slant normal))))))) -;; #+END_SRC ;; Highlighting quasi-quoted expressions in lisps is quite useful, but I ;; don't need it all the time. I'll keep it around for a while so that I ;; can enable it if needed. -;; #+BEGIN_SRC emacs-lisp (use-package highlight-stages :diminish highlight-stages-mode) -;; #+END_SRC (global-hl-line-mode +1) @@ -189,7 +164,6 @@ ;; When possible, set up fonts. I don’t have any settings here for X11, ;; because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresources/main][XResources file]]. -;; #+BEGIN_SRC emacs-lisp (when (or (display-graphic-p) (daemonp)) @@ -227,25 +201,20 @@ (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))) (add-hook 'first-frame-hook #'ap/set-fonts-according-to-system) -;; #+END_SRC ;; Reduce font decoration. I’m trying to see whether this helps me focus ;; on the right things. -;; #+BEGIN_SRC emacs-lisp (setq font-lock-maximum-decoration '((dired-mode . 1) (t . 1))) -;; #+END_SRC ;; Make symbols prettier. Turns out, in many cases, this is already ;; configured, just not enabled. If using the mac-port version of Emacs, ;; it has it's own, more extensive version. -;; #+BEGIN_SRC emacs-lisp (if (eq window-system 'mac) (if (fboundp 'mac-auto-operator-composition-mode) (mac-auto-operator-composition-mode +1)) (global-prettify-symbols-mode +1)) -;; #+END_SRC ;;;;; Page Breaks @@ -254,7 +223,6 @@ ;; Horizontal) can only be displayed with a different font, which is not ;; correct, at least for Liberation Mono. -;; #+BEGIN_SRC emacs-lisp (use-package page-break-lines :defer 5 :diminish page-break-lines-mode @@ -264,10 +232,8 @@ (set-fontset-font "fontset-default" (cons page-break-lines-char page-break-lines-char) (face-attribute 'default :family))))) -;; #+END_SRC ;;;;; Modeline -;; #+BEGIN_SRC emacs-lisp (column-number-mode -1) (line-number-mode -1) (size-indication-mode t) @@ -276,13 +242,11 @@ (setq frame-title-format (list "Emacs" '(buffer-file-name " — %f") '(dired-directory (" — " dired-directory)))) -;; #+END_SRC ;;;;; Chrome ;; Sometimes I like to hide clutter. Other times, it's useful. -;; #+BEGIN_SRC emacs-lisp (defvar mode-line-default-format mode-line-format) (defvar mode-line-default-hidden nil "Whether to hide the mode line by default.") @@ -334,25 +298,21 @@ (add-hook 'minibuffer-setup-hook #'show-mode-line) (add-hook 'minibuffer-exit-hook #'hide-mode-line) -;; #+END_SRC ;;;;; Highlight Changes ;; Highlight what just changed when I undo, yank, and so on. -;; #+BEGIN_SRC emacs-lisp (use-package volatile-highlights :diminish volatile-highlights-mode :config (progn (volatile-highlights-mode t))) -;; #+END_SRC ;;;;; Renaming major modes ;; Diminishing major modes does not happen in the same manner as minor ;; modes. -;; #+BEGIN_SRC emacs-lisp (unless (version<= emacs-version "24.4") (use-package cyphejor :defer 2 @@ -369,7 +329,6 @@ ("mode" "") ("shell" "sh" :postfix))) (cyphejor-mode 1)))) -;; #+END_SRC ;;;; Environment Variables @@ -382,7 +341,6 @@ ;; On Windows, I like to run Emacs from the system tray menu of VcXsrv. ;; It starts up without an environment in this case as well. -;; #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell :if (or (eq system-type 'darwin) (eq system-type 'gnu/linux/windows) @@ -391,7 +349,6 @@ :config (progn (setq exec-path-from-shell-arguments '("-l")) (exec-path-from-shell-initialize))) -;; #+END_SRC ;;;;; NixOS sandboxes @@ -399,7 +356,6 @@ ;; development. This package allows using tools from inside sandboxes, ;; and some convenience commands for building packages and launching shells. -;; #+BEGIN_SRC emacs-lisp (use-package nix-sandbox :defines (flycheck-command-wrapper-function flycheck-executable-find) @@ -415,7 +371,6 @@ (if (nix-current-sandbox) (nix-executable-find (nix-current-sandbox) cmd) (executable-find cmd))))))) -;; #+END_SRC ;;;; Keybindings @@ -424,7 +379,6 @@ ;; re-arrangement of modifiers on OSX: Cmd on the outside, then ;; Option/alt, then Control. -;; #+BEGIN_SRC emacs-lisp (when (eq system-type 'darwin) (set-keyboard-coding-system nil) (custom-set-variables @@ -436,9 +390,7 @@ '(mac-right-command-modifier 'left) '(mac-function-modifier 'hyper)) (unbind-key "s-x")) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (unbind-key "") (bind-key* "" #'compile) (bind-key* "" #'kmacro-start-macro-or-insert-counter) @@ -469,14 +421,12 @@ (bind-key* "s-," #'switch-to-dotfiles) (bind-key* "C-x M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -;; #+END_SRC ;;;;; Crux ;; I can replace most of the simple helper/wrapper functions in my ;; configuration with crux.el -;; #+BEGIN_SRC emacs-lisp (use-package crux :bind (("M-o" . crux-smart-open-line-above) ("C-o" . crux-smart-open-line) @@ -488,33 +438,27 @@ :init (progn (defalias 'delete-current-buffer-file #'crux-delete-file-and-buffer) (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) -;; #+END_SRC ;;;; Projects -;; #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () "Switch to dotfiles project." (interactive) (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) -;; #+END_SRC ;;;;; The Silver Searcher -;; #+BEGIN_SRC emacs-lisp (use-package ag :defer 30 :config (setq ag-project-root-function #'projectile-project-root)) (use-package wgrep-ag :after ag) -;; #+END_SRC ;;;;; Ripgrep ;; Step over Silver Search, here comes a new challenger. -;; #+BEGIN_SRC emacs-lisp (use-package ripgrep :if (executable-find "rg")) @@ -523,14 +467,12 @@ :if (executable-find "rg") :bind (:map projectile-command-map ("s r" . projectile-ripgrep))) -;; #+END_SRC ;;;;; Projectile ;; Projectile is awesome for working in projects, especially VCS-backed ;; ones. -;; #+BEGIN_SRC emacs-lisp (add-to-list 'byte-compile-not-obsolete-funcs #'projectile-global-mode) (use-package projectile :bind (("s-p" . projectile-switch-project) @@ -600,14 +542,12 @@ "Find rg on project." (call-interactively #'counsel-projectile-rg)) (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) -;; #+END_SRC ;;;;; vc ;; This is nice for some things that magit doesn’t do, and for those rare ;; occasions that I’m working with something other than git. -;; #+BEGIN_SRC emacs-lisp (use-package vc :defer t :bind (("C-x v C" . vc-resolve-conflicts)) @@ -616,7 +556,6 @@ (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)))) -;; #+END_SRC ;;;;; git-gutter-fringe @@ -624,7 +563,6 @@ ;; changed. This package colours the fringe. I have it set to the right ;; fringe so it doesn’t interfere with flycheck. -;; #+BEGIN_SRC emacs-lisp (eval-when-compile (require 'fringe-helper)) (use-package git-gutter-fringe :defer 2 @@ -644,14 +582,12 @@ ".....XXX" "....XXXX") (setq git-gutter-fr:side 'right-fringe))) -;; #+END_SRC ;;;;; magit ;; Magit is my favourite way to use git. I use selective staging all the ;; time. Make sure to set it up with a nice =completing-read-function= -;; #+BEGIN_SRC emacs-lisp (use-package magit :defer 5 :commands (magit-status) @@ -661,18 +597,15 @@ global-magit-file-mode nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) -;; #+END_SRC ;;;;; git-messenger ;; Popup the last commit that changed the line at point. -;; #+BEGIN_SRC emacs-lisp (use-package git-messenger :bind* (("C-x v p" . git-messenger:popup-message)) :config (progn (setq git-messenger:use-magit-popup t))) -;; #+END_SRC ;;;;; git-timemachine @@ -681,10 +614,8 @@ ;; in the past. I often find it useful when I remember writing something ;; a particular way, but it changed later. -;; #+BEGIN_SRC emacs-lisp (use-package git-timemachine :commands git-timemachine) -;; #+END_SRC ;;;;; ghq @@ -692,10 +623,8 @@ ;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a ;; simple wrapper for it. -;; #+BEGIN_SRC emacs-lisp (use-package ghq :if (executable-find "ghq")) -;; #+END_SRC ;;;; Files @@ -704,16 +633,13 @@ ;; Auto-save everything to a temporary directory, instead of cluttering ;; the filesystem. I don’t want emacs-specific lockfiles, either. -;; #+BEGIN_SRC emacs-lisp (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) create-lockfiles nil) -;; #+END_SRC ;;;;; Backups ;; I like to keep my backups out of regular folders. I tell emacs to use ;; a subfolder of its configuration directory for that. Also, use the ;; trash for deleting on OS X. -;; #+BEGIN_SRC emacs-lisp (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) (unless (file-directory-p backup-dir) (make-directory backup-dir)) @@ -727,35 +653,29 @@ (call-process (executable-find "trash") nil 0 nil file)))) -;; #+END_SRC ;;;;; autorevert -;; #+BEGIN_SRC emacs-lisp (use-package autorevert :diminish auto-revert-mode :init (progn (global-auto-revert-mode 1) (setq auto-revert-verbose nil auto-revert-use-notify (not (eq system-type 'darwin))))) -;; #+END_SRC ;;;;; Encoding ;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects ;; only a coding system, not a coding system and line ending combination. -;; #+BEGIN_SRC emacs-lisp (prefer-coding-system 'utf-8) (setq-default buffer-file-coding-system 'utf-8-auto-unix) -;; #+END_SRC ;;;;; Buffer-file management ;; Ask if I want to create a directory when it doesn’t exist. This is ;; especially nice when starting new projects. -;; #+BEGIN_SRC emacs-lisp (defun my-create-non-existent-directory () "Offer to create non-existent directories of found-file." (let ((parent-directory (file-name-directory buffer-file-name))) @@ -763,12 +683,10 @@ (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) (make-directory parent-directory t)))) (add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) -;; #+END_SRC ;; I often want to rename or delete the file that I’m currently visiting ;; with a buffer. -;; #+BEGIN_SRC emacs-lisp (defun kill-or-delete-this-buffer-dwim (&optional arg) "Kill current buffer. With prefix ARG, delete it." (interactive "P") @@ -780,13 +698,11 @@ (when (equal buf "*HTTP Response*") (other-window 1)) (kill-buffer buf))))) -;; #+END_SRC ;;;;; Whitespace ;; Show bad whitespace, so that I can fix it. -;; #+BEGIN_SRC emacs-lisp (defun show-trailing-whitespace-on () "Show trailing whitespace." (interactive) @@ -797,24 +713,20 @@ (setq-local show-trailing-whitespace nil)) (add-hook 'prog-mode-hook #'show-trailing-whitespace-on) (add-hook 'text-mode-hook #'show-trailing-whitespace-on) -;; #+END_SRC ;;;;; shrink-whitespace ;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= ;; for similar things any more. -;; #+BEGIN_SRC emacs-lisp (use-package shrink-whitespace :bind ("M-SPC" . shrink-whitespace)) -;; #+END_SRC ;;;;; Tramp ;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so ;; that I can sudo on remote machines -;; #+BEGIN_SRC emacs-lisp (use-package tramp :defer 7 :config (progn @@ -835,19 +747,16 @@ (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" (concat "/" tramp-default-method ":%h:"))) (add-to-list 'tramp-default-proxies-alist `(,(regexp-quote (system-name)) nil nil)) (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) -;; #+END_SRC ;;;;; ediff ;; I like a horizonal diff setup, with everything in one frame. -;; #+BEGIN_SRC emacs-lisp (use-package ediff :defer t :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) -;; #+END_SRC ;;;; Indentation @@ -855,11 +764,9 @@ ;; tabstops. I’ve recently switched to using two spaces, since elastic ;; tabstops is probably never going to happen. -;; #+BEGIN_SRC emacs-lisp (setq-default tab-width 2 indent-tabs-mode nil) (electric-indent-mode +1) -;; #+END_SRC ;;;;; smart-tabs-mode @@ -867,32 +774,27 @@ ;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns ;; with spaces. Perfect! -;; #+BEGIN_SRC emacs-lisp (use-package smart-tabs-mode :defer 1 :config (progn (smart-tabs-insinuate 'c 'cperl 'python) (define-hook-helper php-mode () (smart-tabs-mode indent-tabs-mode)))) -;; #+END_SRC ;;;;; editorconfig -;; #+BEGIN_SRC emacs-lisp (use-package editorconfig :diminish editorconfig-mode :init (progn (unless (executable-find "editorconfig") (warn "Missing `editorconfig' executable."))) :config (editorconfig-mode 1)) -;; #+END_SRC ;;;;; dtrt-indent-mode ;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] ;; guesses the correct settings for me. -;; #+BEGIN_SRC emacs-lisp (use-package dtrt-indent :config (progn (define-hook-helper after-change-major-mode () @@ -901,25 +803,21 @@ (dtrt-indent-adapt))) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) (smart-tabs-mode (or indent-tabs-mode -1))))) -;; #+END_SRC ;;;; Security ;;;;; password-store ;; This is a frontend to the GPG-powered =pass= program. -;; #+BEGIN_SRC emacs-lisp (use-package password-store :defer 15 :config (progn (setq password-store-password-length 16))) -;; #+END_SRC ;;;; Buffers ;;;;; Ibuffer ;; Ibuffer is quite nice for listing all buffers. -;; #+BEGIN_SRC emacs-lisp (use-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn @@ -950,32 +848,26 @@ (mode 16 16 :left :elide) " " filename-and-process))))) -;; #+END_SRC ;;;;; Relative Buffer names -;; #+BEGIN_SRC emacs-lisp (use-package relative-buffers :defer 15 :config (progn (global-relative-buffers-mode))) -;; #+END_SRC ;;;;; Narrowing ;; Enable it without prompting -;; #+BEGIN_SRC emacs-lisp (put 'narrow-to-defun 'disabled nil) (put 'narrow-to-page 'disabled nil) (put 'narrow-to-region 'disabled nil) -;; #+END_SRC ;;;;; ace-window ;; I don’t often have many windows open at once, but when I do, ;; =ace-window= is really nice to jump around them in the same way that ;; =ace-jump= or =avy= work. -;; #+BEGIN_SRC emacs-lisp (use-package ace-window :bind (("s-s" . ace-window)) :config (progn @@ -991,14 +883,12 @@ (?, winner-undo) (?. winner-redo)) aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) -;; #+END_SRC ;;;; Windows ;; Scrolling is tricky. I use this setup to help me keep track of the ;; point whilst I’m moving about. -;; #+BEGIN_SRC emacs-lisp (setq scroll-conservatively 100 scroll-margin 1 scroll-preserve-screen-position t @@ -1008,7 +898,6 @@ frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -;; #+END_SRC ;;;;; eyebrowse @@ -1017,7 +906,6 @@ ;; instead. On macOS, super makes a lot of sense, as it's used by most ;; programs to switch between program windows or views. -;; #+BEGIN_SRC emacs-lisp (use-package eyebrowse :config (progn (setq eyebrowse-new-workspace t) @@ -1045,14 +933,12 @@ ("M-8" . eyebrowse-switch-to-window-config-8) ("M-9" . eyebrowse-switch-to-window-config-9)) (eyebrowse-mode +1))) -;; #+END_SRC ;;;; Sessions ;;;;; Desktop ;; Save my Emacs session and restore it on startup. -;; #+BEGIN_SRC emacs-lisp (use-package desktop :ensure nil :config (progn @@ -1066,51 +952,42 @@ (unless (file-directory-p desktop-dirname) (make-directory desktop-dirname)) (desktop-save-mode 1))) -;; #+END_SRC ;;;;; winner ;; Undo, for window-based commands. -;; #+BEGIN_SRC emacs-lisp (use-package winner :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) :init (progn (winner-mode 1))) -;; #+END_SRC ;;;;; windmove ;; Directional window movement -;; #+BEGIN_SRC emacs-lisp (use-package windmove :bind* (("S-" . windmove-left) ("S-" . windmove-right) ("S-" . windmove-up) ("S-" . windmove-down))) -;; #+END_SRC ;;;; Blogging ;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. -;; #+BEGIN_SRC emacs-lisp (use-package easy-hugo :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) easy-hugo-url "https://alanpearce.uk" easy-hugo-default-ext ".md")) -;; #+END_SRC ;;;; Completion ;; Make built-in completion a bit more intelligent, by adding substring ;; and initial-based completion and ignoring case. -;; #+BEGIN_SRC emacs-lisp (setq completion-styles '(basic initials partial-completion substring) completion-ignore-case t tab-always-indent 'complete) -;; #+END_SRC ;;;;; Company @@ -1118,7 +995,6 @@ ;; auto-complete-mode. I’ve not tried auto-complete-mode as company ;; seems to work perfectly well for me. -;; #+BEGIN_SRC emacs-lisp (use-package company :commands (company-mode) :diminish " C" @@ -1139,28 +1015,22 @@ company-auto-complete-chars '(?\ ?\( ?\) ?.) company-tooltip-align-annotations t company-selection-wrap-around t))) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (use-package company-web :after company) -;; #+END_SRC ;;;; Dates & Times ;;;;; Calendar ;; Weeks start on Monday for me and I prefer ISO-style dates. -;; #+BEGIN_SRC emacs-lisp (use-package calendar :defer 1 :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) -;; #+END_SRC ;; Sometimes I want to insert a date or time into a buffer. -;; #+BEGIN_SRC emacs-lisp (defun insert-date (prefix) "Insert the current date. With PREFIX, use British format. @@ -1179,13 +1049,10 @@ With two prefix arguments, write out the day and month name." ((not prefix) "%Y-%m-%d %H:%M:%S") ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ")))) (insert (format-time-string format)))) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (defun yesterday-time () "Provide the date/time 24 hours before the time now in the format of `current-time'." (timer-relative-time (current-time) -86400)) -;; #+END_SRC ;;;; Directories @@ -1194,7 +1061,6 @@ With two prefix arguments, write out the day and month name." ;; have two dired windows open, assume that I’m going to be ;; copying/moving files between them. -;; #+BEGIN_SRC emacs-lisp (use-package dired :defer 3 :ensure nil @@ -1210,11 +1076,9 @@ With two prefix arguments, write out the day and month name." (when (and (eq system-type 'darwin) (executable-find "gls")) (setq insert-directory-program (executable-find "gls"))) (put 'dired-find-alternate-file 'disabled nil))) -;; #+END_SRC ;; Don’t show uninteresting files in dired listings. -;; #+BEGIN_SRC emacs-lisp (defun turn-on-dired-omit-mode () "Enable dired-omit mode." (interactive) @@ -1231,11 +1095,9 @@ With two prefix arguments, write out the day and month name." dired-bind-jump nil)) :init (progn (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) -;; #+END_SRC ;; Expand subfolders like a tree inside the parent -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load 'dired (use-package dired-subtree :functions (dired-subtree--get-ov @@ -1252,18 +1114,15 @@ With two prefix arguments, write out the day and month name." (dired-up-directory)))) (bind-key "^" #'dired-subtree-maybe-up dired-mode-map) (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) -;; #+END_SRC ;;;;; Disk usage ;; Combine dired and du (disk usage). -;; #+BEGIN_SRC emacs-lisp (use-package dired-du :after dired :config (progn (setq dired-du-size-format t))) -;; #+END_SRC ;;;;; Dired-narrow ;; One can already use dired with wildcards to browse a filtered @@ -1272,70 +1131,57 @@ With two prefix arguments, write out the day and month name." ;; to start filtering, =RET= to complete the filter and =g= to refresh ;; the buffer, removing the filter. -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load 'dired (use-package dired-narrow :bind (:map dired-mode-map ("/" . dired-narrow)))) -;; #+END_SRC ;;;; Documentation ;;;;; helpful -;; #+BEGIN_SRC emacs-lisp (use-package helpful) -;; #+END_SRC ;;;;; ehelp ;; ehelp is a less well-known package that’s part of Emacs and slightly ;; improves the normal help commands, mostly by making quitting them easier. -;; #+BEGIN_SRC emacs-lisp (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) -;; #+END_SRC ;;;;; discover-my-major ;; A nicer way to browse keybindings for major modes. -;; #+BEGIN_SRC emacs-lisp (use-package discover-my-major :bind ("" . discover-my-major)) -;; #+END_SRC ;;;;; which-key ;; Popup keybindings following a prefix automatically. -;; #+BEGIN_SRC emacs-lisp (use-package which-key :diminish which-key-mode :config (progn (which-key-mode 1) (which-key-setup-side-window-right-bottom))) -;; #+END_SRC ;;;;; eldoc ;; Documentation in the echo-area (where the minibuffer is displayed) is ;; rather useful. -;; #+BEGIN_SRC emacs-lisp (use-package eldoc :commands (eldoc-mode) :diminish eldoc-mode :config (progn (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -;; #+END_SRC ;;;; Mail ;;;;; Basics -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "mailcap" (when (eq system-type 'darwin) (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) @@ -1346,11 +1192,9 @@ With two prefix arguments, write out the day and month name." (with-eval-after-load "mml-sec" (setq mml-secure-openpgp-encrypt-to-self t)) -;; #+END_SRC ;;;;; mu -;; #+BEGIN_SRC emacs-lisp (when (executable-find "mu") (add-to-list 'load-path (expand-file-name "../share/emacs/site-lisp/mu4e" @@ -1446,11 +1290,9 @@ With two prefix arguments, write out the day and month name." ;; try to emulate some of the eww key-bindings (local-set-key (kbd "") 'shr-next-link) (local-set-key (kbd "") 'shr-previous-link))))) -;; #+END_SRC ;;;; Misc -;; #+BEGIN_SRC emacs-lisp (defvar *init-file* (file-truename user-init-file) "Where the Emacs init file really is, passing through symlinks.") @@ -1498,11 +1340,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key* "M-!" #'shell-execute) (bind-key* "C-x r M-w" #'copy-rectangle) -;; #+END_SRC ;;;;; Auxillary Configuration -;; #+BEGIN_SRC emacs-lisp (require 'pinentry) (defvar have-private-key @@ -1561,7 +1401,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook)))) (add-hook 'first-frame-hook #'load-private-data) -;; #+END_SRC ;;;; Minibuffer @@ -1569,30 +1408,23 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Fortunately, this is possible. Of course, I need to know how many ;; minibuffers there are on the stack. -;; #+BEGIN_SRC emacs-lisp (setq enable-recursive-minibuffers t) (minibuffer-depth-indicate-mode t) -;; #+END_SRC ;; This avoids some issue with the minibuffer and the point being behind ;; the prompt. I don’t remember what exactly. -;; #+BEGIN_SRC emacs-lisp (setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -;; #+END_SRC ;; Occasionally, I exit emacs. I should probably reduce the frequency of this. -;; #+BEGIN_SRC emacs-lisp (if (daemonp) (defalias 'exit-emacs #'delete-frame) (defalias 'exit-emacs #'save-buffers-kill-emacs)) -;; #+END_SRC ;;;;; swiper/ivy ;; Ivy is the new kid on the completion block. It seems to be a strong ;; replacement for helm so far. -;; #+BEGIN_SRC emacs-lisp (use-package swiper :bind (("C-s" . swiper) ("C-r" . swiper) @@ -1608,11 +1440,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (ivy--reset-state ivy-last)) "kill"))) (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) -;; #+END_SRC ;;;;; counsel -;; #+BEGIN_SRC emacs-lisp (use-package counsel :config (progn (bind-key "M-x" #'counsel-M-x) @@ -1630,7 +1460,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (message "File not writable %s" buffer-file-name) (find-alternate-file (concat "/sudo::" buffer-file-name)))) (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) -;; #+END_SRC ;;;;; smex @@ -1639,7 +1468,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; function uses it internally, so I’m keeping it around, even though I ;; don’t use it directly. -;; #+BEGIN_SRC emacs-lisp (use-package smex :defines (smex-key-advice-ignore-menu-bar) :commands (smex @@ -1656,7 +1484,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq smex-history-length 100 smex-save-file (concat user-emacs-directory "smex-items")))) -;; #+END_SRC ;;;;; cmd-to-echo @@ -1664,29 +1491,22 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new ;; output pops up in the echo area. -;; #+BEGIN_SRC emacs-lisp (use-package cmd-to-echo :commands (cmd-to-echo) :config (setq cmd-to-echo-add-output-to-process-buffers t)) -;; #+END_SRC ;;;; Modes ;; Setup some modes for systemd files -;; #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -;; #+END_SRC ;; =direnv=’s files are basically shell scripts, it’s a nice way to ;; set environment variables for projects. -;; #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) -;; #+END_SRC ;; Some modes that I don’t really customise much, mostly for ;; configuration files. -;; #+BEGIN_SRC emacs-lisp (use-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) @@ -1742,14 +1562,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (define-derived-mode saltstack-mode yaml-mode "Salt") (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) -;; #+END_SRC ;;;;; ledger ;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which ;; works really nicely. -;; #+BEGIN_SRC emacs-lisp (use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) :functions ledger-report @@ -1785,11 +1603,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("equity" "ledger -f %(ledger-file) equity") ("payee" "ledger -f %(ledger-file) reg @%(payee)") ("account" "ledger -f %(ledger-file) reg %(account)"))))) -;; #+END_SRC ;;;;; Beancount -;; #+BEGIN_SRC emacs-lisp (let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path blais/beancount"))))) (when (and beancount-dir (file-directory-p beancount-dir)) @@ -1801,23 +1617,19 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :bind (:map beancount-mode-map ("C-c d" . insert-date)) :config (setq beancount-use-ido nil)))) -;; #+END_SRC ;;;;; Markdown -;; #+BEGIN_SRC emacs-lisp (use-package markdown-mode :defer t :config (progn (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -;; #+END_SRC ;;;;; Outshine ;; Org-ified source code. I think this might work better than ;; lentic-mode, whilst also being more general. -;; #+BEGIN_SRC emacs-lisp (defvar outline-minor-mode-prefix "M-#") (use-package outshine :bind (:map outline-minor-mode-map @@ -1827,13 +1639,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) (add-hook 'ledger-mode-hook #'outline-minor-mode) (add-hook 'sh-mode-hook #'outline-minor-mode))) -;; #+END_SRC ;;;;; Org ;; Org is wünderbar. -;; #+BEGIN_SRC emacs-lisp (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) @@ -1887,7 +1697,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :after org :config (progn (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) -;; #+END_SRC ;;;;;;; org-babel @@ -1896,7 +1705,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; to have my =ledger= setup in an org file with some graph processing ;; with R or something. -;; #+BEGIN_SRC emacs-lisp (use-package ob-core :defer t :ensure nil @@ -1907,13 +1715,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq org-src-tab-acts-natively t org-edit-src-content-indentation 0 org-src-preserve-indentation t))) -;; #+END_SRC ;;;;;;; org-journal ;; I can use this to keep a journal. I should use it. -;; #+BEGIN_SRC emacs-lisp (use-package org-journal :bind ("s-j" . org-journal-new-entry) :defer 20 @@ -1932,7 +1738,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." "Show org-journal entry for yesterday" (interactive) (org-journal-read-or-display-entry (yesterday-time))))) -;; #+END_SRC ;;;; Programming @@ -1945,7 +1750,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; On-the-fly error checking in programming modes? Yes please. -;; #+BEGIN_SRC emacs-lisp (use-package flycheck :diminish " ✓" :defer 5 @@ -1958,35 +1762,29 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ".XXX....")) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) -;; #+END_SRC ;;;;;; flycheck-pos-tip ;; Show flycheck errors in a little popup, so I don't lose my place -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-pos-tip :after flycheck :config (progn (setq flycheck-display-errors-delay 0.5) (flycheck-pos-tip-mode 1))) -;; #+END_SRC ;;;;;; flycheck-flow -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-flow :after js2-mode :if (executable-find "flow") :config (progn (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) -;; #+END_SRC ;;;;; golang ;; Go has a few packages to inter-operate with other emacs packages. -;; #+BEGIN_SRC emacs-lisp (use-package company-go :commands company-go :config (progn @@ -2007,13 +1805,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq go-projectile-switch-gopath 'maybe))) -;; #+END_SRC ;;;;; ggtags ;; A nice completion backend for programming modes. -;; #+BEGIN_SRC emacs-lisp (use-package ggtags :if (executable-find "gtags") :commands turn-on-ggtags-mode @@ -2025,7 +1821,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (interactive) (ggtags-mode 1)) (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) -;; #+END_SRC ;;;;; dumb-jump @@ -2033,24 +1828,20 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; a project-wide text search and apply heuristics to the results to ;; guess a definition. -;; #+BEGIN_SRC emacs-lisp (use-package dumb-jump :bind (("M-g o" . dumb-jump-go-other-window) ("M-g j" . dumb-jump-go) ("M-g x" . dumb-jump-go-prefer-external) ("M-g z" . dumb-jump-go-prefer-external-other-window)) :config (setq dumb-jump-selector 'ivy)) -;; #+END_SRC ;;;;; imenu-anywhere ;; This is like imenu, but shows functions (or similar top-level ;; entities) across buffers in the same project. Neat! -;; #+BEGIN_SRC emacs-lisp (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) -;; #+END_SRC ;;;;; Lisps ;;;;;; All @@ -2058,7 +1849,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Lisp modes don’t seem to have a common ancestor. So I made a custom ;; hook which I trigger in every lispy-mode. -;; #+BEGIN_SRC emacs-lisp (defcustom lisp-mode-common-hook nil "Hook run when entering any Lisp mode." :type 'hook @@ -2070,79 +1860,65 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." lisp-mode-hook clojure-mode-hook) (run-hooks 'lisp-mode-common-hook)) -;; #+END_SRC ;;;;;;; Redshank ;; Lisp syntax allows for really easy refactoring. Redshank gives some ;; operations that aren’t part of paredit, like extracting variables into ;; let bindings. -;; #+BEGIN_SRC emacs-lisp (use-package redshank :diminish redshank-mode :after (paredit) :config (progn (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) -;; #+END_SRC ;;;;;; Emacs Lisp ;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure ;; it runs the common lisp hooks. -;; #+BEGIN_SRC emacs-lisp (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -;; #+END_SRC ;; Go-to function for elisp. Except it works through the entire Emacs ecosystem. -;; #+BEGIN_SRC emacs-lisp (use-package elisp-slime-nav :commands elisp-slime-nav-mode :diminish elisp-slime-nav-mode :init (progn (add-hook 'emacs-lisp-mode-hook #'elisp-slime-nav-mode))) -;; #+END_SRC ;; Interactive elisp -;; #+BEGIN_SRC emacs-lisp (use-package ielm :defer t :ensure nil :config (progn (define-hook-helper ielm-mode () (run-hooks 'lisp-mode-common-hook)))) -;; #+END_SRC ;;;;;; Scheme & Lisp ;; I don’t work with these as often as I would like -;; #+BEGIN_SRC emacs-lisp (define-hook-helper lisp-mode () (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) -;; #+END_SRC ;;;;;;; geiser ;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the ;; future. -;; #+BEGIN_SRC emacs-lisp (use-package geiser :commands (geiser-mode geiser run-geiser run-racket)) -;; #+END_SRC ;;;;;;; slime ;; A REPL thing (and more) for Lisp. -;; #+BEGIN_SRC emacs-lisp (use-package slime :commands (slime) :config (progn @@ -2153,11 +1929,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" inferior-lisp-program (or (executable-find "sbcl") (executable-find "ccl64"))))) -;; #+END_SRC ;;;;;; Clojure -;; #+BEGIN_SRC emacs-lisp (use-package clojure-mode :defer t :init (progn @@ -2172,36 +1946,30 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (progn (define-hook-helper clojure-mode () (clj-refactor-mode 1)))) -;; #+END_SRC ;;;;;;; cider ;; A REPL thing for Clojure -;; #+BEGIN_SRC emacs-lisp (use-package cider :defer t :config (progn (setq nrepl-hide-special-buffers t) (unbind-key "C-c C-f" cider-mode-map) (add-hook 'cider-mode-hook #'eldoc-mode))) -;; #+END_SRC ;;;;; Auto-compile ;; Auto-compile emacs lisp when saving. -;; #+BEGIN_SRC emacs-lisp (use-package auto-compile :defer t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -;; #+END_SRC ;;;;; cc-mode ;; Although I don’t use C or C++, setting up the mode is helpful because ;; quite a few other modes are derived from it. -;; #+BEGIN_SRC emacs-lisp (use-package cc-mode :defer 5 :config (progn @@ -2210,30 +1978,23 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (other . "k&r")) c-basic-offset 4) (c-set-offset 'case-label '+))) -;; #+END_SRC ;;;;; quickrun ;; It’s nice to be able to quickly evaluate some code. Although I don’t ;; really seem to use it. -;; #+BEGIN_SRC emacs-lisp (use-package quickrun :bind (("C-c C-e" . quickrun))) -;; #+END_SRC ;;;;; Scala ;; Let’s try using Scala. -;; #+BEGIN_SRC emacs-lisp (use-package scala-mode) -;; #+END_SRC ;; And add ensime, an IDE-style environment. -;; #+BEGIN_SRC emacs-lisp (use-package ensime) -;; #+END_SRC ;;;;; Web development @@ -2242,7 +2003,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; This mode is really great for editing Javascript. It turns code into ;; an AST internally, so it can work with it almost like a lisp. -;; #+BEGIN_SRC emacs-lisp (use-package js2-mode :mode (("\\.js\\'" . js2-mode)) :interpreter ("node" . js2-mode) @@ -2261,25 +2021,21 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." js2-include-node-externs t js2-highlight-level 1 js2-strict-missing-semi-warning nil))) -;; #+END_SRC ;;;;;;; rjsx-mode ;; A set of advice for js2-jsx-mode to work better with React. -;; #+BEGIN_SRC emacs-lisp (use-package rjsx-mode :after js2-mode :if (fboundp #'js2--struct-put) :mode (("\\.jsx\\'" . rjsx-mode))) -;; #+END_SRC ;;;;;;; js2-refactor ;; Thanks to the AST provided by js2-mode, refactoring is possible. This ;; library implements some refactorings. -;; #+BEGIN_SRC emacs-lisp (use-package js2-refactor :after js2-mode :diminish js2-refactor-mode @@ -2287,14 +2043,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key "C-k" #'js2r-kill js2-mode-map) (add-hook 'js2-mode-hook #'js2-refactor-mode) (js2r-add-keybindings-with-prefix "C-c C-m"))) -;; #+END_SRC ;;;;;;; add-node-modules-path ;; Inside a javascript project, it's common to install tools locally to ;; the project. This will allows emacs to find their executables. -;; #+BEGIN_SRC emacs-lisp (use-package add-node-modules-path :config (progn (define-hook-helper js2-mode () @@ -2303,16 +2057,13 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-eslint-executable "eslint")) (when (executable-find "standard") (setq flycheck-javascript-standard-executable "standard"))))) -;; #+END_SRC ;;;;;;; Flow -;; #+BEGIN_SRC emacs-lisp (use-package flow-minor-mode :after js2-mode :config (progn (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) -;; #+END_SRC ;;;;;;; Indium @@ -2332,19 +2083,16 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; ~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ -;; #+BEGIN_SRC emacs-lisp (use-package indium :diminish (indium-interaction-mode . "In") :config (progn (add-hook 'js2-mode-hook #'indium-interaction-mode))) -;; #+END_SRC ;;;;;; tern ;; Tern understands javascript. It adds really clever documented ;; completions, besides other IDE-like things. -;; #+BEGIN_SRC emacs-lisp (use-package tern :diminish tern-mode :if (executable-find "tern") @@ -2358,17 +2106,14 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (with-eval-after-load 'tern (use-package company-tern)) -;; #+END_SRC ;;;;;; json-mode -;; #+BEGIN_SRC emacs-lisp (use-package json-mode :mode (("\\.json\\'" . json-mode) ("\\.sailsrc\\'" . json-mode) ("composer\\.lock\\'" . json-mode) ("\\.tern-project\\'" . json-mode))) -;; #+END_SRC ;;;;;; restclient @@ -2376,7 +2121,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; calls. Feels a bit like using =org-babel=. I wonder if there’s an ;; integration between the two yet. -;; #+BEGIN_SRC emacs-lisp (use-package restclient :mode ("\\.api\\'" . restclient-mode) :config (progn @@ -2389,22 +2133,18 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package company-restclient :after (company restclient) :init (add-to-list 'company-backends #'company-restclient t)) -;; #+END_SRC ;;;;;; sgml-mode ;; This is for HTML, since old versions of HTML were derived from SGML. -;; #+BEGIN_SRC emacs-lisp (use-package sgml-mode :defer t :config (setq sgml-basic-offset 2)) -;; #+END_SRC ;;;;;; emmet-mode ;; Emmet is really nice to write HTML quickly. Especially with ;; frameworks that require multiple nested elements to do anything useful. -;; #+BEGIN_SRC emacs-lisp (use-package emmet-mode :commands (emmet-mode) :diminish (emmet-mode . " >") @@ -2414,7 +2154,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'sgml-mode-hook #'emmet-mode) (add-hook 'web-mode-hook #'emmet-mode) (add-hook 'css-mode-hook #'emmet-mode))) -;; #+END_SRC ;;;;;; web-mode @@ -2422,7 +2161,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; is really nice, because it handles the HTML part the same way in all ;; of them as well. -;; #+BEGIN_SRC emacs-lisp (use-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("\\.html\\'" . web-mode) @@ -2439,13 +2177,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." web-mode-enable-auto-pairing nil web-mode-enable-auto-quoting nil) (sp-local-pair '(web-mode) "<%" "%>"))) -;; #+END_SRC ;;;;; Live coding ;; Sometimes I might want to show off my emacs usage. -;; #+BEGIN_SRC emacs-lisp (defun live-coding () "Configure display for live coding." (interactive) @@ -2457,22 +2193,18 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (interactive) (ap/set-fonts-according-to-system) (global-command-log-mode -1)) -;; #+END_SRC ;;;;;; command-log-mode -;; #+BEGIN_SRC emacs-lisp (use-package command-log-mode :defines (command-log-mode-key-binding-open-log) :config (progn (setq command-log-mode-key-binding-open-log nil command-log-mode-auto-show t command-log-mode-is-global t))) -;; #+END_SRC ;;;; Spelling -;; #+BEGIN_SRC emacs-lisp (use-package ispell :bind (("" . ispell-word)) :config (progn @@ -2484,9 +2216,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ((executable-find "hunspell") (setq ispell-program-name "hunspell" ispell-really-aspell nil ispell-really-hunspell t))))) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (use-package flyspell :diminish " ﹏" :config (progn @@ -2532,26 +2262,22 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq-local ispell-extra-args (flyspell-detect-ispell-args))) (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) -;; #+END_SRC ;;;;; Style checking ;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-vale :if (executable-find "vale") :config (progn (add-to-list 'flycheck-vale-modes 'org-mode) (add-to-list 'flycheck-vale-modes 'org-journal-mode) (flycheck-vale-setup))) -;; #+END_SRC ;;;; Scripting ;; Make a shell-script buffer executable after saving it, if it has a shebang. -;; #+BEGIN_SRC emacs-lisp (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) @@ -2562,18 +2288,14 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq sh-shell-file "/usr/bin/env zsh" sh-indentation 2 sh-basic-offset 2)) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) -;; #+END_SRC ;;;;; eshell ;; I should try to get into the habit of using this more. It’s really ;; nice, when I remember to use it. -;; #+BEGIN_SRC emacs-lisp (use-package eshell :bind ("C-c s" . eshell) :defer 10 @@ -2609,11 +2331,9 @@ Pass optional ARG to `eshell' (which see)." (bind-key "C-c S" #'eshell-goto-current-dir) -;; #+END_SRC ;;;;;; Shells -;; #+BEGIN_SRC emacs-lisp (use-package shell :defer t :ensure nil @@ -2632,26 +2352,22 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (if (null (get-buffer-process (current-buffer))) (kill-buffer) (comint-delchar-or-maybe-eof arg))) -;; #+END_SRC ;;;; Text editing ;; Emacs has an editor within. -;; #+BEGIN_SRC emacs-lisp (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (setq sentence-end-double-space t line-move-visual nil) (setq-default truncate-lines nil) -;; #+END_SRC ;;;;; align ;; =Align= is a useful command to line things up, once given some rules. ;; The most important one for me is JSON property alignment. -;; #+BEGIN_SRC emacs-lisp (use-package align :defer 10 :ensure nil @@ -2660,64 +2376,52 @@ Pass ARG to `comint-delchar-or-maybe-eof'." '(colon-key-value (regexp . ":\\(\\s-*\\)") (modes . '(js2-mode)))))) -;; #+END_SRC ;;;;; Clipboard ;; I like to use the clipboard more than the primary selection in X11. -;; #+BEGIN_SRC emacs-lisp (setq select-enable-clipboard t save-interprogram-paste-before-kill t) (if (functionp 'x-cut-buffer-or-selection-value) (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) (when (boundp 'x-select-request-type) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) -;; #+END_SRC ;;;;; Selection ;; I’m quite used to deleting text by selecting it and typing. Emacs has ;; a mode for that. -;; #+BEGIN_SRC emacs-lisp (use-package delsel :config (delete-selection-mode t)) -;; #+END_SRC ;; Sub-word movement is really nice for camel- and Pascal-case -;; #+BEGIN_SRC emacs-lisp (use-package subword :diminish subword-mode :init (global-subword-mode t)) -;; #+END_SRC ;; I find that =zap-up-to-char= normally makes more sense to me than ;; =zap-to-char=. -;; #+BEGIN_SRC emacs-lisp (use-package misc :ensure nil :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) -;; #+END_SRC ;; Expanding the region by semantic units was something I quite liked ;; from Sublime Text. As always, there’s a mode for that. -;; #+BEGIN_SRC emacs-lisp (use-package expand-region :bind ("C-M-SPC" . er/expand-region) :config (setq expand-region-fast-keys-enabled nil)) -;; #+END_SRC ;;;;; avy ;; Avy is a really nice way to move around files, like ace-jump-mode, but ;; somehow I prefer it. -;; #+BEGIN_SRC emacs-lisp (use-package avy :defer 5 :bind* (("M-g g" . avy-goto-line) @@ -2729,51 +2433,42 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (avy-setup-default) (setq avy-all-windows nil avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) -;; #+END_SRC ;;;;;; ace-link ;; Visit any link. Despite the name, this works with avy. -;; #+BEGIN_SRC emacs-lisp (use-package ace-link :after avy :config (progn (ace-link-setup-default))) -;; #+END_SRC ;;;;; goto-chg ;; This is like popping the mark, only it filters to only change areas ;; and doesn’t go back to the same place more than once. -;; #+BEGIN_SRC emacs-lisp (use-package goto-chg :bind ("C-c C-SPC" . goto-last-change)) -;; #+END_SRC ;;;;; beginend ;; In special buffers, I would rather have =M->= and =M-<= goto the ;; logical beginning/end rather than the physical ones. -;; #+BEGIN_SRC emacs-lisp (use-package beginend :config (progn (beginend-setup-all) (seq-do (lambda (modepair) (diminish (cdr modepair))) beginend-modes))) -;; #+END_SRC ;;;;; fontawesome ;; Sometimes I might want to add a font-awesome icon to some text. ;; This package gives me two interfaces to find the icons -;; #+BEGIN_SRC emacs-lisp (use-package fontawesome) -;; #+END_SRC ;;;;; multiple-cursors @@ -2781,7 +2476,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; cursors was one of my favourite features, so I was really happy when I ;; saw that multiple-cursors was released for Emacs. -;; #+BEGIN_SRC emacs-lisp (use-package multiple-cursors :defer 1 :bind* (("C-." . mc/mark-next-like-this) @@ -2789,14 +2483,12 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("M-" . mc/mark-all-like-this-dwim) ("C-" . mc/mark-more-like-this-extended) ("C-S-L" . mc/edit-lines))) -;; #+END_SRC ;;;;; paredit ;; Balanced parentheses in lisps are nice, but all the refactoring and ;; movement commands are much more interesting. -;; #+BEGIN_SRC emacs-lisp (use-package paredit :diminish "()" :config (progn @@ -2804,7 +2496,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (put #'paredit-forward-delete 'delete-selection 'supersede) (put #'paredit-backward-delete 'delete-selection 'supersede) (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) -;; #+END_SRC ;;;;; smartparens @@ -2812,7 +2503,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; I didn’t find smartparens’ implementation of paredit style to be as ;; nice as the real version -;; #+BEGIN_SRC emacs-lisp (eval-when-compile (require 'smartparens nil :noerror)) (use-package smartparens-config :ensure smartparens @@ -2838,24 +2528,20 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (define-hook-helper lisp-mode-common () (smartparens-strict-mode -1) (smartparens-mode -1)))) -;; #+END_SRC ;;;;; move-text ;; Transposing lines, made easier. -;; #+BEGIN_SRC emacs-lisp (use-package move-text :config (move-text-default-bindings)) -;; #+END_SRC ;;;;; undo-tree ;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes ;; it much clearer. It’s especially helpful for protoyping and refactoring. -;; #+BEGIN_SRC emacs-lisp (use-package undo-tree :config (progn (global-undo-tree-mode) @@ -2871,14 +2557,11 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (set-marker m nil)) ad-do-it))) :diminish undo-tree-mode) -;; #+END_SRC ;;;;; replace -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "replace.el" (setq case-replace nil)) -;; #+END_SRC ;;;;; visual-regexp @@ -2886,23 +2569,19 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; so this package is pretty useful because it highlights everything in ;; the buffer for me. -;; #+BEGIN_SRC emacs-lisp (use-package visual-regexp :bind (("C-c r" . vr/replace) ("C-c q" . vr/query-replace) ("C-c m" . vr/mc-mark))) -;; #+END_SRC ;;;; End ;; Start a server if possible. A daemon is already a server. -;; #+BEGIN_SRC emacs-lisp (use-package server :defer 2 :if (not (daemonp)) :config (unless (server-running-p server-name) (server-start))) -;; #+END_SRC ;; # Local Variables: ;; # lentic-init: lentic-orgel-org-init -- cgit 1.4.1