From 8857d80bb0e1fddc8c21b8f2adbf3c270aa9429e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 11:24:51 +0100 Subject: Emacs: Run style customisations first --- tag-emacs/emacs.d/init.org | 241 ++++++++++++++++++++++----------------------- 1 file changed, 120 insertions(+), 121 deletions(-) (limited to 'tag-emacs/emacs.d') diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6c3e35c7..b28107fb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -64,6 +64,126 @@ pass =:noerror= to =load= (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 + (set-scroll-bar-mode nil)) + (with-eval-after-load 'tooltip + (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 + +When I’m using dash in emacs lisp, it’s nice to have proper font +locking for it. +#+BEGIN_SRC emacs-lisp + (use-package dash + :commands (dash-enable-font-lock) + :init (progn + (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) +#+END_SRC + +** Colours + +I quite like solarized. I don’t think it’s perfect, but it supports a +lot of modes. +#+BEGIN_SRC emacs-lisp + (use-package solarized-theme + :config (progn + (setq solarized-distinct-fringe-background t) + (setq solarized-high-contrast-mode-line t) + (load-theme 'solarized-light t))) +#+END_SRC + +Colourise colour names in certain types of buffer. I don’t use this +in modes for webdev because [[web-mode]] includes that functionality. +#+BEGIN_SRC emacs-lisp +(use-package rainbow-mode + :commands (rainbow-turn-on + rainbow-turn-off) + :config (progn + (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) +#+END_SRC + +Highlighting quasi-quoted expressions in lisps is quite useful. +#+BEGIN_SRC emacs-lisp +(use-package highlight-stages + :defer t + :diminish highlight-stages-mode + :init (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) +#+END_SRC + +** Fonts + +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)) + + (defun use-variable-fonts () + (interactive) + (variable-pitch-mode) + (setq cursor-type 'bar)) + + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) + (when mono-face + (let ((default-font (concat mono-face "-" (number-to-string mono-font-size)))) + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font) + (set-frame-font default-font t t))) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string variable-font-size))))) + + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + ((eq system-type 'darwin) + (ap/set-fonts "Hack" 14 "Avenir" 14)))) +#+END_SRC + +Allow font-lock-mode to do background parsing. I’m not really sure if +these settings are particularly useful +#+BEGIN_SRC emacs-lisp + (setq jit-lock-stealth-time nil + jit-lock-stealth-load 100 + jit-lock-chunk-size 300 + jit-lock-defer-time nil + font-lock-maximum-decoration '((dired-mode . 1) + (t . t))) +#+END_SRC + +** Page Breaks + +By default, Emacs displays page breaks as ^L. Lines look much nicer. + +#+BEGIN_SRC emacs-lisp + (use-package page-break-lines + :defer 5 + :config (global-page-break-lines-mode)) +#+END_SRC * Projects #+BEGIN_SRC emacs-lisp @@ -206,127 +326,6 @@ a particular way, but it changed later. :commands git-timemachine) #+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 - (set-scroll-bar-mode nil)) - (with-eval-after-load 'tooltip - (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 - -When I’m using dash in emacs lisp, it’s nice to have proper font -locking for it. -#+BEGIN_SRC emacs-lisp - (use-package dash - :commands (dash-enable-font-lock) - :init (progn - (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) -#+END_SRC - -** Colours - -I quite like solarized. I don’t think it’s perfect, but it supports a -lot of modes. -#+BEGIN_SRC emacs-lisp - (use-package solarized-theme - :config (progn - (setq solarized-distinct-fringe-background t) - (setq solarized-high-contrast-mode-line t) - (load-theme 'solarized-light t))) -#+END_SRC - -Colourise colour names in certain types of buffer. I don’t use this -in modes for webdev because [[web-mode]] includes that functionality. -#+BEGIN_SRC emacs-lisp -(use-package rainbow-mode - :commands (rainbow-turn-on - rainbow-turn-off) - :config (progn - (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) -#+END_SRC - -Highlighting quasi-quoted expressions in lisps is quite useful. -#+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :defer t - :diminish highlight-stages-mode - :init (progn - (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) -#+END_SRC - -** Fonts - -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)) - - (defun use-variable-fonts () - (interactive) - (variable-pitch-mode) - (setq cursor-type 'bar)) - - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) - (when mono-face - (let ((default-font (concat mono-face "-" (number-to-string mono-font-size)))) - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font) - (set-frame-font default-font t t))) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string variable-font-size))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) - ((eq system-type 'darwin) - (ap/set-fonts "Hack" 14 "Avenir" 14)))) -#+END_SRC - -Allow font-lock-mode to do background parsing. I’m not really sure if -these settings are particularly useful -#+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time nil - jit-lock-stealth-load 100 - jit-lock-chunk-size 300 - jit-lock-defer-time nil - font-lock-maximum-decoration '((dired-mode . 1) - (t . t))) -#+END_SRC - -** Page Breaks - -By default, Emacs displays page breaks as ^L. Lines look much nicer. - -#+BEGIN_SRC emacs-lisp - (use-package page-break-lines - :defer 5 - :config (global-page-break-lines-mode)) -#+END_SRC - * Files ** Auto-saving -- cgit 1.4.1