Skip to content
Newer
Older
100644 136 lines (108 sloc) 5.19 KB
8c04091 @bbatsov moved back ack support to prelude's core
authored Apr 19, 2012
1 ;;; init.el --- Prelude's configuration entry point.
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
2 ;;
ebd6e9d @bbatsov Update the copyright years
authored Jan 31, 2016
3 ;; Copyright (c) 2011-2016 Bozhidar Batsov
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
4 ;;
8c04091 @bbatsov moved back ack support to prelude's core
authored Apr 19, 2012
5 ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
6 ;; URL: http://batsov.com/prelude
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
7 ;; Version: 1.0.0
8 ;; Keywords: convenience
9
10 ;; This file is not part of GNU Emacs.
11
12 ;;; Commentary:
13
14 ;; This file simply sets up the default load path and requires
15 ;; the various modules defined within Emacs Prelude.
16
17 ;;; License:
18
19 ;; This program is free software; you can redistribute it and/or
20 ;; modify it under the terms of the GNU General Public License
21 ;; as published by the Free Software Foundation; either version 3
22 ;; of the License, or (at your option) any later version.
23 ;;
24 ;; This program is distributed in the hope that it will be useful,
25 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;; GNU General Public License for more details.
28 ;;
29 ;; You should have received a copy of the GNU General Public License
30 ;; along with GNU Emacs; see the file COPYING. If not, write to the
31 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 ;; Boston, MA 02110-1301, USA.
33
34 ;;; Code:
6c1c6ff Fixed username (in windows-nt) in the final message after loading pre…
Shanmu Thiagaraja authored Aug 2, 2013
35 (defvar current-user
36 (getenv
37 (if (equal system-type 'windows-nt) "USERNAME" "USER")))
8c04091 @bbatsov moved back ack support to prelude's core
authored Apr 19, 2012
38
6c1c6ff Fixed username (in windows-nt) in the final message after loading pre…
Shanmu Thiagaraja authored Aug 2, 2013
39 (message "Prelude is powering up... Be patient, Master %s!" current-user)
b0552a8 @bbatsov refresh the package archive on every start
authored Dec 7, 2011
40
3fef152 @bbatsov [#956] Mention that Emacs 24.4 is required
authored Apr 28, 2016
41 (when (version< emacs-version "24.4")
42 (error "Prelude requires at least GNU Emacs 24.4, but you're running %s" emacs-version))
b1caa73 @bbatsov Add a basic version check
authored Sep 5, 2013
43
bdf1d12 @bbatsov Always load newest byte code
authored Apr 3, 2014
44 ;; Always load newest byte code
45 (setq load-prefer-newer t)
46
29ca3b9 @bbatsov made prelude-dir relative to the location of Prelude's init.el
authored Oct 11, 2011
47 (defvar prelude-dir (file-name-directory load-file-name)
48 "The root dir of the Emacs Prelude distribution.")
b01492e @bbatsov moved back the prelude modules into the main Prelude project
authored Dec 15, 2012
49 (defvar prelude-core-dir (expand-file-name "core" prelude-dir)
50 "The home of Prelude's core functionality.")
51 (defvar prelude-modules-dir (expand-file-name "modules" prelude-dir)
52 "This directory houses all of the built-in Prelude modules.")
bda7214 @bbatsov replaced a bunch of concats with expand-file-name
authored Oct 21, 2012
53 (defvar prelude-personal-dir (expand-file-name "personal" prelude-dir)
480170f @bbatsov Minor doc fixes
authored Mar 10, 2013
54 "This directory is for your personal configuration.
55
56 Users of Emacs Prelude are encouraged to keep their personal configuration
57 changes in this directory. All Emacs Lisp files there are loaded automatically
708a6cb @bbatsov better documentation, better init sequence
authored Oct 11, 2011
58 by Prelude.")
4ca22fb @bbatsov [Fix #451] Add the ability to preload personal code
authored Dec 6, 2013
59 (defvar prelude-personal-preload-dir (expand-file-name "preload" prelude-personal-dir)
60 "This directory is for your personal configuration, that you want loaded before Prelude.")
bda7214 @bbatsov replaced a bunch of concats with expand-file-name
authored Oct 21, 2012
61 (defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir)
480170f @bbatsov Minor doc fixes
authored Mar 10, 2013
62 "This directory houses packages that are not yet available in ELPA (or MELPA).")
bda7214 @bbatsov replaced a bunch of concats with expand-file-name
authored Oct 21, 2012
63 (defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir)
87b7e23 @fbs Added savefile dir and updated gitignore.
fbs authored Jun 15, 2012
64 "This folder stores all the automatically generated save/history-files.")
29dc436 @bbatsov Make the list of modules loaded by Prelude configurable.
authored Jan 13, 2013
65 (defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-dir)
66 "This files contains a list of modules that will be loaded by Prelude.")
6c876a6 @bbatsov fixed a couple of oversights
authored Oct 7, 2011
67
93c06fa @bbatsov create the savefile dir automatically if needed
authored Jul 3, 2012
68 (unless (file-exists-p prelude-savefile-dir)
69 (make-directory prelude-savefile-dir))
70
56d2ec3 @bbatsov fixed #242 - restored prelude-add-subfolders-to-load-path
authored Dec 17, 2012
71 (defun prelude-add-subfolders-to-load-path (parent-dir)
09635ea @bbatsov [Fix #378] Add folders recursively to the load-path in prelude-add-su…
authored Sep 2, 2013
72 "Add all level PARENT-DIR subdirs to the `load-path'."
56d2ec3 @bbatsov fixed #242 - restored prelude-add-subfolders-to-load-path
authored Dec 17, 2012
73 (dolist (f (directory-files parent-dir))
74 (let ((name (expand-file-name f parent-dir)))
75 (when (and (file-directory-p name)
4855e6e @dougm Filter all hidden directories when adding to load-path
dougm authored Apr 30, 2014
76 (not (string-prefix-p "." f)))
09635ea @bbatsov [Fix #378] Add folders recursively to the load-path in prelude-add-su…
authored Sep 2, 2013
77 (add-to-list 'load-path name)
78 (prelude-add-subfolders-to-load-path name)))))
56d2ec3 @bbatsov fixed #242 - restored prelude-add-subfolders-to-load-path
authored Dec 17, 2012
79
9e78011 minor change
Bozhidar Batsov authored Feb 14, 2012
80 ;; add Prelude's directories to Emacs's `load-path'
b01492e @bbatsov moved back the prelude modules into the main Prelude project
authored Dec 15, 2012
81 (add-to-list 'load-path prelude-core-dir)
708a6cb @bbatsov better documentation, better init sequence
authored Oct 11, 2011
82 (add-to-list 'load-path prelude-modules-dir)
b635a36 @bbatsov restored vendor and snippets dirs
authored Apr 18, 2012
83 (add-to-list 'load-path prelude-vendor-dir)
56d2ec3 @bbatsov fixed #242 - restored prelude-add-subfolders-to-load-path
authored Dec 17, 2012
84 (prelude-add-subfolders-to-load-path prelude-vendor-dir)
07e822f @bbatsov started to replace cl code with dash.el
authored Dec 15, 2012
85
f341074 @bbatsov Add flx to list of default packages
authored Jul 13, 2013
86 ;; reduce the frequency of garbage collection by making it happen on
87 ;; each 50MB of allocated data (the default is on every 0.76MB)
88 (setq gc-cons-threshold 50000000)
89
3473350 @bbatsov Set large-file-warning-threshold to 100MB (by default it was just 10)
authored May 14, 2014
90 ;; warn when opening files bigger than 100MB
91 (setq large-file-warning-threshold 100000000)
92
4ca22fb @bbatsov [Fix #451] Add the ability to preload personal code
authored Dec 6, 2013
93 ;; preload the personal settings from `prelude-personal-preload-dir'
94 (when (file-exists-p prelude-personal-preload-dir)
95 (message "Loading personal configuration files in %s..." prelude-personal-preload-dir)
96 (mapc 'load (directory-files prelude-personal-preload-dir 't "^[^#].*el$")))
97
98 (message "Loading Prelude's core...")
99
708a6cb @bbatsov better documentation, better init sequence
authored Oct 11, 2011
100 ;; the core stuff
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
101 (require 'prelude-packages)
28b9df0 @toctan Custom theme via prelude-theme variable
toctan authored Oct 11, 2014
102 (require 'prelude-custom) ;; Needs to be loaded before core, editor and ui
78b726d @bbatsov moved both zenburn and solarized to Marmalade
authored Dec 4, 2011
103 (require 'prelude-ui)
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
104 (require 'prelude-core)
605afde introduced prelude-mode
Bozhidar Batsov authored Feb 23, 2012
105 (require 'prelude-mode)
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
106 (require 'prelude-editor)
107 (require 'prelude-global-keybindings)
108
8c04091 @bbatsov moved back ack support to prelude's core
authored Apr 19, 2012
109 ;; OSX specific settings
23f3853 @bbatsov extracted non-essential modules to a separate project
authored Apr 17, 2012
110 (when (eq system-type 'darwin)
111 (require 'prelude-osx))
2bd9b15 fixed #63 - switched for full-ack to ack-and-a-half
Bozhidar Batsov authored Feb 15, 2012
112
4ca22fb @bbatsov [Fix #451] Add the ability to preload personal code
authored Dec 6, 2013
113 (message "Loading Prelude's modules...")
114
b01492e @bbatsov moved back the prelude modules into the main Prelude project
authored Dec 15, 2012
115 ;; the modules
00b4893 @bbatsov Warn if the modules file is missing
authored Jan 27, 2015
116 (if (file-exists-p prelude-modules-file)
117 (load prelude-modules-file)
118 (message "Missing modules file %s" prelude-modules-file)
119 (message "You can get started by copying the bundled example file"))
b01492e @bbatsov moved back the prelude modules into the main Prelude project
authored Dec 15, 2012
120
024cd52 don't load custom.el twice
Bozhidar Batsov authored Feb 15, 2012
121 ;; config changes made through the customize UI will be store here
bda7214 @bbatsov replaced a bunch of concats with expand-file-name
authored Oct 21, 2012
122 (setq custom-file (expand-file-name "custom.el" prelude-personal-dir))
024cd52 don't load custom.el twice
Bozhidar Batsov authored Feb 15, 2012
123
b3ffef2 @bbatsov added basic customizations allowing to toggle the modules of Prelude
authored Nov 24, 2011
124 ;; load the personal settings (this includes `custom-file')
257515a @hdhoang don't load custom.el twice
hdhoang authored Oct 16, 2011
125 (when (file-exists-p prelude-personal-dir)
5a14cdb @bbatsov Display a message when loading the personal config
authored Mar 12, 2013
126 (message "Loading personal configuration files in %s..." prelude-personal-dir)
26394bc @zickzackv Loads the files in the personal dir by absolute path. Loads really th…
zickzackv authored Apr 17, 2012
127 (mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$")))
708a6cb @bbatsov better documentation, better init sequence
authored Oct 11, 2011
128
6c1c6ff Fixed username (in windows-nt) in the final message after loading pre…
Shanmu Thiagaraja authored Aug 2, 2013
129 (message "Prelude is ready to do thy bidding, Master %s!" current-user)
b0552a8 @bbatsov refresh the package archive on every start
authored Dec 7, 2011
130
026dc56 @bbatsov show the tips after the init sequence has completed
authored May 16, 2012
131 (prelude-eval-after-init
132 ;; greet the use with some useful tip
133 (run-at-time 5 nil 'prelude-tip-of-the-day))
2d4ad18 @bbatsov added a basic tip of the day feature
authored May 7, 2012
134
301d057 @bbatsov some more groundwork
authored Oct 8, 2011
135 ;;; init.el ends here
Something went wrong with that request. Please try again.