Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 899 lines (715 sloc) 28.663 kb
a761f38 @ignacy Fixed OS depenedet issues
authored
1 (message "Ok. let's do some configuring..")
2 (require 'cl)
669b696 Basics
Ignacy Moryc authored
3
a761f38 @ignacy Fixed OS depenedet issues
authored
4 ;; By setting any of the below to nil
5 ;; you are dissabling the whole section
6 (defvar set-directories t)
7 (defvar set-loadpaths t)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
8 (defvar set-line-highlighting t)
a761f38 @ignacy Fixed OS depenedet issues
authored
9 (defvar set-environment-settings t)
529ba97 @ignacy New color themes
authored
10 (defvar set-java-paths-on-windows t)
ac62bf9 @ignacy Cygwin config
authored
11 (defvar set-working-on-bdj t)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
12 (defvar set-use-key-chords nil)
13 (defvar set-indent-before-saving t)
14 (defvar set-remove-blinking-from-cursos t)
15 (defvar set-use-color-theme nil)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
16
a761f38 @ignacy Fixed OS depenedet issues
authored
17 ;; Helper variables to recognize the environment
18 (defvar on-windows
19 (eq system-type 'windows-nt))
20
21
22 (when set-directories (message "Setting directories..")
23 (if on-windows
24 (progn
25 (message "Running windows.. using AppData/Roaming")
dff064f @ignacy Fixed windows behaviour
authored
26 (setq dotfiles-dir "C:/Users/Ignacy/AppData/Roaming/.emacs.d"))
a761f38 @ignacy Fixed OS depenedet issues
authored
27 (message "We're not on windows..")
28 (setq dotfiles-dir "~/.emacs.d"))
29 (setq imoryc-dir (concat dotfiles-dir "/imoryc"))
30 (add-to-list 'load-path imoryc-dir))
31
32 (when set-loadpaths (message "Setting load paths for libraries")
33 (add-to-list 'load-path (concat dotfiles-dir "/emacs-rails-reloaded"))
34 (require 'rails-autoload)
35
36 (load-file (concat imoryc-dir "/ruby-setup.el"))
37 (load-file (concat imoryc-dir "/rake-setup.el"))
38 (load-file (concat imoryc-dir "/project-top.el"))
39 (load-file (concat imoryc-dir "/testing.el"))
40 (add-to-list 'load-path (concat dotfiles-dir "/magit-0.8.2"))
41 (require 'magit)
42 (add-to-list 'load-path "~/.emacs.d/android-mode")
43 (require 'android-mode))
44
c9b3d0c @ignacy Fixed some annoyances on windows
authored
45 ;; require can begin here
46 (require 'anything-config)
47 (require 'anything-etags+)
48
b456274 @ignacy TAGS file support
authored
49 ;; ;;(global-set-key (kbd "M-a") 'anything)
c9b3d0c @ignacy Fixed some annoyances on windows
authored
50 (global-set-key "\M-." 'anything-etags+-select-one-key)
51
52
1be2f6a @ignacy Added back some forgotten helpers
authored
53 (defmacro bind (key fn)
54 "shortcut for global-set-key"
55 `(global-set-key (kbd ,key)
56 ;; handle unquoted function names and lambdas
57 ,(if (listp fn)
58 fn
59 `',fn)))
c9b3d0c @ignacy Fixed some annoyances on windows
authored
60
a761f38 @ignacy Fixed OS depenedet issues
authored
61
62 (when set-environment-settings (message "Setting environment settings")
63 (setq inhibit-startup-message t))
64
65 (when set-line-highlighting (message "Switching line highlighting on")
66 (global-hl-line-mode 1)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
67 (set-face-background 'hl-line "#333")
68 ;;(set-face-background 'hl-line "#eee")
a761f38 @ignacy Fixed OS depenedet issues
authored
69 (set-face-foreground 'highlight nil)
70 (set-face-foreground 'hl-line nil))
71
529ba97 @ignacy New color themes
authored
72 (when set-java-paths-on-windows (message "Setting java paths")
73 (when on-windows
74 (setenv "JUNIT_HOME" "/home/ignacy/code/classpath")
75 (setenv "JAVA_HOME" "c://jdk1.6.0_23")
76 (setenv "CLASSPATH" "$CLASSPATH:$JUNIT_HOME:/home/ignacy/code/classpath:/home/ignacy/code/FyreTv/lib/test/testng-5.14.7.jar")))
77
78 (unless on-windows (message "Setting androidn on linux")
79 (defcustom android-mode-sdk-dir "~/android"
80 "Set to the directory containing the Android SDK."
81 :type 'string
82 :group 'android-mode))
83
84 (when on-windows (message "Setting android for windows")
85 (defcustom android-mode-sdk-dir "c:/Android/android-sdk/"
86 "Set to the directory containing the Android SDK."
87 :type 'string
88 :group 'android-mode))
319d0c1 @ignacy moveing to magit for git interactions
authored
89
60e564e @ignacy Local changes
authored
90
a761f38 @ignacy Fixed OS depenedet issues
authored
91 (defcustom android-mode-avd "@htc"
92 "Default AVD to use."
93 :type 'string
94 :group 'android-mode)
72bf1d9 @ignacy Remove elc files
authored
95
60e564e @ignacy Local changes
authored
96
529ba97 @ignacy New color themes
authored
97
98 (unless on-windows
99 (defun ant-compile ()
100 "Traveling up the path, find build.xml file and run compile."
101 (interactive)
102 (with-temp-buffer
103 (while (and (not (file-exists-p "build.xml"))
104 (not (equal "/" default-directory)))
105 (cd ".."))
106 (call-interactively 'compile))))
107
108 (when set-working-on-bdj
109 (defvar bdj-root "C://Users//Ignacy//code//FyreTv")
110 (defun im/ant (task)
111 "Run ant TASK in the project root directory."
112 (interactive "sTask name: ")
113 (cd bdj-root)
114 (compile (concat "ant " task)))
115 (global-set-key [f5] 'im/ant))
60e564e @ignacy Local changes
authored
116
5b26a37 @ignacy changed theme
authored
117
e8a7544 Chord mode for emacs 'uu' and 'dd' aded as key-chords
U-Ignacy-Komputer\Ignacy authored
118 (when set-use-key-chords
119 (require 'key-chord)
120 (key-chord-mode 1)
121 (key-chord-define-global "uu" 'undo)
122 (key-chord-define-global "dd" 'kill-line)
123 )
124
125
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
126 (when set-indent-before-saving
127 (add-hook 'before-save-hook 'iwb)
128 )
129
130 (when set-remove-blinking-from-cursos
131 (and (fboundp 'blink-cursor-mode) (blink-cursor-mode (- (*) (*) (*))))
132 )
133
134
34f777d @ignacy New pop and push mark commands
authored
135 (require 'epa)
136 (epa-file-enable)
5b26a37 @ignacy changed theme
authored
137 (require 'git-blame)
f726071 @ignacy haml mode
authored
138 (require 'haml-mode)
3724861 @ignacy Lots of changes
authored
139 (require 'rvm)
74ae0fb @ignacy Work settings>
authored
140
7e8334a @ignacy Nedw way to run the tests
authored
141 (global-set-key (kbd "C-x f") 'ido-find-file)
142 (global-set-key (kbd "C-q") 'jw-run-test-or-spec-file)
1e837ad @ignacy Added F2 as magit status
authored
143
144 (global-set-key (kbd "C-x C-b") 'ido-switch-buffer)
145 (global-set-key (kbd "C-x b") 'list-buffers)
146
147
148
60e564e @ignacy Local changes
authored
149 ;; Window manipulation
150 (global-set-key [(control prior)] 'enlarge-window)
151 (global-set-key [(control next)] 'shrink-window)
152 (windmove-default-keybindings 'meta)
153
1be2f6a @ignacy Added back some forgotten helpers
authored
154 ;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
155 (defun renamefile (new-name)
156 "Renames both current buffer and file it's visiting to NEW-NAME."
157 (interactive (list (completing-read "New name: " nil nil nil (buffer-name))))
158 (let ((name (buffer-name))
159 (filename (buffer-file-name)))
160 (if (not filename)
161 (message "Buffer '%s' is not visiting a file!" name)
162 (if (get-buffer new-name)
163 (message "A buffer named '%s' already exists!" new-name)
164 (progn
165 (rename-file name new-name 1)
166 (rename-buffer new-name)
167 (set-visited-file-name new-name)
168 (set-buffer-modified-p nil))))))
169
170
60e564e @ignacy Local changes
authored
171
172 ;; Make the whole buffer pretty and consistent
173 (defun iwb()
174 "Indent Whole Buffer"
175 (interactive)
176 (delete-trailing-whitespace)
177 (indent-region (point-min) (point-max) nil)
178 (untabify (point-min) (point-max)))
179
6f1845d @ignacy mmhmhmhm
authored
180 (global-set-key (kbd "C-x i") 'iwb)
60e564e @ignacy Local changes
authored
181
182
183 (add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
184
36216c2 @ignacy changes
authored
185 (global-set-key (kbd "C-x C-p") 'find-file-at-point)
186 (defadvice find-file-at-point (around goto-line compile activate)
187 (let ((line (and (looking-at ".*:\\([0-9]+\\)")
188 (string-to-number (match-string 1)))))
189 ad-do-it
190 (and line (goto-line line))))
191
8324826 @ignacy Few new things
authored
192 (setq next-line-add-newlines t)
c9b3d0c @ignacy Fixed some annoyances on windows
authored
193
74ae0fb @ignacy Work settings>
authored
194
497503e @ignacy Oguras mode
authored
195 (add-to-list 'load-path (concat dotfiles-dir "/feature-mode"))
196 (require 'feature-mode)
197 (add-to-list 'auto-mode-alist '("\.feature$" . feature-mode))
198
3724861 @ignacy Lots of changes
authored
199 (setq-default fill-column 100)
5b63859 @ignacy New mode, small changes
authored
200
72bf1d9 @ignacy Remove elc files
authored
201 ;; (setq ditaa-cmd "java -jar /home/ignacy/bin/ditaa0_9.jar")
202 ;; (defun djcb-ditaa-generate ()
203 ;; (interactive)
204 ;; (shell-command
205 ;; (concat ditaa-cmd " " buffer-file-name)))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
206
b456274 @ignacy TAGS file support
authored
207 ;; (setq path-to-ctags "/usr/local/bin/ctags")
208 ;; (defun create-tags (dir-name)
209 ;; "Create tags file."
210 ;; (interactive "DDirectory: ")
211 ;; (shell-command
212 ;; (format "%s -f %s/TAGS -e -R %s" path-to-ctags dir-name (directory-file-name dir-name)))
213 ;; )
214
096eb58 @ignacy merged
authored
215 (defun create-tags (dir-name)
216 "Create tags file."
217 (interactive "DDirectory: ")
218 (eshell-command
219 (format "find %s -type f -name \"*.[ch]\" | etags -L -" dir-name)))
b456274 @ignacy TAGS file support
authored
220
221
da3f247 @ignacy some changes
authored
222 (scroll-bar-mode -1)
6e6491b @ignacy Rdebug
authored
223 (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
224 (transient-mark-mode 1) ;; No region when it is not highlighted
225 (setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
226 (delete-selection-mode t)
8324826 @ignacy Few new things
authored
227 (subword-mode t)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
228 (set-default 'cursor-type 'bar)
229 (set-cursor-color "yellow")
230
8324826 @ignacy Few new things
authored
231
1e837ad @ignacy Added F2 as magit status
authored
232
8324826 @ignacy Few new things
authored
233 (defvar smart-use-extended-syntax nil
234 "If t the smart symbol functionality will consider extended
235 syntax in finding matches, if such matches exist.")
236
237 (defvar smart-last-symbol-name ""
238 "Contains the current symbol name.
239
240 This is only refreshed when `last-command' does not contain
241 either `smart-symbol-go-forward' or `smart-symbol-go-backward'")
242
243 (make-local-variable 'smart-use-extended-syntax)
244
245 (defvar smart-symbol-old-pt nil
246 "Contains the location of the old point")
247
248 (defun smart-symbol-goto (name direction)
249 "Jumps to the next NAME in DIRECTION in the current buffer.
250
251 DIRECTION must be either `forward' or `backward'; no other option
252 is valid."
253
254 ;; if `last-command' did not contain
255 ;; `smart-symbol-go-forward/backward' then we assume it's a
256 ;; brand-new command and we re-set the search term.
257 (unless (memq last-command '(smart-symbol-go-forward
258 smart-symbol-go-backward))
259 (setq smart-last-symbol-name name))
260 (setq smart-symbol-old-pt (point))
261 (message (format "%s scan for symbol \"%s\""
262 (capitalize (symbol-name direction))
263 smart-last-symbol-name))
264 (unless (catch 'done
265 (while (funcall (cond
266 ((eq direction 'forward) ; forward
267 'search-forward)
268 ((eq direction 'backward) ; backward
269 'search-backward)
270 (t (error "Invalid direction"))) ; all others
271 smart-last-symbol-name nil t)
272 (unless (memq (syntax-ppss-context
273 (syntax-ppss (point))) '(string comment))
274 (throw 'done t))))
275 (goto-char smart-symbol-old-pt)))
276
277 (defun smart-symbol-go-forward ()
278 "Jumps forward to the next symbol at point"
279 (interactive)
280 (smart-symbol-goto (smart-symbol-at-pt 'end) 'forward))
281
282 (defun smart-symbol-go-backward ()
283 "Jumps backward to the previous symbol at point"
284 (interactive)
285 (smart-symbol-goto (smart-symbol-at-pt 'beginning) 'backward))
286
287 (defun smart-symbol-at-pt (&optional dir)
288 "Returns the symbol at point and moves point to DIR (either `beginning' or `end') of the symbol.
289
290 If `smart-use-extended-syntax' is t then that symbol is returned
291 instead."
292 (with-syntax-table (make-syntax-table)
293 (if smart-use-extended-syntax
294 (modify-syntax-entry ?. "w"))
295 (modify-syntax-entry ?_ "w")
296 (modify-syntax-entry ?- "w")
297 ;; grab the word and return it
298 (let ((word (thing-at-point 'word))
299 (bounds (bounds-of-thing-at-point 'word)))
300 (if word
301 (progn
302 (cond
303 ((eq dir 'beginning) (goto-char (car bounds)))
304 ((eq dir 'end) (goto-char (cdr bounds)))
305 (t (error "Invalid direction")))
306 word)
307 (error "No symbol found")))))
308
c9b3d0c @ignacy Fixed some annoyances on windows
authored
309
8324826 @ignacy Few new things
authored
310 (global-set-key (kbd "M-n") 'smart-symbol-go-forward)
311 (global-set-key (kbd "M-p") 'smart-symbol-go-backward)
312
529ba97 @ignacy New color themes
authored
313
314 ;; (defun im/occur-current
315 ;; "Runs occur on current word under the coursor"
316 ;; (let (word (thing-at-point 'word))
317 ;; (occcur word)))
318
319 ;; (global-set-key (kbd "C-o") 'im/occur-current)
320
321
8324826 @ignacy Few new things
authored
322 ;; '(setq visible-bell t)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
323 (show-paren-mode 1)
0fe7db8 Further changes
Ignacy Moryc authored
324 (fset 'yes-or-no-p 'y-or-n-p)
669b696 Basics
Ignacy Moryc authored
325 (tool-bar-mode -1)
326 (menu-bar-mode -1)
327 (ido-mode t)
0fe7db8 Further changes
Ignacy Moryc authored
328 (setq ido-create-new-buffer 'always)
669b696 Basics
Ignacy Moryc authored
329 (setq backup-inhibited t)
00e679c @ignacy Changed settings to clean things up a bit
authored
330
0fe7db8 Further changes
Ignacy Moryc authored
331 (global-linum-mode 1)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
332 (setq linum-format " %3d ")
9b0e71f @ignacy changes
authored
333
00e679c @ignacy Changed settings to clean things up a bit
authored
334 ;; insert current buffer name into minibuffer
9b0e71f @ignacy changes
authored
335 (define-key minibuffer-local-map [f3]
336 (lambda () (interactive)
60e564e @ignacy Local changes
authored
337 (insert (buffer-name (window-buffer (minibuffer-selected-window))))))
9b0e71f @ignacy changes
authored
338
da3f247 @ignacy some changes
authored
339 (global-set-key [(control backspace)] 'backward-kill-word)
340 (global-set-key [(meta delete)] 'backward-kill-word)
669b696 Basics
Ignacy Moryc authored
341
da3f247 @ignacy some changes
authored
342 (setq x-select-enable-clipboard t)
3724861 @ignacy Lots of changes
authored
343 (global-set-key [(control v)] 'clipboard-yank)
344 (global-set-key (kbd "C-x C-x") 'clipboard-kill-region)
345
346 (defvar compile-command "rake ") ; set the default make command
347 (make-variable-buffer-local 'compile-command)
60e564e @ignacy Local changes
authored
348 ; make the compile command buffer local
349 ; (this allows each buffer to have its
350 ; own custom compile command)
3724861 @ignacy Lots of changes
authored
351
0fe7db8 Further changes
Ignacy Moryc authored
352 (setq-default indent-tabs-mode nil)
353 (setq indent-tabs-mode nil)
00e679c @ignacy Changed settings to clean things up a bit
authored
354 (setq tab-width 4)
0fe7db8 Further changes
Ignacy Moryc authored
355 (setq default-indicate-empty-lines t)
356
357
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
358 (load-file (concat imoryc-dir "/markdown-mode.el"))
359 (autoload 'markdown-mode "markdown-mode.el"
60e564e @ignacy Local changes
authored
360 "Major mode for editing Markdown files" t)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
361 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
362 (cons '("\\.md" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
363 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
364 (cons '("\\.text" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
365 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
366 (cons '("\\.markdown" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
367
368
0fe7db8 Further changes
Ignacy Moryc authored
369 (defun stop-using-minibuffer ()
370 "kill the minibuffer"
371 (when (and (>= (recursion-depth) 1) (active-minibuffer-window))
372 (abort-recursive-edit)))
373 (add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)
374
375 ;; IBUFFER Settings
376 (defalias 'list-buffers 'ibuffer)
377 (setq ibuffer-show-empty-filter-groups nil)
378 (setq ibuffer-always-show-last-buffer nil)
379 (setq ibuffer-sorting-mode 'recency)
f6eaf6f @ignacy chasnged
authored
380 (setq ibuffer-formats '((mark modified read-only " "
60e564e @ignacy Local changes
authored
381 (name 30 30 :left :elide)
382 " " filename-and-process)))
f6eaf6f @ignacy chasnged
authored
383
0fe7db8 Further changes
Ignacy Moryc authored
384 (setq ibuffer-use-header-line t)
f6eaf6f @ignacy chasnged
authored
385 (require 'ibuf-ext)
386 (add-to-list 'ibuffer-never-show-predicates "^\\*")
0fe7db8 Further changes
Ignacy Moryc authored
387 (setq ibuffer-saved-filter-groups
388 (quote (("default"
389 ("TERMINAL" (name . "^\\*terminal\\*$"))
f6eaf6f @ignacy chasnged
authored
390 ("middleware" (filename . "/code/middleware/"))
391 ("fyre" (filename . "/code/webapp/"))
0fe7db8 Further changes
Ignacy Moryc authored
392 ("ruby" (mode . ruby-mode))
393 ("javascript" (name . "\\.js.erb$\\|.js$"))
f6eaf6f @ignacy chasnged
authored
394 ("ogórki" (name . "\\.feature\$"))
395 ("dired" (mode . dired-mode))
396 ("Org" (mode . org-mode))
0fe7db8 Further changes
Ignacy Moryc authored
397 ("haml" (mode . haml-mode))
f6eaf6f @ignacy chasnged
authored
398 ("elisp" (name . "\\.el\$"))))))
0fe7db8 Further changes
Ignacy Moryc authored
399
400 (add-hook 'ibuffer-mode-hook
401 (lambda ()
402 (ibuffer-switch-to-saved-filter-groups "default")))
3724861 @ignacy Lots of changes
authored
403
0fe7db8 Further changes
Ignacy Moryc authored
404 (defadvice ibuffer-update-title-and-summary (after remove-column-titles)
405 (save-excursion
406 (set-buffer "*Ibuffer*")
407 (toggle-read-only 0)
408 (goto-char 1)
409 (search-forward "-\n" nil t)
410 (delete-region 1 (point))
411 (let ((window-min-height 1))
412 ;; save a little screen estate
413 (shrink-window-if-larger-than-buffer))
414 (toggle-read-only)))
415
416
417 (global-unset-key [?\C-x ?\C-z])
c9b3d0c @ignacy Fixed some annoyances on windows
authored
418 (global-set-key [f1] 'help)
0fe7db8 Further changes
Ignacy Moryc authored
419 (global-set-key (kbd "C-z") 'undo)
3724861 @ignacy Lots of changes
authored
420
72bf1d9 @ignacy Remove elc files
authored
421 ;; (global-hl-line-mode 1)
422 ;;(set-face-background 'hl-line "gray8")
0fe7db8 Further changes
Ignacy Moryc authored
423 ;;BOOKMARKS
424 (define-key global-map [f9] 'bookmark-jump)
425 (define-key global-map [f10] 'bookmark-set)
426 (define-key global-map (kbd "C-+") 'text-scale-increase)
427 (define-key global-map (kbd "C--") 'text-scale-decrease)
3bf4d3f @ignacy Work changes
authored
428 (global-set-key "\C-s" 'isearch-forward-regexp)
429 (global-set-key "\C-r" 'isearch-backward-regexp)
0fe7db8 Further changes
Ignacy Moryc authored
430 (global-set-key (kbd "M-/") 'hippie-expand)
431 (global-set-key (kbd "M-,") 'comment-or-uncomment-region)
432 (global-set-key (kbd "M-l") 'highlight-lines-matching-regexp)
433 (global-set-key (kbd "M-o") 'occur)
6f1845d @ignacy mmhmhmhm
authored
434 (global-set-key [(meta g)] 'beginning-of-buffer)
0fe7db8 Further changes
Ignacy Moryc authored
435 (global-set-key "\C-a" 'beginning-of-line-text)
436 (defun my-ibuffer ()
60e564e @ignacy Local changes
authored
437 "Open ibuffer with cursour pointed to most recent buffer name"
438 (interactive)
439 (let ((recent-buffer-name (buffer-name)))
440 (ibuffer)
441 (ibuffer-jump-to-buffer recent-buffer-name)))
31af1db @ignacy :-/
authored
442 ;; (global-set-key [(f12)] 'my-ibuffer)
0fe7db8 Further changes
Ignacy Moryc authored
443 (global-set-key [f11] 'switch-full-screen)
444
445
446 (defun duplicate-line ()
447 "*Insert a copy of the current line below the current line."
448 (interactive)
449 (save-excursion
450 (let ((start (progn (beginning-of-line) (point)))
451 (end (progn (end-of-line) (point))))
452 (insert ?\n)
453 (insert-buffer-substring (current-buffer) start end))))
454
455 (global-set-key (kbd "C-c d") 'duplicate-line)
456
3724861 @ignacy Lots of changes
authored
457 (defun copy-line()
458 (interactive)
459 (move-beginning-of-line 1)
460 (kill-line)
461 (yank)
462 (next-line 1)
60e564e @ignacy Local changes
authored
463 )
e0aab08 @ignacy Updated
authored
464 (global-set-key (kbd "C-l") 'copy-line)
3724861 @ignacy Lots of changes
authored
465
01089f5 New submodule
Ignacy Moryc authored
466 ;; install wmctrl (sudo apt-get install wmctrl)
467 (defun switch-full-screen ()
468 "Switch emacs to full screen mode"
469 (interactive)
470 (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
e871475 Auto complete
Ignacy Moryc authored
471
472 ;;yassnippet
473 (add-to-list 'load-path (concat dotfiles-dir "/yasnippet-0.6.1c"))
474 (require 'yasnippet) ;; not yasnippet-bundle
475 (yas/initialize)
476 (yas/load-directory (concat dotfiles-dir "/yasnippet-0.6.1c/snippets"))
51ae665 @ignacy Some small changes. Moved yasnippet back to TAB
authored
477 (setq yas/trigger-key "TAB")
e871475 Auto complete
Ignacy Moryc authored
478
ac62bf9 @ignacy Cygwin config
authored
479
480 (setq org-mode-source-directory-path (concat dotfiles-dir "/org-mode/lisp"))
481 (setq load-path (cons org-mode-source-directory-path load-path))
482
e871475 Auto complete
Ignacy Moryc authored
483 (require 'org-install)
ac62bf9 @ignacy Cygwin config
authored
484
e871475 Auto complete
Ignacy Moryc authored
485 ;; The following lines are always needed. Choose your own keys.
486 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
487 (global-set-key "\C-cl" 'org-store-link)
488 (global-set-key "\C-ca" 'org-agenda)
489 (global-set-key "\C-cb" 'org-iswitchb)
490 (global-font-lock-mode 1) ; for all buffers
02e6366 @ignacy Emacs 24 new stuff
authored
491
e871475 Auto complete
Ignacy Moryc authored
492 (transient-mark-mode 1)
02e6366 @ignacy Emacs 24 new stuff
authored
493
cc7d737 @ignacy fixed small annoyances
authored
494 (if on-windows
495 (setq org-directory "C:/Users/Ignacy/Dropbox/org")
496 (setq org-directory "~/Dropbox/org"))
497
498 (setq org-default-notes-file (concat org-directory "/notes.org"))
499 (setq org-agenda-files (list (concat org-directory "/notes.org")))
500
501 (defun im/find-note (note)
502 "Find note in org mode notes file"
503 (interactive "sWpisz szukane slowo: ")
504 (find-file org-default-notes-file)
505 (re-search-forward note)
506 (point))
507
02e6366 @ignacy Emacs 24 new stuff
authored
508 (define-key global-map "\C-cc" 'org-capture)
f6eaf6f @ignacy chasnged
authored
509
e871475 Auto complete
Ignacy Moryc authored
510 (add-hook 'org-mode-hook
511 (lambda ()
512 (org-set-local 'yas/trigger-key [tab])
513 (define-key yas/keymap [tab] 'yas/next-field-group)))
514
515
2c7d19a @ignacy New switch tab
authored
516 (setq
60e564e @ignacy Local changes
authored
517 bookmark-default-file "~/.emacs.d/bookmarks" ;; keep my ~/ clean
518 bookmark-save-flag 1) ;; autosave each change)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
519
520 (define-key global-map [f9] 'bookmark-jump)
521 (define-key global-map [f10] 'bookmark-set)
522
523
e871475 Auto complete
Ignacy Moryc authored
524 ;;AUTOCOMPLETE
525 (add-to-list 'load-path (concat dotfiles-dir "/auto-complete-1.3"))
526 (require 'auto-complete-config)
527 (ac-config-default)
528
529 ;; dirty fix for having AC everywhere
530 (define-globalized-minor-mode real-global-auto-complete-mode
531 auto-complete-mode (lambda ()
532 (if (not (minibufferp (current-buffer)))
533 (auto-complete-mode 1))
534 ))
535 (real-global-auto-complete-mode t)
dff064f @ignacy Fixed windows behaviour
authored
536
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
537
dff064f @ignacy Fixed windows behaviour
authored
538 (unless on-windows
539 (setq rsense-home "/home/ignacy/bin/rsense-0.3")
540 (add-to-list 'load-path (concat rsense-home "/etc"))
541 (require 'rsense))
5b63859 @ignacy New mode, small changes
authored
542
543 (define-key isearch-mode-map (kbd "C-o")
544 (lambda ()
545 (interactive)
546 (let ((case-fold-search isearch-case-fold-search))
547 (occur (if isearch-regexp isearch-string
548 (regexp-quote isearch-string))))))
549
550
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
551 (when set-use-color-theme
552 (add-to-list 'load-path (concat dotfiles-dir "/color-theme-6.6.0"))
553 (load-file (concat imoryc-dir "/colors/color-theme-wombat.el"))
dbc4a03 @ignacy New awesome config
authored
554
e0aab08 @ignacy Updated
authored
555
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
556 (require 'color-theme)
557 (eval-after-load "color-theme"
558 '(progn
559 (color-theme-initialize)
560 (color-theme-wombat)))
7c19798 @ignacy Megred
authored
561
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
562 ;;(setq font-use-system-font t)
563 (setq font-lock-maximum-decoration t)
564 )
c9b3d0c @ignacy Fixed some annoyances on windows
authored
565
5b63859 @ignacy New mode, small changes
authored
566
1be2f6a @ignacy Added back some forgotten helpers
authored
567 (icomplete-mode t)
568
569 (setq frame-title-format
570 (list '("emacs ")
571 '(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
5b63859 @ignacy New mode, small changes
authored
572
1be2f6a @ignacy Added back some forgotten helpers
authored
573 (setq cursor-in-non-selected-windows nil)
574 (bind "C-x g" magit-status)
2c7d19a @ignacy New switch tab
authored
575 (global-set-key [C-tab] 'bs-show)
576 ;; Moje funkcje
3bf4d3f @ignacy Work changes
authored
577
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
578 (bind "C-c j" im/join-line)
579
580
581 (defun im/join-line()
582 "Join with previous line but move back to next line after"
583 (interactive)
584 (join-line)
585 (next-line))
586
8324826 @ignacy Few new things
authored
587
72bf1d9 @ignacy Remove elc files
authored
588 (defun ido-goto-symbol (&optional symbol-list)
589 "Refresh imenu and jump to a place in the buffer using Ido."
590 (interactive)
591 (unless (featurep 'imenu)
592 (require 'imenu nil t))
593 (cond
594 ((not symbol-list)
595 (let ((ido-mode ido-mode)
596 (ido-enable-flex-matching
597 (if (boundp 'ido-enable-flex-matching)
598 ido-enable-flex-matching t))
599 name-and-pos symbol-names position)
600 (unless ido-mode
601 (ido-mode 1)
602 (setq ido-enable-flex-matching t))
603 (while (progn
604 (imenu--cleanup)
605 (setq imenu--index-alist nil)
606 (ido-goto-symbol (imenu--make-index-alist))
607 (setq selected-symbol
608 (ido-completing-read "Symbol? " symbol-names))
609 (string= (car imenu--rescan-item) selected-symbol)))
610 (unless (and (boundp 'mark-active) mark-active)
611 (push-mark nil t nil))
612 (setq position (cdr (assoc selected-symbol name-and-pos)))
8324826 @ignacy Few new things
authored
613 (cond
72bf1d9 @ignacy Remove elc files
authored
614 ((overlayp position)
615 (goto-char (overlay-start position)))
616 (t
617 (goto-char position)))))
618 ((listp symbol-list)
619 (dolist (symbol symbol-list)
620 (let (name position)
621 (cond
622 ((and (listp symbol) (imenu--subalist-p symbol))
623 (ido-goto-symbol symbol))
624 ((listp symbol)
625 (setq name (car symbol))
626 (setq position (cdr symbol)))
627 ((stringp symbol)
628 (setq name symbol)
629 (setq position
630 (get-text-property 1 'org-imenu-marker symbol))))
631 (unless (or (null position) (null name)
632 (string= (car imenu--rescan-item) name))
633 (add-to-list 'symbol-names name)
634 (add-to-list 'name-and-pos (cons name position))))))))
635
6f1845d @ignacy mmhmhmhm
authored
636
637 (global-set-key (kbd "M-i") 'ido-goto-symbol)
8324826 @ignacy Few new things
authored
638
34f777d @ignacy New pop and push mark commands
authored
639 (defun push-mark-no-activate ()
640 "Pushes `point' to `mark-ring' and does not activate the region
641 Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
642 (interactive)
643 (push-mark (point) t nil)
644 (message "Pushed mark to ring"))
645 (global-set-key (kbd "C-`") 'push-mark-no-activate)
646
647 (defun jump-to-mark ()
648 "Jumps to the local mark, respecting the `mark-ring' order.
649 This is the same as using \\[set-mark-command] with the prefix argument."
650 (interactive)
651 (set-mark-command 1))
652 (global-set-key (kbd "M-`") 'jump-to-mark)
653
2c7d19a @ignacy New switch tab
authored
654 (defun im/find-note (note)
655 "Find note in org mode notes file"
656 (interactive "sWpisz szukane slowo: ")
657 (find-file "/home/ignacy/Dropbox/org/notes.org")
658 (re-search-forward note)
659 (point))
3bf4d3f @ignacy Work changes
authored
660
00e679c @ignacy Changed settings to clean things up a bit
authored
661 ;; (defun im/clear-elc-files
662 ;; "Clear all bytecompiled emacs files"
663 ;; (shell-command "find ~/.emacs.d/ -name *.elc -exec rm {} \;"))
664
665
8324826 @ignacy Few new things
authored
666
667 (require 'etags)
668 (defun ido-find-tag ()
669 "Find a tag using ido"
670 (interactive)
671 (tags-completion-table)
672 (let (tag-names)
673 (mapc (lambda (x)
674 (unless (integerp x)
675 (push (prin1-to-string x t) tag-names)))
676 tags-completion-table)
677 (find-tag (ido-completing-read "Tag: " tag-names))))
678
679 (defun ido-find-file-in-tag-files ()
680 (interactive)
681 (save-excursion
682 (let ((enable-recursive-minibuffers t))
683 (visit-tags-table-buffer))
684 (find-file
685 (expand-file-name
686 (ido-completing-read
687 "Project file: " (tags-table-files) nil t)))))
688
689 (global-set-key [remap find-tag] 'ido-find-tag)
690 (global-set-key (kbd "C-.") 'ido-find-file-in-tag-files)
691
692
497503e @ignacy Oguras mode
authored
693 (require 'recentf)
8324826 @ignacy Few new things
authored
694
695 ;; get rid of `find-file-read-only' and replace it with something
696 ;; more useful.
697 (global-set-key (kbd "C-x C-r") 'ido-recentf-open)
698
699 ;; enable recent files mode.
700 (recentf-mode t)
701
72bf1d9 @ignacy Remove elc files
authored
702 ; 50 files ought to be enough.
8324826 @ignacy Few new things
authored
703 (setq recentf-max-saved-items 50)
704
705 (defun ido-recentf-open ()
706 "Use `ido-completing-read' to \\[find-file] a recent file"
707 (interactive)
708 (if (find-file (ido-completing-read "Find recent file: " recentf-list))
709 (message "Opening file...")
710 (message "Aborting")))
2c7d19a @ignacy New switch tab
authored
711
712 (add-hook 'before-save-hook 'whitespace-cleanup)
713
714 (global-set-key (kbd "<right>") 'use-emacs-keys)
715 (global-set-key (kbd "<left>") 'use-emacs-keys)
716 (global-set-key (kbd "<down>") 'use-emacs-keys)
717 (global-set-key (kbd "<up>") 'use-emacs-keys)
718
e0aab08 @ignacy Updated
authored
719
da3f247 @ignacy some changes
authored
720 (setq confirm-nonexistent-file-or-buffer nil)
721 (setq kill-buffer-query-functions
60e564e @ignacy Local changes
authored
722 (remq 'process-kill-buffer-query-function
723 kill-buffer-query-functions))
da3f247 @ignacy some changes
authored
724
725 (setq ibuffer-expert t)
726 (setq ibuffer-show-empty-filter-groups nil)
727
cc7d737 @ignacy fixed small annoyances
authored
728
729 (keyboard-translate ?\C-h ?\C-?)
c9b3d0c @ignacy Fixed some annoyances on windows
authored
730
731 (global-set-key (kbd "C-c %") 'replace-regexp)
732 (defalias 'qrr 'query-replace-regexp)
733
2c7d19a @ignacy New switch tab
authored
734 (defun use-emacs-keys ()
735 (interactive)
736 "Remind me to use emacs move keys not arrows!!"
737 (message "Use emacs keys you lazy bastard!!"))
1a69fd3 @ignacy Emacs config changes on windows
authored
738
739
740 (defun create-tags (dir-name)
741 "Create tags file."
742 (interactive "DDirectory: ")
743 (eshell-command
744 (format "find %s -type f -name \"*.java\" | etags -l java -" dir-name)))
745 ;;p find . -name "*.cpp" -print -or -name "*.h" -print | xargs etags
cc7d737 @ignacy fixed small annoyances
authored
746 (setq tags-revert-without-query t)
1a69fd3 @ignacy Emacs config changes on windows
authored
747
748 (global-set-key (kbd "M-,") 'tags-search)
749 (global-set-key (kbd "M-?") 'tags-loop-continue)
c9b3d0c @ignacy Fixed some annoyances on windows
authored
750 (put 'set-goal-column 'disabled nil)
ac62bf9 @ignacy Cygwin config
authored
751
752 (unless (server-running-p)
753 (server-start))
754
755
756 (defun isearch-other-window ()
757 """ Search in other window without movign there """
758 (interactive)
759 (save-selected-window
760 (other-window 1)
761 (isearch-forward)))
762
763 (global-set-key (kbd "C-M-s") 'isearch-other-window)
764
765
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
766 ;;(set-face-attribute 'default nil :font "Mono Dyslexic-13")
767 (set-face-attribute 'default nil :font "Inconsolata-13")
ac62bf9 @ignacy Cygwin config
authored
768
769
770 (when on-windows
771 (add-hook 'comint-output-filter-functions
772 'shell-strip-ctrl-m nil t)
773 (add-hook 'comint-output-filter-functions
774 'comint-watch-for-password-prompt nil t)
775 (setq explicit-shell-file-name "bash.exe")
776 ;; For subprocesses invoked via the shell
777 ;; (e.g., "shell -c command")
778 (setq shell-file-name explicit-shell-file-name)
779 (setenv "PATH" (concat "c:/bin;" (getenv "PATH")))
780 (setq exec-path (cons "c:/bin/" exec-path))
781 (require 'cygwin-mount)
782 (cygwin-mount-activate))
4a787b8 @ignacy Java yasnippet added
authored
783
784
bf30e05 @ignacy textmate coffee
authored
785 (add-to-list 'load-path (concat dotfiles-dir "/coffee-mode"))
786 (require 'coffee-mode)
787
788 (add-to-list 'load-path (concat dotfiles-dir "/textmate.el"))
789 (require 'textmate)
790 (textmate-mode)
042ca80 @ignacy Fixed setup
authored
791
792 (defadvice erase-buffer (around erase-buffer-noop)
793 "make erase-buffer do nothing")
794
795 (defadvice shell-command (around shell-command-unique-buffer activate compile)
796 (if (or current-prefix-arg
797 (not (string-match "[ \t]*&[ \t]*\\'" command)) ;; background
798 (bufferp output-buffer)
799 (stringp output-buffer))
800 ad-do-it ;; no behavior change
801
802 ;; else we need to set up buffer
803 (let* ((command-buffer-name
804 (format "*background: %s*"
805 (substring command 0 (match-beginning 0))))
806 (command-buffer (get-buffer command-buffer-name)))
807
808 (when command-buffer
809 ;; if the buffer exists, reuse it, or rename it if it's still in use
810 (cond ((get-buffer-process command-buffer)
811 (set-buffer command-buffer)
812 (rename-uniquely))
813 ('t
814 (kill-buffer command-buffer))))
815 (setq output-buffer command-buffer-name)
816
817 ;; insert command at top of buffer
818 (switch-to-buffer-other-window output-buffer)
819 (insert "Running command: " command
820 "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n")
821
822 ;; temporarily blow away erase-buffer while doing it, to avoid
823 ;; erasing the above
824 (ad-activate-regexp "erase-buffer-noop")
825 ad-do-it
826 (ad-deactivate-regexp "erase-buffer-noop"))))
096eb58 @ignacy merged
authored
827
f47e677 @ignacy dasf
authored
828 (setq auto-save-default nil)
614343b @ignacy Fix ruby setup; Fix emacs look on windows
authored
829
830
831 (defun im/dark-colors (&optional frame)
832 "Set colors suitable for working in the darkness without electricity."
833 (interactive)
834 (setq frame-background-mode 'dark)
835 (if frame
836 (select-frame frame)
837 (setq frame (selected-frame)))
838 (set-background-color "black")
839 (set-foreground-color "gainsboro")
840 (when (facep 'region)
841 (set-face-background 'region "DimGray" frame))
842 (when (facep 'fringe)
843 (set-face-background 'fringe (face-background 'default) frame)
844 (set-face-foreground 'fringe (face-foreground 'default) frame)))
845 (im/dark-colors)
846
847 (defun im/colors-light (&optional frame)
848 "Set colors suitable for working in light environments,
849 i.e. in daylight or under bright electric lamps."
850 (interactive)
851 (setq frame-background-mode 'light)
852 (if frame
853 (select-frame frame)
854 (setq frame (selected-frame)))
855 (set-background-color "#fffafa")
856 (set-foreground-color "black")
857 (when (facep 'region)
858 (set-face-background 'region "DarkGrey" frame))
859 (when (facep 'fringe)
860 (set-face-background 'fringe (face-background 'default) frame)
861 (set-face-foreground 'fringe (face-foreground 'default) frame))
862 ;; When started Emacs under root, warn by red color in the modeline
863 (when (and (facep 'mode-line)
864 (file-exists-p "/root")
865 (file-writable-p "/root"))
866 (set-face-background 'mode-line "firebrick")))
88343b9 @ignacy add some things
authored
867
868
869 (defun substitute-regexp (substitution)
870 "Use s/old/new/g regexp syntax for `query-replace'."
871 (interactive
872 (list
873 (read-from-minibuffer "Substitute regexp: " '("s///g" . 3) nil nil
874 'query-replace-history nil t)))
875 (if (string-match "^s/\\(.*\\)/\\(.*\\)/\\([gi]*\\)" substitution)
876 (let* ((sregex (match-string 1 substitution))
877 (ssubst (match-string 2 substitution))
878 (sflags (match-string 3 substitution))
879 (case-fold-search (string-match "i" sflags)))
880 (perform-replace
881 sregex ssubst (string-match "g" sflags)
882 t nil nil nil
883 (if (and transient-mark-mode mark-active) (region-beginning))
884 (if (and transient-mark-mode mark-active) (region-end))))
885 (error "Invalid syntax")))
886
887
888 (defun im/worklog-add (&optional arg)
889 (interactive "P")
890 (find-file "~/Dropbox/org/logfile.org")
891 (goto-char (point-max))
892 (insert "\n")
893 (insert (format-time-string "** %Y-%m-%d %H:%M - " (current-time)))
894 ((re-search-backward "^[0-9-]+ [0-9:]+" nil t)
895 (forward-line 1)
896 (backward-char)))
897
898 (bind "<f6>" im/worklog-add)
Something went wrong with that request. Please try again.