From ab8803b72bfe331f859cca2ca168fdf99d201a2f Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 5 Mar 2017 22:12:22 -0800 Subject: [PATCH] Reorganize second section of Emacs init --- emacs/.emacs.d/init.org | 232 ++++++++++++++++++++++++---------------- 1 file changed, 137 insertions(+), 95 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ef23b87..70ad205 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -147,142 +147,184 @@ Computing Environment". (mapc (lambda (p) (package-install p t)) available)))) #+END_SRC -* Backups +* General settings - I don't like having every directory filled with "filename~" - files. So instead of saving backup files to the same directory, save - them to a special one instead. + These settings are generally not associated with a specific mode, + but affect how the core of Emacs behaves. - #+BEGIN_SRC emacs-lisp - (setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/")))) - #+END_SRC +** Files -* Auto saves + There are a lot of files that Emacs uses to keep track of things. I + usually prefer to keep them all in one place together, instead of + spreading them around the filesystem. With exceptions of course. - I prefer to keep all autosave files in a single directory so they - don't clog up my filesystem so much. Usually these files get - deleted, but sometimes they don't, and I don't think they look - pretty. Add it to the end of the list because the default value - stores auto-saves for remote files in /tmp, which is fine by me. +*** Backups - #+BEGIN_SRC emacs-lisp - (add-to-list 'auto-save-file-name-transforms - `(".*" ,(oni:data-location "auto-save-files/") t) :append) - #+END_SRC + I don't like having every directory filled with "filename~" + files. So instead of saving backup files to the same directory, save + them to a special one instead. - Place the files which contain the auto save files in a similar - directory. + #+BEGIN_SRC emacs-lisp + (setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/")))) + #+END_SRC - #+BEGIN_SRC emacs-lisp - (setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-")) - #+END_SRC +*** Auto saves -* Tabs + I prefer to keep all autosave files in a single directory so they + don't clog up my filesystem so much. - Generally I prefer using spaces over tabs. Especially for lisp-like - languages. +**** Auto save files - #+BEGIN_SRC emacs-lisp - (setq-default indent-tabs-mode nil) - #+END_SRC + Usually these files get deleted, but sometimes they don't, and I + don't think they look pretty. Add it to the end of the list because + the default value stores auto-saves for remote files in /tmp, which + is fine by me. - A tab-width of 8 is too wide for me, and 2 is too narrow. 4 is just - right. + #+BEGIN_SRC emacs-lisp + (add-to-list 'auto-save-file-name-transforms + `(".*" ,(oni:data-location "auto-save-files/") t) :append) + #+END_SRC - #+BEGIN_SRC emacs-lisp - (setq-default tab-width 4) - #+END_SRC +**** Auto save indexes -* Inhibit startup screen + Place the files which contain the indexes of auto save files in a + similar directory. - I've been using Emacs long enough not to need the startup screen - anymore. I don't see it on my PC where I start Emacs in daemon mode, - but on my laptop I always start it normally, so it gets in the way. + #+BEGIN_SRC emacs-lisp + (setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-")) + #+END_SRC - #+BEGIN_SRC emacs-lisp - (setq inhibit-startup-screen t) - #+END_SRC +* Typographic style -* Font + Emacs being a text editor has options on how to handle your text. - Set the default font to a more pleasing one, in my opinion, with a - better size as well. - #+BEGIN_SRC emacs-lisp - (add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15")) - #+END_SRC +** Whitespace -* Internal border + Even though whitespace technically isn't seen, it can still be an + eyesore and highly annoying, you must always keep it well in + check. - For aesthetics I like to have a thick border on the inside of my - Emacs window. I have the same border in URxvt, but I haven't found - out how to add it to Conkeror yet. +*** Remove trailing whitespace before saving - #+BEGIN_SRC emacs-lisp - (add-to-list 'default-frame-alist '(internal-border-width . 15)) - #+END_SRC + I hate it when trailing whitespace is left around a file. I've been + using this for years, and apart from having some trouble working + with people who don't pay attention to it, it has worked flawlessly. -* Menu bar + #+BEGIN_SRC emacs-lisp + (require 'destroy-trailing-whitespace) + (global-destroy-trailing-whitespace-mode) + #+END_SRC - I don't use the menu bar, so it just takes up space. +*** Make sure there is a newline at the end of the file - #+BEGIN_SRC emacs-lisp - (menu-bar-mode -1) - #+END_SRC + Having a final newline at the end of the file is always a good + idea. Some programs just don't work without it and others produce + some strange results. Github diffs are an example. -* Tool bar + #+BEGIN_SRC emacs-lisp + (setq require-final-newline t) + #+END_SRC - I don't use the tool bar, so it just takes up space. +*** Tabs - #+BEGIN_SRC emacs-lisp - (tool-bar-mode -1) - #+END_SRC + Unless absolutely necessary, I really don't want any tabs in my + code. -* Scroll bar +**** Don't use tabs for indentation - I don't use the scroll bar to either navigate my buffers or see - whereabouts I am, so they just take up space. + Generally I prefer using spaces over tabs. Especially for lisp-like + languages. - #+BEGIN_SRC emacs-lisp - (scroll-bar-mode -1) - #+END_SRC + #+BEGIN_SRC emacs-lisp + (setq-default indent-tabs-mode nil) + #+END_SRC -* Cursor +**** Display tabs as 4 columns wide - Use a bar cursor instead of a box. + A tab-width of 8 is too wide for me, and 2 is too narrow. 4 is just + right. - #+BEGIN_SRC emacs-lisp - (setq-default cursor-type '(bar . 2)) - #+END_SRC + #+BEGIN_SRC emacs-lisp + (setq-default tab-width 4) + #+END_SRC -* Whitespace +** User Interface - I hate it when trailing whitespace is left around a file. I've been - using this for years, and apart from having some trouble working - with people who don't pay attention to it, it has worked flawlessly. + Emacs' user interface is very configurable, from themes to hiding + unnecessary elements. - #+BEGIN_SRC emacs-lisp - (require 'destroy-trailing-whitespace) - (global-destroy-trailing-whitespace-mode) - #+END_SRC +*** Inhibit startup screen - Having a final newline at the end of the file is always a good - idea. Some programs just don't work without it and others produce - some strange results. Github diffs are an example. + I've been using Emacs long enough not to need the startup screen + anymore. I don't see it on my PC where I start Emacs in daemon mode, + but on my laptop I always start it normally, so it gets in the way. - #+BEGIN_SRC emacs-lisp - (setq require-final-newline t) - #+END_SRC + #+BEGIN_SRC emacs-lisp + (setq inhibit-startup-screen t) + #+END_SRC -* Long lines +*** Font - By default Emacs wraps long lines around to the next line when they - reach the far end of the window. However I prefer to have them - truncated instead. + Set the default font to a more pleasing one, in my opinion, with a + better size as well. - #+BEGIN_SRC emacs-lisp - (setq-default truncate-lines t) - #+END_SRC + #+BEGIN_SRC emacs-lisp + (add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15")) + #+END_SRC + +*** Internal border + + For aesthetics I like to have a thick border on the inside of my + Emacs window. I have the same border in URxvt, but I haven't found + out how to add it to Conkeror yet. + + #+BEGIN_SRC emacs-lisp + (add-to-list 'default-frame-alist '(internal-border-width . 15)) + #+END_SRC + +*** Menu bar + + I don't use the menu bar, so it just takes up space. + + #+BEGIN_SRC emacs-lisp + (menu-bar-mode -1) + #+END_SRC + +*** Tool bar + + I don't use the tool bar, so it just takes up space. + + #+BEGIN_SRC emacs-lisp + (tool-bar-mode -1) + #+END_SRC + +*** Scroll bar + + I don't use the scroll bar to either navigate my buffers or see + whereabouts I am, so they just take up space. + + #+BEGIN_SRC emacs-lisp + (scroll-bar-mode -1) + #+END_SRC + +*** Cursor + + Use a bar cursor instead of a box. + + #+BEGIN_SRC emacs-lisp + (setq-default cursor-type '(bar . 2)) + #+END_SRC + +*** Long lines + + By default Emacs wraps long lines around to the next line when they + reach the far end of the window. However I prefer to have them + truncated instead. + + #+BEGIN_SRC emacs-lisp + (setq-default truncate-lines t) + #+END_SRC * Theme