This repository has been archived by the owner on Nov 19, 2019. It is now read-only.
forked from chachi/emacs-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-dev.el
96 lines (83 loc) · 2.5 KB
/
my-dev.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
;;; package --- Summary
;;; Commentary:
;;; The common development functionality for Emacs (git, testing, etc)
(require 'exec-path-from-shell)
(require 'magit)
(require 'notifications)
(require 'vc-git)
(require 'virtualenvwrapper)
;;; Code:
;;;;;;;;;;;;;;;;
;;; Git
(when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git))
(global-set-key "\C-x\C-i" 'magit-status)
(setq magit-status-buffer-switch-function 'switch-to-buffer)
(setq git-commit-fill-column 100)
;;;;;;;;;;;;;;;;
;;; Alarms
(setq ring-bell-function 'ignore)
;;;;;;;;;;;;;;;;
;;; Compilation
;;; See also my-global-bindings:function keys
(global-set-key "\C-x\C-m" 'compile)
(setq compilation-always-kill t)
(setq compilation-skip-threshold 2)
;;; Stop scrolling at the first error
(setq compilation-scroll-output 'first-error)
;;; XCodebuild for .m files
(defun bh-compile ()
(interactive)
(let ((df (directory-files "."))
(has-proj-file nil)
)
(while (and df (not has-proj-file))
(let ((fn (car df)))
(if (> (length fn) 10)
(if (string-equal (substring fn -10) ".xcodeproj")
(setq has-proj-file t)
)
)
)
(setq df (cdr df))
)
(if has-proj-file
(compile "xcodebuild -configuration Debug")
(compile "make")
)
)
)
(defun notify-compilation-result(buffer msg)
"Notify that the compilation is finished,
close the *compilation* buffer if the compilation is successful,
and set the focus back to Emacs frame"
(if (string-match "^finished" msg)
(progn
;; Notify on compilation success
(notifications-notify
:title "Compilation Success"
:timeout 2000
:urgency 'low))
(notifications-notify
;; Notify on compilation failure
:title "Compilation Failure"
:timeout 2000
:urgency 'low))
(setq current-frame (car (car (cdr (current-frame-configuration)))))
(select-frame-set-input-focus current-frame)
)
(add-to-list 'compilation-finish-functions
'notify-compilation-result)
;;;;;;;;;;;;;;;;
;;; GDB
(global-set-key (kbd "C-c C-g")
'(lambda ()(interactive)
(gud-gdb (concat "gdb --fullname "
(cppcm-get-exe-path-current-buffer)))))
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)
(exec-path-from-shell-copy-env "EDITOR"))
(venv-initialize-interactive-shells) ;; if you want interactive shell support
(venv-initialize-eshell) ;; if you want eshell support
(setq venv-location "/home/replica/RepLabs/server/venv/")
(provide 'my-dev)
;;; my-dev.el ends here