aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/init.el
blob: 5571d2d8547d8e6f7a1d7561c3d6b70ff528f342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
;;; init.el --- Tom-Emacs Interface                  -*- lexical-binding: t; -*-

;; Copyright (C) 2016  Tom Willemse

;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This is my personal Emacs configuration. The name was inspired by
;; "Ghost in the Shell 2: Man-Machine Interface" and Ryan Rix's
;; "Complete Computing Environment".

;;; Code:

;;;; Helper functions:

;; I have noticed that I refer to the combination of
;; `user-emacs-directory' and "data/" a lot, so I wrote this function
;; to make referencing it cleaner. Also useful if I ever want to move
;; my data directory.
(defun oni:data-location (file-name)
  "Return the location of FILE-NAME within my data directory.
This is currently the data directory under the
`user-emacs-directory'."
  (concat user-emacs-directory "data/" file-name))

(ert-deftest oni:data-location ()
  "Test that `oni:data-location' returns the correct locations."
  (should (string= "~/.emacs.d/data/backup-files/"
                   (oni:data-location "backup-files/")))
  (should (string= "~/.emacs.d/data/auto-save-files/"
                   (oni:data-location "auto-save-files/")))
  (should (string= "~/.emacs.d/data/auto-save-list/.saves-"
                   (oni:data-location "auto-save-list/.saves-"))))

;;;; Backups:

;; 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.
(setq backup-directory-alist `((".*" . ,(oni:data-location "backup-files/"))))

;;;; Auto saves:

;; 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.
(add-to-list 'auto-save-file-name-transforms
             `(".*" ,(oni:data-location "auto-save-files/") t) :append)

;; Place the files which contain the auto save files in a similar
;; directory.
(setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))

;;;; Don't use tabs: 
;; Generally I prefer using spaces over tabs. Especially for lisp-like
;; languages.
(setq-default indent-tabs-mode nil)

;;;; Font:

(defvar oni:preferred-font "Fantasque Sans Mono-15"
  "My personally preferred font.")

;; This sets the font for normal Emacs sessions. This will change the
;; font for all _existing_ frames, any future frames will not be
;; affected by this.
(set-frame-font oni:preferred-font nil t)

;; This sets the font for Emacs daemon-mode sessions. This changes the
;; font for all _future_ frames, but doesn't change anything for the
;; currently existing frames.
(add-to-list 'default-frame-alist `(font . ,oni:preferred-font))

;;;; Menu bar:

;; I don't use the menu bar, so it just takes up space.
(menu-bar-mode -1)

;;;; Tool bar:

;; I don't use the tool bar, so it just takes up space.
(tool-bar-mode -1)

;;;; 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.
(scroll-bar-mode -1)

(provide 'init)
;;; init.el ends here

;; Local Variables:
;; eval: (outline-minor-mode 1)
;; End: