summaryrefslogtreecommitdiff
path: root/.config/emacs/init.el
blob: 8423999e1c0a865cdc51586b5b325fb8d44473ce (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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
;; Preliminary settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(set-face-attribute 'default nil :height 80)
(setq notify-method 'notify-via-libnotify)
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(setq custom-file "~/.emacs.d/custom.el")

; derived from ELPA installation
; http://tromey.com/elpa/install.html
(defun eval-url (url)
  (let ((buffer (url-retrieve-synchronously url)))
  (save-excursion
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer)))))

 ;; ELPA stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(unless (require 'package nil t)
  (eval-url "http://tromey.com/elpa/package-install.el"))

(setq package-archives '(("ELPA" . "http://tromey.com/elpa/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("gnu" . "http://elpa.gnu.org/packages/")))

;; el-get stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq el-get-install-branch "master") ;; live life on the edge
(unless (require 'el-get nil t)
  (eval-url "https://github.com/dimitri/el-get/raw/master/el-get-install.el"))

(setq el-get-sources '(
      (:name nxhtml
             :type http
             :url "http://ourcomments.org/Emacs/DL/elisp/nxhtml/zip/nxhtml-2.08-100425.zip"
             :build ("unzip nxhtml-2.08-100425.zip")
             :load "nxhtml/autostart.el")
      ))

(setq my-el-get-packages
      '(el-get
;        nxhtml
        apel flim semi wanderlust
        smarttabs
        ))

;; Now load all of that ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ELPA
(package-initialize)
;; el-get
(when (require 'el-get nil t) (el-get 'sync my-el-get-packages))
;; custom
(load custom-file 'noerror)

;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'go-mode-load)

(require 'mailcrypt)
(mc-setversion "gpg")
(add-hook 'wl-summary-mode-hook 'mc-install-read-mode)
(add-hook 'wl-mail-setup-hook 'mc-install-write-mode)

(defun mc-wl-verify-signature ()
  (interactive)
  (save-window-excursion
    (wl-summary-jump-to-current-message)
    (mc-verify)))

(defun mc-wl-decrypt-message ()
  (interactive)
  (save-window-excursion
    (wl-summary-jump-to-current-message)
    (let ((inhibit-read-only t))
      (mc-decrypt))))

(eval-after-load "mailcrypt"
  '(setq mc-modes-alist
       (append
        (quote
         ((wl-draft-mode (encrypt . mc-encrypt-message)
            (sign . mc-sign-message))
          (wl-summary-mode (decrypt . mc-wl-decrypt-message)
            (verify . mc-wl-verify-signature))))
        mc-modes-alist)))

;(load "mdmua")
(load "emacsutils")

(tool-bar-mode -1)
(ido-mode t)
(show-paren-mode 1)
(setq org-hide-leading-stars t)
(setq org-log-done 'time)
(setq gamegrid-user-score-file-directory "/var/games/emacs/")
;(xclip-mode 1)

(load "whitespace")
(setq whitespace-style '(
  tab-mark
  space-mark
  newline-mark
  empty
))


;; These are my preferred settings; we let dtrt-indent detect when we play with other's files
(setq-default tab-width 8)
(setq-default c-basic-offset 8)
(setq-default indent-tabs-mode t)


(setq
 backup-by-copying	t ;; don't clobber symlinks
 backup-directory-alist	'(("." . "~/.emacs.d/saves")) ;; don't litter my fs tree
 delete-old-versions	t
 kept-new-versions	6
 kept-old-versions	2
 version-control	t ;; use versioned backups
)

(setq column-number-mode t
      inhibit-startup-screen t
      line-number-mode t
      server-use-tcp t
      server-mode t
      show-paren-mode t)

(setq browse-url-generic-program (executable-find "v-www-browser")
      browse-url-browser-function 'browse-url-generic)


(defun toggle-fullscreen (&optional f)
  (interactive)
  (let ((current-value (frame-parameter nil 'fullscreen)))
    (set-frame-parameter nil 'fullscreen
                         (if (equal 'fullboth current-value)
                             (if (boundp 'old-fullscreen) old-fullscreen nil)
                           (progn (setq old-fullscreen current-value)
                                  'fullboth)))))

;; Custom keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(global-set-key [f11] 'toggle-fullscreen)
(global-set-key "\C-cw" 'global-whitespace-mode)

;; mode-hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-hook 'text-mode-hook 'turn-on-auto-fill)

; for term-mode
;; (add-hook 'after-make-frame-functions
;;           (lambda (frame)
;;             (set-variable 'term-default-fg-color
;;                           (face-foreground 'default))
;;             (set-variable 'term-default-bg-color
;;                           (face-background 'default)))
;;           t)

(add-hook 'lisp-mode-hook
          '(lambda ()
             (set (make-local-variable 'indent-tabs-mode) nil)
             ))

(add-hook 'emacs-lisp-mode-hook
          '(lambda ()
             (set (make-local-variable 'indent-tabs-mode) nil)
             ))

(add-hook 'coffee-mode-hook
          '(lambda ()
             (set (make-local-variable 'tab-width) 2)
             ))

(add-hook 'term-mode-hook
          '(lambda ()
             (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *")
             (make-local-variable 'mouse-yank-at-point)
             ;(make-local-variable 'transient-mark-mode)
             (setq mouse-yank-at-point t)
             ;(setq transient-mark-mode nil)
             (auto-fill-mode -1)
             (setq tab-width 8 )
             (setq autopair-dont-activate t) ;; Don't let autopair break ansi-term
             ))

(add-hook 'ruby-mode-hook
          '(lambda ()
             (set (make-local-variable 'indent-tabs-mode) t)
             (set (make-local-variable 'ruby-indent-level) 4)
             (set (make-local-variable 'tab-width) 4)
             ))

(add-hook 'coffee-mode-hook
          '(lambda ()
             (set (make-local-variable 'indent-tabs-mode) nil)
             ))

(add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode))
(add-to-list 'auto-mode-alist '("SRCBUILD" . sh-mode))

;(require 'flymake)
;(add-hook 'php-mode-hook (lambda() (flymake-mode 1)))
;(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error)
;(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error)

;(setq tramp-debug-buffer t) 
;(setq tramp-verbose 10)

(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'mu4e-speedbar)

(setq
 mu4e-maildir       "~/Maildir"   ;; top-level Maildir
 mu4e-sent-folder   "/.Sent"       ;; folder for sent messages
 mu4e-drafts-folder "/.Draft"     ;; unfinished messages
 mu4e-trash-folder  "/.Trash"      ;; trashed messages
 mu4e-refile-folder "/archive")   ;; saved messages
(setq mu4e-get-mail-command "offlineimap")
(setq mu4e-use-fancy-chars "t")
;; enable inline images
(setq mu4e-view-show-images t)
;; use imagemagick, if available
(when (fboundp 'imagemagick-register-types)
  (imagemagick-register-types))