From 999b7ac844c980b46044d4e0c188e1a3bf76bc2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Oct 2016 10:49:40 +0100 Subject: Change indentation setup to two spaces --- tag-emacs/emacs.d/init.org | 60 +++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c01f63a..80c6b63 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -621,11 +621,12 @@ I like a horizonal diff setup, with everything in one frame. * Indentation Ah, a complicated topic. One day we’ll all be using elastic -tabstops. Until then, I want 4-wide tabs, and make them real tabs! +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 4 - indent-tabs-mode t) + (setq-default tab-width 2 + indent-tabs-mode nil) #+END_SRC ** auto-indent-mode @@ -639,7 +640,7 @@ whitespace-sensitive language, of course. (setq auto-indent-key-for-end-of-line-then-newline "" auto-indent-key-for-end-of-line-insert-char-then-newline "" auto-indent-blank-lines-on-move nil - auto-indent-assign-indent-level 4 + auto-indent-assign-indent-level 2 auto-indent-backward-delete-char-behavior nil auto-indent-delete-trailing-whitespace-on-save-file t auto-indent-mode-untabify-on-yank-or-paste nil @@ -665,7 +666,7 @@ with spaces. Perfect! (use-package smart-tabs-mode :defer 1 :config (progn - (smart-tabs-insinuate 'c 'cperl 'javascript 'python) + (smart-tabs-insinuate 'c 'cperl 'python) (add-hook 'php-mode-hook (lambda () (smart-tabs-mode indent-tabs-mode))) (with-eval-after-load "align.el" @@ -1307,10 +1308,7 @@ configuration files. :mode (("Dockerfile\\'" . dockerfile-mode))) (use-package nix-mode - :mode (("\\.nix\\'" . nix-mode)) - :config (progn - (add-hook 'nix-mode-hook (lambda () - (setq-local indent-tabs-mode nil))))) + :mode (("\\.nix\\'" . nix-mode))) (define-derived-mode xmonad-mode haskell-mode "XM") (add-to-list 'auto-mode-alist '("xmobarrc\\'" . xmonad-mode)) @@ -1319,9 +1317,7 @@ configuration files. (use-package nginx-mode :defer t :mode (("/nginx/servers/" . nginx-mode) - ("/nginx/.*\\.d/" . nginx-mode)) - :config (progn - (setq nginx-indent-tabs-mode t))) + ("/nginx/.*\\.d/" . nginx-mode))) (use-package lua-mode :defer t) @@ -1368,9 +1364,6 @@ works really nicely. (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) (ledger-report "Budget (Cumulative)" nil))) :config (progn - (defun setup-ledger-mode () - (setq-local indent-tabs-mode nil)) - (add-hook 'ledger-mode-hook #'setup-ledger-mode) (setq ledger-use-iso-dates t ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" @@ -1563,6 +1556,20 @@ write to the Android calendar, and then for DAVDroid to sync with the server. org-icalendar-alarm-time 60))) #+END_SRC +**** org-page + +I would like to convert my website from using hugo to something else +that I can work with nicely from inside Emacs. I wonder if org-page +will do the trick. + +#+BEGIN_SRC emacs-lisp + (use-package org-page + :config (progn + (setq op/site-domain "https://alanpearce.uk/" + op/repository-directory "~/projects/alanpearce/" + op/personal-github-link "https://github.com/alanpearce"))) +#+END_SRC + * Music Emacs actually supports playing music via mpd. @@ -1636,8 +1643,7 @@ A nice completion backend for programming modes. *** All Lisp modes don’t seem to have a common ancestor. So I made a custom -hook which I trigger in every lispy-mode. Of course, no tabs in -lisps. Even I understand that. +hook which I trigger in every lispy-mode. #+BEGIN_SRC emacs-lisp (defcustom lisp-mode-common-hook nil @@ -1646,8 +1652,7 @@ lisps. Even I understand that. :group 'lisp) (defun ap/lisp-setup () - (run-hooks 'lisp-mode-common-hook) - (setq indent-tabs-mode nil)) + (run-hooks 'lisp-mode-common-hook)) #+END_SRC **** Redshank @@ -1946,9 +1951,9 @@ of them as well. ("/templates/.*\\.php\\'" . web-mode) ("\\.ejs\\'" . web-mode)) :config (progn - (setq web-mode-code-indent-offset 4 - web-mode-css-indent-offset 4 - web-mode-markup-indent-offset 4 + (setq web-mode-code-indent-offset 2 + web-mode-css-indent-offset 2 + web-mode-markup-indent-offset 2 web-mode-style-padding 0 web-mode-script-padding 0 web-mode-comment-style 2 @@ -1979,12 +1984,13 @@ I derived a mode for twig, in order to use its =mode-hook=. 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) + (add-hook 'after-save-hook + #'executable-make-buffer-file-executable-if-script-p) -(use-package sh-script - :mode (("\\.zsh\\'" . shell-script-mode)) - :config (setq sh-shell-file "/usr/bin/env zsh")) + (use-package sh-script + :mode (("\\.zsh\\'" . shell-script-mode)) + :config (setq sh-shell-file "/usr/bin/env zsh" + sh-indentation 2)) #+END_SRC #+BEGIN_SRC emacs-lisp -- cgit 1.4.1