Reorganize second section of Emacs init
This commit is contained in:
parent
4d01c6d8bf
commit
ab8803b72b
1 changed files with 137 additions and 95 deletions
|
@ -147,7 +147,18 @@ 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
|
||||||
|
|
||||||
|
These settings are generally not associated with a specific mode,
|
||||||
|
but affect how the core of Emacs behaves.
|
||||||
|
|
||||||
|
** Files
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*** Backups
|
||||||
|
|
||||||
I don't like having every directory filled with "filename~"
|
I don't like having every directory filled with "filename~"
|
||||||
files. So instead of saving backup files to the same directory, save
|
files. So instead of saving backup files to the same directory, save
|
||||||
|
@ -157,105 +168,44 @@ Computing Environment".
|
||||||
(setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/"))))
|
(setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/"))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Auto saves
|
*** Auto saves
|
||||||
|
|
||||||
I prefer to keep all autosave files in a single directory so they
|
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
|
don't clog up my filesystem so much.
|
||||||
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
|
**** Auto save files
|
||||||
stores auto-saves for remote files in /tmp, which is fine by me.
|
|
||||||
|
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
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'auto-save-file-name-transforms
|
(add-to-list 'auto-save-file-name-transforms
|
||||||
`(".*" ,(oni:data-location "auto-save-files/") t) :append)
|
`(".*" ,(oni:data-location "auto-save-files/") t) :append)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Place the files which contain the auto save files in a similar
|
**** Auto save indexes
|
||||||
directory.
|
|
||||||
|
Place the files which contain the indexes of auto save files in a
|
||||||
|
similar directory.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))
|
(setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Tabs
|
* Typographic style
|
||||||
|
|
||||||
Generally I prefer using spaces over tabs. Especially for lisp-like
|
Emacs being a text editor has options on how to handle your text.
|
||||||
languages.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq-default indent-tabs-mode nil)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
A tab-width of 8 is too wide for me, and 2 is too narrow. 4 is just
|
** Whitespace
|
||||||
right.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
Even though whitespace technically isn't seen, it can still be an
|
||||||
(setq-default tab-width 4)
|
eyesore and highly annoying, you must always keep it well in
|
||||||
#+END_SRC
|
check.
|
||||||
|
|
||||||
* Inhibit startup screen
|
*** Remove trailing whitespace before saving
|
||||||
|
|
||||||
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 inhibit-startup-screen t)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Font
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
* 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
|
|
||||||
|
|
||||||
* Whitespace
|
|
||||||
|
|
||||||
I hate it when trailing whitespace is left around a file. I've been
|
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
|
using this for years, and apart from having some trouble working
|
||||||
|
@ -266,6 +216,8 @@ Computing Environment".
|
||||||
(global-destroy-trailing-whitespace-mode)
|
(global-destroy-trailing-whitespace-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Make sure there is a newline at the end of the file
|
||||||
|
|
||||||
Having a final newline at the end of the file is always a good
|
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
|
idea. Some programs just don't work without it and others produce
|
||||||
some strange results. Github diffs are an example.
|
some strange results. Github diffs are an example.
|
||||||
|
@ -274,7 +226,97 @@ Computing Environment".
|
||||||
(setq require-final-newline t)
|
(setq require-final-newline t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Long lines
|
*** Tabs
|
||||||
|
|
||||||
|
Unless absolutely necessary, I really don't want any tabs in my
|
||||||
|
code.
|
||||||
|
|
||||||
|
**** Don't use tabs for indentation
|
||||||
|
|
||||||
|
Generally I prefer using spaces over tabs. Especially for lisp-like
|
||||||
|
languages.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
**** Display tabs as 4 columns wide
|
||||||
|
|
||||||
|
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 tab-width 4)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** User Interface
|
||||||
|
|
||||||
|
Emacs' user interface is very configurable, from themes to hiding
|
||||||
|
unnecessary elements.
|
||||||
|
|
||||||
|
*** Inhibit startup screen
|
||||||
|
|
||||||
|
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 inhibit-startup-screen t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Font
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
*** 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
|
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
|
reach the far end of the window. However I prefer to have them
|
||||||
|
|
Loading…
Reference in a new issue