Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 596 lines (477 sloc) 19.114 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)
8 (defvar set-line-highlighting t)
9 (defvar set-environment-settings t)
72bf1d9 @ignacy Remove elc files
authored
10
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
11
a761f38 @ignacy Fixed OS depenedet issues
authored
12 ;; Helper variables to recognize the environment
13 (defvar on-windows
14 (eq system-type 'windows-nt))
15
16
17 (when set-directories (message "Setting directories..")
18 (if on-windows
19 (progn
20 (message "Running windows.. using AppData/Roaming")
21 (setq dotfiles-dir "~/AppData/Roaming/.emacs.d"))
22 (message "We're not on windows..")
23 (setq dotfiles-dir "~/.emacs.d"))
24 (setq imoryc-dir (concat dotfiles-dir "/imoryc"))
25 (add-to-list 'load-path imoryc-dir))
26
27 (when set-loadpaths (message "Setting load paths for libraries")
28 (add-to-list 'load-path (concat dotfiles-dir "/emacs-rails-reloaded"))
29 (require 'rails-autoload)
30
31 (load-file (concat imoryc-dir "/ruby-setup.el"))
32 (load-file (concat imoryc-dir "/rake-setup.el"))
33 (load-file (concat imoryc-dir "/project-top.el"))
34 (load-file (concat imoryc-dir "/testing.el"))
35 (add-to-list 'load-path (concat dotfiles-dir "/magit-0.8.2"))
36 (require 'magit)
37 (add-to-list 'load-path "~/.emacs.d/android-mode")
38 (require 'android-mode))
39
40
41 (when set-environment-settings (message "Setting environment settings")
42 (setq inhibit-startup-message t))
43
44 (when set-line-highlighting (message "Switching line highlighting on")
45 (global-hl-line-mode 1)
46 (set-face-background 'hl-line "#222")
47 (set-face-foreground 'highlight nil)
48 (set-face-foreground 'hl-line nil))
49
319d0c1 @ignacy moveing to magit for git interactions
authored
50
60e564e @ignacy Local changes
authored
51
72bf1d9 @ignacy Remove elc files
authored
52 (defcustom android-mode-sdk-dir "~/android"
53 "Set to the directory containing the Android SDK."
54 :type 'string
55 :group 'android-mode)
a761f38 @ignacy Fixed OS depenedet issues
authored
56 (defcustom android-mode-avd "@htc"
57 "Default AVD to use."
58 :type 'string
59 :group 'android-mode)
72bf1d9 @ignacy Remove elc files
authored
60
60e564e @ignacy Local changes
authored
61
62 (defun ant-compile ()
63 "Traveling up the path, find build.xml file and run compile."
64 (interactive)
65 (with-temp-buffer
66 (while (and (not (file-exists-p "build.xml"))
67 (not (equal "/" default-directory)))
68 (cd ".."))
69 (call-interactively 'compile)))
70
5b26a37 @ignacy changed theme
authored
71
34f777d @ignacy New pop and push mark commands
authored
72 (require 'epa)
73 (epa-file-enable)
74
5b26a37 @ignacy changed theme
authored
75 (require 'git-blame)
319d0c1 @ignacy moveing to magit for git interactions
authored
76
f726071 @ignacy haml mode
authored
77 (require 'haml-mode)
74ae0fb @ignacy Work settings>
authored
78
3724861 @ignacy Lots of changes
authored
79 (require 'rvm)
74ae0fb @ignacy Work settings>
authored
80 (require 'anything)
319d0c1 @ignacy moveing to magit for git interactions
authored
81
74ae0fb @ignacy Work settings>
authored
82 (require 'proel)
83 (require 'xcscope)
84
7e8334a @ignacy Nedw way to run the tests
authored
85 (global-set-key (kbd "C-x f") 'ido-find-file)
86 (global-set-key (kbd "C-q") 'jw-run-test-or-spec-file)
1e837ad @ignacy Added F2 as magit status
authored
87
88 (global-set-key (kbd "C-x C-b") 'ido-switch-buffer)
89 (global-set-key (kbd "C-x b") 'list-buffers)
90
91
92
60e564e @ignacy Local changes
authored
93 ;; Window manipulation
94 (global-set-key [(control prior)] 'enlarge-window)
95 (global-set-key [(control next)] 'shrink-window)
96
97 (windmove-default-keybindings 'meta)
98
99
100 ;; Make the whole buffer pretty and consistent
101 (defun iwb()
102 "Indent Whole Buffer"
103 (interactive)
104 (delete-trailing-whitespace)
105 (indent-region (point-min) (point-max) nil)
106 (untabify (point-min) (point-max)))
107
108 (global-set-key [(meta i)] 'iwb)
109
110
111 (add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
112
36216c2 @ignacy changes
authored
113
114 (global-set-key (kbd "C-x C-p") 'find-file-at-point)
115 (defadvice find-file-at-point (around goto-line compile activate)
116 (let ((line (and (looking-at ".*:\\([0-9]+\\)")
117 (string-to-number (match-string 1)))))
118 ad-do-it
119 (and line (goto-line line))))
120
8324826 @ignacy Few new things
authored
121 (setq next-line-add-newlines t)
74ae0fb @ignacy Work settings>
authored
122 (setq cscope-do-not-update-database t
1473e61 @ignacy Changed colors
authored
123 ;; grep-find-template "find . -type f -print0 | xargs -0 -e grep -nH -e "
74ae0fb @ignacy Work settings>
authored
124 anything-sources
60e564e @ignacy Local changes
authored
125 '(proel-anything-projects
126 proel-anything-current-project-files))
74ae0fb @ignacy Work settings>
authored
127
497503e @ignacy Oguras mode
authored
128 (add-to-list 'load-path (concat dotfiles-dir "/feature-mode"))
129 (require 'feature-mode)
130 (add-to-list 'auto-mode-alist '("\.feature$" . feature-mode))
131
3724861 @ignacy Lots of changes
authored
132 (setq-default fill-column 100)
5b63859 @ignacy New mode, small changes
authored
133
72bf1d9 @ignacy Remove elc files
authored
134 ;; (setq ditaa-cmd "java -jar /home/ignacy/bin/ditaa0_9.jar")
135 ;; (defun djcb-ditaa-generate ()
136 ;; (interactive)
137 ;; (shell-command
138 ;; (concat ditaa-cmd " " buffer-file-name)))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
139
da3f247 @ignacy some changes
authored
140 (scroll-bar-mode -1)
6e6491b @ignacy Rdebug
authored
141 (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
142 (transient-mark-mode 1) ;; No region when it is not highlighted
143 (setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
144 (delete-selection-mode t)
8324826 @ignacy Few new things
authored
145 (subword-mode t)
146
1e837ad @ignacy Added F2 as magit status
authored
147
8324826 @ignacy Few new things
authored
148 (defvar smart-use-extended-syntax nil
149 "If t the smart symbol functionality will consider extended
150 syntax in finding matches, if such matches exist.")
151
152 (defvar smart-last-symbol-name ""
153 "Contains the current symbol name.
154
155 This is only refreshed when `last-command' does not contain
156 either `smart-symbol-go-forward' or `smart-symbol-go-backward'")
157
158 (make-local-variable 'smart-use-extended-syntax)
159
160 (defvar smart-symbol-old-pt nil
161 "Contains the location of the old point")
162
163 (defun smart-symbol-goto (name direction)
164 "Jumps to the next NAME in DIRECTION in the current buffer.
165
166 DIRECTION must be either `forward' or `backward'; no other option
167 is valid."
168
169 ;; if `last-command' did not contain
170 ;; `smart-symbol-go-forward/backward' then we assume it's a
171 ;; brand-new command and we re-set the search term.
172 (unless (memq last-command '(smart-symbol-go-forward
173 smart-symbol-go-backward))
174 (setq smart-last-symbol-name name))
175 (setq smart-symbol-old-pt (point))
176 (message (format "%s scan for symbol \"%s\""
177 (capitalize (symbol-name direction))
178 smart-last-symbol-name))
179 (unless (catch 'done
180 (while (funcall (cond
181 ((eq direction 'forward) ; forward
182 'search-forward)
183 ((eq direction 'backward) ; backward
184 'search-backward)
185 (t (error "Invalid direction"))) ; all others
186 smart-last-symbol-name nil t)
187 (unless (memq (syntax-ppss-context
188 (syntax-ppss (point))) '(string comment))
189 (throw 'done t))))
190 (goto-char smart-symbol-old-pt)))
191
192 (defun smart-symbol-go-forward ()
193 "Jumps forward to the next symbol at point"
194 (interactive)
195 (smart-symbol-goto (smart-symbol-at-pt 'end) 'forward))
196
197 (defun smart-symbol-go-backward ()
198 "Jumps backward to the previous symbol at point"
199 (interactive)
200 (smart-symbol-goto (smart-symbol-at-pt 'beginning) 'backward))
201
202 (defun smart-symbol-at-pt (&optional dir)
203 "Returns the symbol at point and moves point to DIR (either `beginning' or `end') of the symbol.
204
205 If `smart-use-extended-syntax' is t then that symbol is returned
206 instead."
207 (with-syntax-table (make-syntax-table)
208 (if smart-use-extended-syntax
209 (modify-syntax-entry ?. "w"))
210 (modify-syntax-entry ?_ "w")
211 (modify-syntax-entry ?- "w")
212 ;; grab the word and return it
213 (let ((word (thing-at-point 'word))
214 (bounds (bounds-of-thing-at-point 'word)))
215 (if word
216 (progn
217 (cond
218 ((eq dir 'beginning) (goto-char (car bounds)))
219 ((eq dir 'end) (goto-char (cdr bounds)))
220 (t (error "Invalid direction")))
221 word)
222 (error "No symbol found")))))
223
224 (global-set-key (kbd "M-n") 'smart-symbol-go-forward)
225 (global-set-key (kbd "M-p") 'smart-symbol-go-backward)
226
227 ;; '(setq visible-bell t)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
228 (show-paren-mode 1)
0fe7db8 Further changes
Ignacy Moryc authored
229 (fset 'yes-or-no-p 'y-or-n-p)
669b696 Basics
Ignacy Moryc authored
230 (tool-bar-mode -1)
231 (menu-bar-mode -1)
232 (ido-mode t)
0fe7db8 Further changes
Ignacy Moryc authored
233 (setq ido-create-new-buffer 'always)
669b696 Basics
Ignacy Moryc authored
234 (setq backup-inhibited t)
00e679c @ignacy Changed settings to clean things up a bit
authored
235
0fe7db8 Further changes
Ignacy Moryc authored
236 (global-linum-mode 1)
237 (setq linum-format "%3d ")
9b0e71f @ignacy changes
authored
238
00e679c @ignacy Changed settings to clean things up a bit
authored
239 ;; insert current buffer name into minibuffer
9b0e71f @ignacy changes
authored
240 (define-key minibuffer-local-map [f3]
241 (lambda () (interactive)
60e564e @ignacy Local changes
authored
242 (insert (buffer-name (window-buffer (minibuffer-selected-window))))))
9b0e71f @ignacy changes
authored
243
da3f247 @ignacy some changes
authored
244 (global-set-key [(control backspace)] 'backward-kill-word)
245 (global-set-key [(meta delete)] 'backward-kill-word)
31af1db @ignacy :-/
authored
246 (global-set-key [(meta a)] 'anything)
669b696 Basics
Ignacy Moryc authored
247
da3f247 @ignacy some changes
authored
248 (setq x-select-enable-clipboard t)
3724861 @ignacy Lots of changes
authored
249 (global-set-key [(control v)] 'clipboard-yank)
250 (global-set-key (kbd "C-x C-x") 'clipboard-kill-region)
251
252 (defvar compile-command "rake ") ; set the default make command
253 (make-variable-buffer-local 'compile-command)
60e564e @ignacy Local changes
authored
254 ; make the compile command buffer local
255 ; (this allows each buffer to have its
256 ; own custom compile command)
3724861 @ignacy Lots of changes
authored
257
0fe7db8 Further changes
Ignacy Moryc authored
258 (setq-default indent-tabs-mode nil)
259 (setq indent-tabs-mode nil)
00e679c @ignacy Changed settings to clean things up a bit
authored
260 (setq tab-width 4)
0fe7db8 Further changes
Ignacy Moryc authored
261 (setq default-indicate-empty-lines t)
262
263
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
264 (load-file (concat imoryc-dir "/markdown-mode.el"))
265 (autoload 'markdown-mode "markdown-mode.el"
60e564e @ignacy Local changes
authored
266 "Major mode for editing Markdown files" t)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
267 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
268 (cons '("\\.md" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
269 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
270 (cons '("\\.text" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
271 (setq auto-mode-alist
60e564e @ignacy Local changes
authored
272 (cons '("\\.markdown" . markdown-mode) auto-mode-alist))
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
273
274
0fe7db8 Further changes
Ignacy Moryc authored
275 (defun stop-using-minibuffer ()
276 "kill the minibuffer"
277 (when (and (>= (recursion-depth) 1) (active-minibuffer-window))
278 (abort-recursive-edit)))
279 (add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)
280
281 ;; IBUFFER Settings
282 (defalias 'list-buffers 'ibuffer)
283 (setq ibuffer-show-empty-filter-groups nil)
284 (setq ibuffer-always-show-last-buffer nil)
285 (setq ibuffer-sorting-mode 'recency)
f6eaf6f @ignacy chasnged
authored
286 (setq ibuffer-formats '((mark modified read-only " "
60e564e @ignacy Local changes
authored
287 (name 30 30 :left :elide)
288 " " filename-and-process)))
f6eaf6f @ignacy chasnged
authored
289
0fe7db8 Further changes
Ignacy Moryc authored
290 (setq ibuffer-use-header-line t)
f6eaf6f @ignacy chasnged
authored
291 (require 'ibuf-ext)
292 (add-to-list 'ibuffer-never-show-predicates "^\\*")
0fe7db8 Further changes
Ignacy Moryc authored
293 (setq ibuffer-saved-filter-groups
294 (quote (("default"
295 ("TERMINAL" (name . "^\\*terminal\\*$"))
f6eaf6f @ignacy chasnged
authored
296 ("middleware" (filename . "/code/middleware/"))
297 ("fyre" (filename . "/code/webapp/"))
0fe7db8 Further changes
Ignacy Moryc authored
298 ("ruby" (mode . ruby-mode))
299 ("javascript" (name . "\\.js.erb$\\|.js$"))
f6eaf6f @ignacy chasnged
authored
300 ("ogórki" (name . "\\.feature\$"))
301 ("dired" (mode . dired-mode))
302 ("Org" (mode . org-mode))
0fe7db8 Further changes
Ignacy Moryc authored
303 ("haml" (mode . haml-mode))
f6eaf6f @ignacy chasnged
authored
304 ("elisp" (name . "\\.el\$"))))))
0fe7db8 Further changes
Ignacy Moryc authored
305
306 (add-hook 'ibuffer-mode-hook
307 (lambda ()
308 (ibuffer-switch-to-saved-filter-groups "default")))
3724861 @ignacy Lots of changes
authored
309
0fe7db8 Further changes
Ignacy Moryc authored
310 (defadvice ibuffer-update-title-and-summary (after remove-column-titles)
311 (save-excursion
312 (set-buffer "*Ibuffer*")
313 (toggle-read-only 0)
314 (goto-char 1)
315 (search-forward "-\n" nil t)
316 (delete-region 1 (point))
317 (let ((window-min-height 1))
318 ;; save a little screen estate
319 (shrink-window-if-larger-than-buffer))
320 (toggle-read-only)))
321
322
323 (global-unset-key [?\C-x ?\C-z])
324 (global-set-key [f1] 'menu-bar-mode)
325 (global-set-key (kbd "C-z") 'undo)
3724861 @ignacy Lots of changes
authored
326
72bf1d9 @ignacy Remove elc files
authored
327 ;; (global-hl-line-mode 1)
328 ;;(set-face-background 'hl-line "gray8")
0fe7db8 Further changes
Ignacy Moryc authored
329 ;;BOOKMARKS
330 (define-key global-map [f9] 'bookmark-jump)
331 (define-key global-map [f10] 'bookmark-set)
332 (define-key global-map (kbd "C-+") 'text-scale-increase)
333 (define-key global-map (kbd "C--") 'text-scale-decrease)
3bf4d3f @ignacy Work changes
authored
334 (global-set-key "\C-s" 'isearch-forward-regexp)
335 (global-set-key "\C-r" 'isearch-backward-regexp)
0fe7db8 Further changes
Ignacy Moryc authored
336 (global-set-key (kbd "M-/") 'hippie-expand)
337 (global-set-key (kbd "M-,") 'comment-or-uncomment-region)
338 (global-set-key (kbd "M-l") 'highlight-lines-matching-regexp)
339 (global-set-key (kbd "M-o") 'occur)
340 (global-set-key [(meta g)] 'goto-line)
341 (global-set-key "\C-a" 'beginning-of-line-text)
342 (defun my-ibuffer ()
60e564e @ignacy Local changes
authored
343 "Open ibuffer with cursour pointed to most recent buffer name"
344 (interactive)
345 (let ((recent-buffer-name (buffer-name)))
346 (ibuffer)
347 (ibuffer-jump-to-buffer recent-buffer-name)))
31af1db @ignacy :-/
authored
348 ;; (global-set-key [(f12)] 'my-ibuffer)
0fe7db8 Further changes
Ignacy Moryc authored
349 (global-set-key [f11] 'switch-full-screen)
350
351
352 (defun duplicate-line ()
353 "*Insert a copy of the current line below the current line."
354 (interactive)
355 (save-excursion
356 (let ((start (progn (beginning-of-line) (point)))
357 (end (progn (end-of-line) (point))))
358 (insert ?\n)
359 (insert-buffer-substring (current-buffer) start end))))
360
361 (global-set-key (kbd "C-c d") 'duplicate-line)
362
3724861 @ignacy Lots of changes
authored
363 (defun copy-line()
364 (interactive)
365 (move-beginning-of-line 1)
366 (kill-line)
367 (yank)
368 (next-line 1)
60e564e @ignacy Local changes
authored
369 )
3724861 @ignacy Lots of changes
authored
370 (global-set-key (kbd "C-c C-d") 'copy-line)
371
01089f5 New submodule
Ignacy Moryc authored
372 ;; install wmctrl (sudo apt-get install wmctrl)
373 (defun switch-full-screen ()
374 "Switch emacs to full screen mode"
375 (interactive)
376 (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
e871475 Auto complete
Ignacy Moryc authored
377
378 ;;yassnippet
379 (add-to-list 'load-path (concat dotfiles-dir "/yasnippet-0.6.1c"))
380 (require 'yasnippet) ;; not yasnippet-bundle
381 (yas/initialize)
382 (yas/load-directory (concat dotfiles-dir "/yasnippet-0.6.1c/snippets"))
51ae665 @ignacy Some small changes. Moved yasnippet back to TAB
authored
383 (setq yas/trigger-key "TAB")
e871475 Auto complete
Ignacy Moryc authored
384
385 (require 'org-install)
386 ;; The following lines are always needed. Choose your own keys.
387 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
388 (global-set-key "\C-cl" 'org-store-link)
389 (global-set-key "\C-ca" 'org-agenda)
390 (global-set-key "\C-cb" 'org-iswitchb)
391 (global-font-lock-mode 1) ; for all buffers
02e6366 @ignacy Emacs 24 new stuff
authored
392
e871475 Auto complete
Ignacy Moryc authored
393 (transient-mark-mode 1)
02e6366 @ignacy Emacs 24 new stuff
authored
394
e871475 Auto complete
Ignacy Moryc authored
395 (setq org-directory "~/Dropbox/org")
a5245f0 @ignacy Merged
authored
396
34f777d @ignacy New pop and push mark commands
authored
397 (setq org-default-notes-file (concat org-directory "/notes.gpg"))
02e6366 @ignacy Emacs 24 new stuff
authored
398
399 (define-key global-map "\C-cc" 'org-capture)
f6eaf6f @ignacy chasnged
authored
400
e871475 Auto complete
Ignacy Moryc authored
401 (add-hook 'org-mode-hook
402 (lambda ()
403 (org-set-local 'yas/trigger-key [tab])
404 (define-key yas/keymap [tab] 'yas/next-field-group)))
405
406
2c7d19a @ignacy New switch tab
authored
407 (setq
60e564e @ignacy Local changes
authored
408 bookmark-default-file "~/.emacs.d/bookmarks" ;; keep my ~/ clean
409 bookmark-save-flag 1) ;; autosave each change)
a8afee2 new setings (markdown etc)
Ignacy Moryc authored
410
411 (define-key global-map [f9] 'bookmark-jump)
412 (define-key global-map [f10] 'bookmark-set)
413
414
e871475 Auto complete
Ignacy Moryc authored
415 ;;AUTOCOMPLETE
416 (add-to-list 'load-path (concat dotfiles-dir "/auto-complete-1.3"))
417 (require 'auto-complete-config)
418 (ac-config-default)
419
420 ;; dirty fix for having AC everywhere
421 (define-globalized-minor-mode real-global-auto-complete-mode
422 auto-complete-mode (lambda ()
423 (if (not (minibufferp (current-buffer)))
424 (auto-complete-mode 1))
425 ))
426 (real-global-auto-complete-mode t)
427 (setq rsense-home "/home/ignacy/bin/rsense-0.3")
428 (add-to-list 'load-path (concat rsense-home "/etc"))
5b63859 @ignacy New mode, small changes
authored
429 (require 'rsense)
430
431 (define-key isearch-mode-map (kbd "C-o")
432 (lambda ()
433 (interactive)
434 (let ((case-fold-search isearch-case-fold-search))
435 (occur (if isearch-regexp isearch-string
436 (regexp-quote isearch-string))))))
437
438
00e679c @ignacy Changed settings to clean things up a bit
authored
439 (add-to-list 'load-path (concat dotfiles-dir "/color-theme-6.6.0"))
dbc4a03 @ignacy New awesome config
authored
440
00e679c @ignacy Changed settings to clean things up a bit
authored
441 (load-file (concat imoryc-dir "/colors/color-theme-g0sub.el"))
442 (require 'color-theme)
443 (eval-after-load "color-theme"
444 '(progn
445 (color-theme-initialize)
446 (color-theme-g0sub)))
5b63859 @ignacy New mode, small changes
authored
447
448 (setq font-use-system-font t)
449
2c7d19a @ignacy New switch tab
authored
450 (global-set-key [C-tab] 'bs-show)
451 ;; Moje funkcje
3bf4d3f @ignacy Work changes
authored
452
8324826 @ignacy Few new things
authored
453
72bf1d9 @ignacy Remove elc files
authored
454 (defun ido-goto-symbol (&optional symbol-list)
455 "Refresh imenu and jump to a place in the buffer using Ido."
456 (interactive)
457 (unless (featurep 'imenu)
458 (require 'imenu nil t))
459 (cond
460 ((not symbol-list)
461 (let ((ido-mode ido-mode)
462 (ido-enable-flex-matching
463 (if (boundp 'ido-enable-flex-matching)
464 ido-enable-flex-matching t))
465 name-and-pos symbol-names position)
466 (unless ido-mode
467 (ido-mode 1)
468 (setq ido-enable-flex-matching t))
469 (while (progn
470 (imenu--cleanup)
471 (setq imenu--index-alist nil)
472 (ido-goto-symbol (imenu--make-index-alist))
473 (setq selected-symbol
474 (ido-completing-read "Symbol? " symbol-names))
475 (string= (car imenu--rescan-item) selected-symbol)))
476 (unless (and (boundp 'mark-active) mark-active)
477 (push-mark nil t nil))
478 (setq position (cdr (assoc selected-symbol name-and-pos)))
8324826 @ignacy Few new things
authored
479 (cond
72bf1d9 @ignacy Remove elc files
authored
480 ((overlayp position)
481 (goto-char (overlay-start position)))
482 (t
483 (goto-char position)))))
484 ((listp symbol-list)
485 (dolist (symbol symbol-list)
486 (let (name position)
487 (cond
488 ((and (listp symbol) (imenu--subalist-p symbol))
489 (ido-goto-symbol symbol))
490 ((listp symbol)
491 (setq name (car symbol))
492 (setq position (cdr symbol)))
493 ((stringp symbol)
494 (setq name symbol)
495 (setq position
496 (get-text-property 1 'org-imenu-marker symbol))))
497 (unless (or (null position) (null name)
498 (string= (car imenu--rescan-item) name))
499 (add-to-list 'symbol-names name)
500 (add-to-list 'name-and-pos (cons name position))))))))
501
502 (global-set-key "\C-ci" 'ido-goto-symbol) ; or any key you see fit
8324826 @ignacy Few new things
authored
503
34f777d @ignacy New pop and push mark commands
authored
504 (defun push-mark-no-activate ()
505 "Pushes `point' to `mark-ring' and does not activate the region
506 Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
507 (interactive)
508 (push-mark (point) t nil)
509 (message "Pushed mark to ring"))
510 (global-set-key (kbd "C-`") 'push-mark-no-activate)
511
512 (defun jump-to-mark ()
513 "Jumps to the local mark, respecting the `mark-ring' order.
514 This is the same as using \\[set-mark-command] with the prefix argument."
515 (interactive)
516 (set-mark-command 1))
517 (global-set-key (kbd "M-`") 'jump-to-mark)
518
2c7d19a @ignacy New switch tab
authored
519 (defun im/find-note (note)
520 "Find note in org mode notes file"
521 (interactive "sWpisz szukane slowo: ")
522 (find-file "/home/ignacy/Dropbox/org/notes.org")
523 (re-search-forward note)
524 (point))
3bf4d3f @ignacy Work changes
authored
525
00e679c @ignacy Changed settings to clean things up a bit
authored
526 ;; (defun im/clear-elc-files
527 ;; "Clear all bytecompiled emacs files"
528 ;; (shell-command "find ~/.emacs.d/ -name *.elc -exec rm {} \;"))
529
530
8324826 @ignacy Few new things
authored
531
532 (require 'etags)
533 (defun ido-find-tag ()
534 "Find a tag using ido"
535 (interactive)
536 (tags-completion-table)
537 (let (tag-names)
538 (mapc (lambda (x)
539 (unless (integerp x)
540 (push (prin1-to-string x t) tag-names)))
541 tags-completion-table)
542 (find-tag (ido-completing-read "Tag: " tag-names))))
543
544 (defun ido-find-file-in-tag-files ()
545 (interactive)
546 (save-excursion
547 (let ((enable-recursive-minibuffers t))
548 (visit-tags-table-buffer))
549 (find-file
550 (expand-file-name
551 (ido-completing-read
552 "Project file: " (tags-table-files) nil t)))))
553
554 (global-set-key [remap find-tag] 'ido-find-tag)
555 (global-set-key (kbd "C-.") 'ido-find-file-in-tag-files)
556
557
497503e @ignacy Oguras mode
authored
558 (require 'recentf)
8324826 @ignacy Few new things
authored
559
560 ;; get rid of `find-file-read-only' and replace it with something
561 ;; more useful.
562 (global-set-key (kbd "C-x C-r") 'ido-recentf-open)
563
564 ;; enable recent files mode.
565 (recentf-mode t)
566
72bf1d9 @ignacy Remove elc files
authored
567 ; 50 files ought to be enough.
8324826 @ignacy Few new things
authored
568 (setq recentf-max-saved-items 50)
569
570 (defun ido-recentf-open ()
571 "Use `ido-completing-read' to \\[find-file] a recent file"
572 (interactive)
573 (if (find-file (ido-completing-read "Find recent file: " recentf-list))
574 (message "Opening file...")
575 (message "Aborting")))
2c7d19a @ignacy New switch tab
authored
576
577 (add-hook 'before-save-hook 'whitespace-cleanup)
578
579 (global-set-key (kbd "<right>") 'use-emacs-keys)
580 (global-set-key (kbd "<left>") 'use-emacs-keys)
581 (global-set-key (kbd "<down>") 'use-emacs-keys)
582 (global-set-key (kbd "<up>") 'use-emacs-keys)
583
da3f247 @ignacy some changes
authored
584 (setq confirm-nonexistent-file-or-buffer nil)
585 (setq kill-buffer-query-functions
60e564e @ignacy Local changes
authored
586 (remq 'process-kill-buffer-query-function
587 kill-buffer-query-functions))
da3f247 @ignacy some changes
authored
588
589 (setq ibuffer-expert t)
590 (setq ibuffer-show-empty-filter-groups nil)
591
2c7d19a @ignacy New switch tab
authored
592 (defun use-emacs-keys ()
593 (interactive)
594 "Remind me to use emacs move keys not arrows!!"
595 (message "Use emacs keys you lazy bastard!!"))
Something went wrong with that request. Please try again.