Clean up and rough :make shortcut
This commit is contained in:
parent
0af611cf6d
commit
b2e14c475e
4 changed files with 49 additions and 26 deletions
4
init.el
4
init.el
|
@ -30,7 +30,7 @@
|
||||||
(defconst *light-theme 'github) ; wtb better light theme...
|
(defconst *light-theme 'github) ; wtb better light theme...
|
||||||
|
|
||||||
(defconst *fonts `(,(font-spec :family "Terminus (TTF)" :size 12 :antialias nil)
|
(defconst *fonts `(,(font-spec :family "Terminus (TTF)" :size 12 :antialias nil)
|
||||||
,(font-spec :family "Ubuntu Mono" :size 16 :antialias t)
|
,(font-spec :family "Ubuntu Mono" :size 14 :antialias t)
|
||||||
,(font-spec :family "Inconsolata" :size 22 :antialias t)))
|
,(font-spec :family "Inconsolata" :size 22 :antialias t)))
|
||||||
|
|
||||||
(add-to-list 'load-path my-core-dir)
|
(add-to-list 'load-path my-core-dir)
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
init-java ; the poster child for carpal tunnel syndome
|
init-java ; the poster child for carpal tunnel syndome
|
||||||
init-js ; alert("not java, javascript!")
|
init-js ; alert("not java, javascript!")
|
||||||
init-lua ; zero-based indices? Zero-based indices.
|
init-lua ; zero-based indices? Zero-based indices.
|
||||||
init-org ; for fearless leader (who is organized)
|
;; init-org ; for fearless leader (who is organized)
|
||||||
init-php ; making php less painful to work with
|
init-php ; making php less painful to work with
|
||||||
init-python ; beautiful is better than ugly
|
init-python ; beautiful is better than ugly
|
||||||
init-regex ; /^[^\s](meaning)[^\n]*/
|
init-regex ; /^[^\s](meaning)[^\n]*/
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
(associate-mode "\\.mm$" 'objc-mode))
|
(associate-mode "\\.mm$" 'objc-mode))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
;; Settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(setq c-basic-offset 4
|
(setq c-basic-offset 4
|
||||||
c-tab-always-indent nil)
|
c-tab-always-indent nil)
|
||||||
|
|
||||||
|
@ -39,25 +40,6 @@
|
||||||
(defun my--clang-includes-flags ()
|
(defun my--clang-includes-flags ()
|
||||||
(mapcar (lambda (item) (concat "-I" item)) my--clang-includes)))
|
(mapcar (lambda (item) (concat "-I" item)) my--clang-includes)))
|
||||||
|
|
||||||
(progn ; C++
|
|
||||||
(defun my--setup-c++-mode-flycheck ()
|
|
||||||
(setq flycheck-clang-language-standard "c++11"
|
|
||||||
flycheck-clang-standard-library "libc++"
|
|
||||||
flycheck-c/c++-clang-executable "clang++"
|
|
||||||
flycheck-clang-include-path (my--clang-includes)
|
|
||||||
))
|
|
||||||
(after "flycheck"
|
|
||||||
(add-hook 'c++-mode-hook 'my--setup-c++-mode-flycheck)))
|
|
||||||
|
|
||||||
(progn ; Obj-C
|
|
||||||
(add-to-list 'magic-mode-alist
|
|
||||||
`(,(lambda ()
|
|
||||||
(and (string= (file-name-extension buffer-file-name) "h")
|
|
||||||
(re-search-forward "@\\<interface\\>"
|
|
||||||
magic-mode-regexp-match-limit t)))
|
|
||||||
. objc-mode))
|
|
||||||
(after "flycheck" (add-hook! 'objc-mode-hook (use-package flycheck-objc))))
|
|
||||||
|
|
||||||
(after "company"
|
(after "company"
|
||||||
;; TODO Clang is *really* slow in larger projects, maybe replace it with irony-mode or ycmd?
|
;; TODO Clang is *really* slow in larger projects, maybe replace it with irony-mode or ycmd?
|
||||||
(company--backend-on 'c-mode-hook 'company-c-headers 'company-clang)
|
(company--backend-on 'c-mode-hook 'company-c-headers 'company-clang)
|
||||||
|
@ -89,6 +71,22 @@
|
||||||
|
|
||||||
(add-hook 'c-mode-hook 'my-c/c++-settings)
|
(add-hook 'c-mode-hook 'my-c/c++-settings)
|
||||||
(add-hook 'c++-mode-hook 'my-c/c++-settings)
|
(add-hook 'c++-mode-hook 'my-c/c++-settings)
|
||||||
|
(after "flycheck"
|
||||||
|
(add-hook! 'c++-mode-hook
|
||||||
|
(setq flycheck-clang-language-standard "c++11"
|
||||||
|
flycheck-clang-standard-library "libc++"
|
||||||
|
flycheck-c/c++-clang-executable "clang++"
|
||||||
|
flycheck-clang-include-path (my--clang-includes))))
|
||||||
|
|
||||||
|
(progn ; Obj-C
|
||||||
|
(add-to-list 'magic-mode-alist
|
||||||
|
`(,(lambda ()
|
||||||
|
(and (string= (file-name-extension buffer-file-name) "h")
|
||||||
|
(re-search-forward "@\\<interface\\>"
|
||||||
|
magic-mode-regexp-match-limit t)))
|
||||||
|
. objc-mode))
|
||||||
|
(after "flycheck" (add-hook! 'objc-mode-hook (use-package flycheck-objc))))
|
||||||
|
|
||||||
|
|
||||||
;; C++11 syntax support (until cc-mode is updated)
|
;; C++11 syntax support (until cc-mode is updated)
|
||||||
(require 'font-lock)
|
(require 'font-lock)
|
||||||
|
@ -156,6 +154,13 @@
|
||||||
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
|
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
|
||||||
0 ; no additional indent
|
0 ; no additional indent
|
||||||
ad-do-it))) ; default behavior
|
ad-do-it))) ; default behavior
|
||||||
|
|
||||||
|
|
||||||
|
;; Tools/defuns ;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(push '("*compilation*" :height 0.5 :position bottom :noselect t) popwin:special-display-config)
|
||||||
|
|
||||||
|
(add-hook! 'c++-mode-hook (setq my-make-command "make %s"))
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
|
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
|
||||||
(add-hook 'js2-mode-hook 'rainbow-delimiters-mode)
|
(add-hook 'js2-mode-hook 'rainbow-delimiters-mode)
|
||||||
(add-hook 'scss-mode-hook 'rainbow-delimiters-mode)))
|
(add-hook 'scss-mode-hook 'rainbow-delimiters-mode)))
|
||||||
|
|
||||||
;;; Config modes
|
;;; Config modes
|
||||||
(use-package yaml-mode
|
(use-package yaml-mode
|
||||||
|
@ -31,6 +31,26 @@
|
||||||
|
|
||||||
(after "evil" (evil-ex-define-cmd "ref[actor]" 'emr-show-refactor-menu))))
|
(after "evil" (evil-ex-define-cmd "ref[actor]" 'emr-show-refactor-menu))))
|
||||||
|
|
||||||
|
(bind my-mode-map
|
||||||
|
"M-b" 'my:build)
|
||||||
|
|
||||||
|
(defvar my-build-command "make %s")
|
||||||
|
(make-variable-buffer-local 'my-build-command)
|
||||||
|
(add-hook! 'enh-ruby-mode-hook (setq my-build-command "rake %s"))
|
||||||
|
|
||||||
|
(evil-ex-define-cmd "ma[ke]" 'my:build)
|
||||||
|
(evil-define-command my:build (arg)
|
||||||
|
"Call a build command in the current directory.
|
||||||
|
If ARG is nil this function calls `recompile', otherwise it calls
|
||||||
|
`compile' passing ARG as build command."
|
||||||
|
(interactive "<sh>")
|
||||||
|
(let ((makepath (f-traverse-upwards
|
||||||
|
(lambda (path)
|
||||||
|
(f-exists? (f-expand "Makefile" path)))
|
||||||
|
default-directory)))
|
||||||
|
(if makepath
|
||||||
|
(compile (format "cd '%s' && %s" makepath (format my-make-command (or arg ""))))
|
||||||
|
(error "Could not find Makefile"))))
|
||||||
|
|
||||||
(provide 'init-dev)
|
(provide 'init-dev)
|
||||||
;;; init-dev.el ends here
|
;;; init-dev.el ends here
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
(add-hook 'lua-mode-hook 'enable-tab-width-2)
|
(add-hook 'lua-mode-hook 'enable-tab-width-2)
|
||||||
(add-hook! 'lua-mode-hook (setq lua-indent-level tab-width))
|
(add-hook! 'lua-mode-hook (setq lua-indent-level tab-width))
|
||||||
|
|
||||||
(defun love-run ()
|
(add-hook! 'love-mode-hook (setq my-build-command (format "open -a love.app %s" (my--project-root))))))
|
||||||
(interactive)
|
|
||||||
(shell-command (format "open -a love.app %s" (my--project-root))))))
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-lua)
|
(provide 'init-lua)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue