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(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6c3e35c..b28107f 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 From 45e3307f95a1aa8d4be2383e0cc6b4d05547acc7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 16:11:59 +0100 Subject: Emacs: Replace smart-tab with a simple binding --- tag-emacs/emacs.d/init.org | 47 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b28107f..24888f9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -775,30 +775,12 @@ Directional window movement Make built-in completion a bit more intelligent, by adding substring and initial-based completion and ignoring case. -** TODO With =tab-always-indent=, do I need smart-tab anymore? - #+BEGIN_SRC emacs-lisp (setq completion-styles '(basic initials partial-completion substring) completion-ignore-case t tab-always-indent 'complete) #+END_SRC -*** Smart-tab - -Most editors use tab for both completion and indentation. Smart-tab -tries to do the right thing depending on the location of the point and -the line’s current indentation. - -#+BEGIN_SRC emacs-lisp -(use-package smart-tab - :commands (global-smart-tab-mode) - :init (global-smart-tab-mode) - :diminish smart-tab-mode - :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) - (diminish 'smart-tab-mode ""))) -#+END_SRC - *** Company The main choices for automatic completion in Emacs are company and @@ -806,20 +788,21 @@ 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 "Cmpl" - :bind (("C-" . company-complete)) - :init (progn - (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) - company-oddmuse company-files company-dabbrev) - company-idle-delay .3 - company-begin-commands '(self-insert-command) - company-auto-complete #'company-explicit-action-p - company-auto-complete-chars '(?\ ?\( ?\) ?.) - company-tooltip-align-annotations t - company-dabbrev-downcase nil))) + (use-package company + :commands (company-mode) + :diminish "Cmpl" + :bind (("C-" . company-complete) + ("TAB" . company-indent-or-complete-common)) + :init (progn + (add-hook 'prog-mode-hook #'company-mode) + (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + company-oddmuse company-files company-dabbrev) + company-idle-delay .3 + company-begin-commands '(self-insert-command) + company-auto-complete #'company-explicit-action-p + company-auto-complete-chars '(?\ ?\( ?\) ?.) + company-tooltip-align-annotations t + company-dabbrev-downcase nil))) #+END_SRC * Dates & Times -- cgit 1.4.1 From 2982d13a5bb1b149fda39fd1af7638aa437d3f43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Dec 2015 17:17:09 +0100 Subject: Emacs: Don’t show server running message --- tag-emacs/emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 24888f9..2cfb32f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2417,8 +2417,7 @@ Start a server if possible. A daemon is already a server. (run-with-idle-timer 2 nil (lambda () (unless (daemonp) (require 'server) - (if (server-running-p server-name) - (message "Server already appears to be running") + (unless (server-running-p server-name) (server-start))))) (setq gc-cons-threshold 800000 file-name-handler-alist '(("\\(?:\\.dz\\|\\.txz\\|\\.xz\\|\\.lzma\\|\\.lz\\|\\.g?z\\|\\.\\(?:tgz\\|svgz\\|sifz\\)\\|\\.tbz2?\\|\\.bz2\\|\\.Z\\)\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)?\\'" . jka-compr-handler) -- cgit 1.4.1 From eac4c6007a802ba7d430283888aa3a03d4844751 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Dec 2015 17:22:15 +0100 Subject: Emacs: Add fallback execute-extended-command bind --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2cfb32f..a25c615 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1078,6 +1078,7 @@ Option/alt, then Control. (bind-key* "s-x" (define-prefix-command 'super-x-map)) (bind-key* "s-," #'switch-to-dotfiles) + (bind-key* "C-M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC * Misc -- cgit 1.4.1 From 72303ddc158dc7aa26fe041e9be646bca857babd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Dec 2015 09:03:36 +0100 Subject: Git: Remember merge conflict resolutions --- tag-git/config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 2922285..3d6b82a 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -30,3 +30,5 @@ excludesfile = ~/.config/git/ignore [rebase] autosquash = true +[rerere] + enabled = true -- cgit 1.4.1