-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsj-init.el
202 lines (167 loc) · 5.79 KB
/
sj-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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
;;; sj-init --- Main initialization file, called from ~/.emacs
;;
;; Copyright: Sudish Joseph <sudish@gmail.com>
;; Created: 1995-06-11
;; Track every loaded feature and the symbols they bring in
(require 'loadhist)
;; Common Lisp emulation
(require 'cl)
(defconst user-sj-p (string-match "^\\(sj\\|sudish\\|joseph\\)$"
(user-login-name))
"Non-nil iff the user is me.")
;; Custom
(setq custom-file "~/.custom")
(load custom-file)
;; Viper mode
(setq viper-mode t)
(require 'viper)
;; Load misc. functions we need later
(load "sj-funcs")
;; System-specific init
(cond ((eq system-type 'darwin)
(load "sj-system-darwin"))
((eq system-type 'gnu/linux)
(load "sj-system-linux")))
;; Enable usage of ssh-agent from sub-shells
(sj/copy-login-env-vars '("SSH_AUTH_SOCK" "SSH_AGENT_PID")
"source $HOME/.keychain/sudish-sh")
(let ((ssh-agent-socket (getenv "SSH_AUTH_SOCK")))
(unless (and (file-writable-p ssh-agent-socket)
(not (file-regular-p ssh-agent-socket)))
(error "Can't locate $SSH_AUTH_SOCK (%s)" ssh-agent-socket)))
;; Quo vadis?
(setq user-full-name "Sudish Joseph"
user-mail-address "sudish@gmail.com"
user-name-string (concat user-full-name " <" user-mail-address ">"))
;; Info search path
(setq Info-additional-directory-list
(delq nil
(mapcar (lambda (dir)
(cond ((file-directory-p dir) dir)
(t nil)))
'("/opt/local/share/info"
"/sw/share/info"
"/Developer/usr/share/info"
"/usr/share/info"
"/usr/info"))))
;; Take off some of the training wheels.
(when user-sj-p
(fset 'yes-or-no-p 'y-or-n-p)
(put 'eval-expression 'disabled nil))
(setq-default major-mode 'indented-text-mode)
(add-hook 'text-mode-hook
(defun sj/text-mode-hook ()
(auto-fill-mode t)
(setq adaptive-fill-mode t)))
;; Show the region
(transient-mark-mode t)
;; No tool bar, please
(tool-bar-mode -1)
;; Don't blink the cursor
(blink-cursor-mode -1)
;; Better display of long lines
;; (setq visual-line-fringe-indicators ; always display wrap indicators
;; (cdr (assq 'continuation fringe-indicator-alist)))
;; (global-visual-line-mode)
;; Tweak some of the defaults
(setq track-eol t
scroll-step 0
scroll-conservatively most-positive-fixnum
scroll-preserve-screen-position 'always
line-move-visual nil
next-screen-context-lines 2
confirm-kill-emacs 'y-or-n-p
inhibit-startup-screen t
initial-buffer-choice t
visible-bell t
column-number-mode t
require-final-newline t
signal-error-on-buffer-boundary nil
kill-whole-line t
mouse-yank-at-point t
blink-cursor-delay 1.0
backward-delete-char-untabify-method 'hungry
pp-escape-newlines nil
enable-recursive-minibuffers t
enable-local-eval 'ask
safe-local-variable-values '((sj/recompile-file . t)))
;; Don't want warnings about using funcs from cl.el
(setq byte-compile-warnings '(not cl-functions))
;; prefer splitting windows horizontally
(setq split-height-threshold 120)
;; help system
(setq help-window-select t
help-at-pt-display-when-idle '(keymap local-map button kbd-help
help-echo))
(help-at-pt-set-timer)
(setq query-replace-interactive nil
query-replace-show-replacement t
lazy-highlight-initial-delay 0)
(setq-default truncate-lines nil)
(setq next-line-add-newlines nil)
(setq-default indicate-empty-lines nil
indicate-buffer-boundaries '((top . left) (bottom . left)))
;; backups
(setq backup-by-copying nil
backup-by-copying-when-linked t
backup-by-copying-when-mismatch t
;; fixed directory for backups
backup-directory-alist `(("." . ,(concat user-emacs-directory
"backups/")))
;; versioned backups
delete-old-versions t
kept-new-versions 2
kept-old-versions 0
version-control nil)
;; auto-saves
(defconst sj/auto-save-directory (concat user-emacs-directory "auto-saves/"))
(make-directory sj/auto-save-directory t)
(setq auto-save-default t
auto-save-interval 300
;; fixed directory for auto-saves
auto-save-list-file-prefix (concat sj/auto-save-directory ".saves-")
auto-save-file-name-transforms `(,@auto-save-file-name-transforms
(".*" ,sj/auto-save-directory t)))
;; garbage collection settings
(setq gc-cons-threshold (max gc-cons-threshold (* 4 1024 1024)))
(make-face-bold 'mode-line)
;; Emacs package manager
(setq package-archives
'(("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("SC" . "http://joseito.republika.pl/sunrise-commander/")))
(package-initialize)
;; various packages
(load "sj-el-get")
(load "sj-keymaps")
(load "sj-modes")
(load "sj-langs")
(load "sj-anything")
(load "sj-mail")
(load "sj-bbdb")
(load "sj-peepopen")
;; gnuserv
(setenv "GNUSERV_SHOW_EMACS" "1") ; always raise Emacs window
(when (memq system-type '(darwin gnu/linux))
(server-start))
;; smex: IDO for interactive commands (an IDO-enabled M-x)
;; (sj/load-path-prepend "external/smex")
;; (require 'smex)
;; (setq smex-save-file (concat user-emacs-directory ".smex")
;; smex-history-length 15)
;; (smex-initialize)
;; (global-set-key (kbd "M-x") 'smex)
;; (global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
;; (global-set-key (kbd "C-c M-x") 'execute-extended-command)
;; filecache: caches names of files for use from minibuffer.
;; initialize the cache as the very last thing we do, once load-path is
;; fully initialized
(file-cache-add-directory-list load-path)
;; desktop mode restores buffers on startup
(desktop-save-mode 1)
;;; Local Variables:
;;; sj/recompile-file:t
;;; End: