forked from bodil/ohai-emacs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.el
81 lines (62 loc) · 2.9 KB
/
init.el
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
;;; -*- lexical-binding: t -*-
;;; init.el --- This is where all emacs start.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <[email protected]>
;; 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/>.
;;; Code:
;; Do an Emacs version check before going any further.
(when (or (< emacs-major-version 24)
(and (= emacs-major-version 24) (< emacs-minor-version 4)))
(x-popup-dialog
t `(,(format "Sorry, you need GNU Emacs version 24.4 or higher
to run Ohai Emacs.
Your installed Emacs reports:
%s" (emacs-version))
("OK :(" . t)))
(save-buffers-kill-emacs t))
;; We start off by telling Emacs where we intend to keep things, and some
;; other basic system setup.
;; Skip the default splash screen.
(setq inhibit-startup-message t)
;; Figure out the current hostname.
(setq hostname (replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" (with-output-to-string (call-process "hostname" nil standard-output))))
;; Figure out the path to our .emacs.d by getting the path part of the
;; current file (`init.el`).
(setq dotfiles-dir (file-name-directory
(or (buffer-file-name) (file-chase-links load-file-name))))
;; We need to tell Emacs where to find Ohai Emacs's library packages.
(add-to-list 'load-path (concat dotfiles-dir "ohai"))
;; We'll keep the various parts of our configuration in the `modules` subfolder
;; of our .emacs.d. We'll need to add that to the system load path so Emacs can
;; find our modules when we ask for them.
(add-to-list 'load-path (concat dotfiles-dir "modules"))
;; Define where we want to keep `loaddefs.el` (our autoload declarations) and
;; `custom.el` (our user settings file).
(setq autoload-file (concat dotfiles-dir "loaddefs.el"))
(setq custom-file (concat dotfiles-dir "custom.el"))
;; Load the user settings from `custom.el`.
(load custom-file 'noerror)
;; Load the Ohai Emacs fundamentals.
(require 'ohai-lib)
(require 'ohai-package)
(require 'ohai-module-index)
(require 'ohai-module-selector)
(require 'ohai-update)
(require 'ohai-personal-taste)
(require 'ohai-startup-wizard)
(require 'ohai-set-path)
;; Load the enabled modules.
(when (not (boundp 'ohai/wizard-did-run)) (ohai/load-modules))
;; Load the user's config, if it exists.
(load (concat dotfiles-dir "user.el") 'noerror)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)