Reorganize second section of Emacs init

This commit is contained in:
Tom Willemse 2017-03-05 22:12:22 -08:00
parent 4d01c6d8bf
commit ab8803b72b

View file

@ -147,142 +147,184 @@ Computing Environment".
(mapc (lambda (p) (package-install p t)) available)))) (mapc (lambda (p) (package-install p t)) available))))
#+END_SRC #+END_SRC
* Backups * General settings
I don't like having every directory filled with "filename~" These settings are generally not associated with a specific mode,
files. So instead of saving backup files to the same directory, save but affect how the core of Emacs behaves.
them to a special one instead.
#+BEGIN_SRC emacs-lisp ** Files
(setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/"))))
#+END_SRC
* 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 *** Backups
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.
#+BEGIN_SRC emacs-lisp I don't like having every directory filled with "filename~"
(add-to-list 'auto-save-file-name-transforms files. So instead of saving backup files to the same directory, save
`(".*" ,(oni:data-location "auto-save-files/") t) :append) them to a special one instead.
#+END_SRC
Place the files which contain the auto save files in a similar #+BEGIN_SRC emacs-lisp
directory. (setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/"))))
#+END_SRC
#+BEGIN_SRC emacs-lisp *** Auto saves
(setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))
#+END_SRC
* 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 **** Auto save files
languages.
#+BEGIN_SRC emacs-lisp Usually these files get deleted, but sometimes they don't, and I
(setq-default indent-tabs-mode nil) don't think they look pretty. Add it to the end of the list because
#+END_SRC 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 #+BEGIN_SRC emacs-lisp
right. (add-to-list 'auto-save-file-name-transforms
`(".*" ,(oni:data-location "auto-save-files/") t) :append)
#+END_SRC
#+BEGIN_SRC emacs-lisp **** Auto save indexes
(setq-default tab-width 4)
#+END_SRC
* 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 #+BEGIN_SRC emacs-lisp
anymore. I don't see it on my PC where I start Emacs in daemon mode, (setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))
but on my laptop I always start it normally, so it gets in the way. #+END_SRC
#+BEGIN_SRC emacs-lisp * Typographic style
(setq inhibit-startup-screen t)
#+END_SRC
* 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 ** Whitespace
(add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15"))
#+END_SRC
* 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 *** Remove trailing whitespace before saving
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 I hate it when trailing whitespace is left around a file. I've been
(add-to-list 'default-frame-alist '(internal-border-width . 15)) using this for years, and apart from having some trouble working
#+END_SRC 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 Having a final newline at the end of the file is always a good
(menu-bar-mode -1) idea. Some programs just don't work without it and others produce
#+END_SRC 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 Unless absolutely necessary, I really don't want any tabs in my
(tool-bar-mode -1) code.
#+END_SRC
* Scroll bar **** Don't use tabs for indentation
I don't use the scroll bar to either navigate my buffers or see Generally I prefer using spaces over tabs. Especially for lisp-like
whereabouts I am, so they just take up space. languages.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(scroll-bar-mode -1) (setq-default indent-tabs-mode nil)
#+END_SRC #+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 #+BEGIN_SRC emacs-lisp
(setq-default cursor-type '(bar . 2)) (setq-default tab-width 4)
#+END_SRC #+END_SRC
* Whitespace ** User Interface
I hate it when trailing whitespace is left around a file. I've been Emacs' user interface is very configurable, from themes to hiding
using this for years, and apart from having some trouble working unnecessary elements.
with people who don't pay attention to it, it has worked flawlessly.
#+BEGIN_SRC emacs-lisp *** Inhibit startup screen
(require 'destroy-trailing-whitespace)
(global-destroy-trailing-whitespace-mode)
#+END_SRC
Having a final newline at the end of the file is always a good I've been using Emacs long enough not to need the startup screen
idea. Some programs just don't work without it and others produce anymore. I don't see it on my PC where I start Emacs in daemon mode,
some strange results. Github diffs are an example. but on my laptop I always start it normally, so it gets in the way.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq require-final-newline t) (setq inhibit-startup-screen t)
#+END_SRC #+END_SRC
* Long lines *** Font
By default Emacs wraps long lines around to the next line when they Set the default font to a more pleasing one, in my opinion, with a
reach the far end of the window. However I prefer to have them better size as well.
truncated instead.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq-default truncate-lines t) (add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15"))
#+END_SRC #+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 * Theme