Massive refactor. Refactor all the things

This commit is contained in:
Henrik Lissner 2016-04-23 22:08:46 -04:00
parent 03514fc09d
commit f234be68a4
56 changed files with 792 additions and 831 deletions

23
Cask
View file

@ -29,7 +29,6 @@
(depends-on "visual-fill-column") (depends-on "visual-fill-column")
(depends-on "highlight-indentation" :git "https://github.com/localredhead/Highlight-Indentation-for-Emacs") (depends-on "highlight-indentation" :git "https://github.com/localredhead/Highlight-Indentation-for-Emacs")
(depends-on "highlight-numbers") (depends-on "highlight-numbers")
(depends-on "imenu-list")
(depends-on "rainbow-delimiters") (depends-on "rainbow-delimiters")
(depends-on "rainbow-mode") (depends-on "rainbow-mode")
(depends-on "nlinum") (depends-on "nlinum")
@ -55,6 +54,8 @@
(depends-on "evil-escape") (depends-on "evil-escape")
;; Editor --- core/core-editor.el ;; Editor --- core/core-editor.el
(depends-on "dumb-jump")
(depends-on "imenu-list")
(depends-on "ace-window") (depends-on "ace-window")
(depends-on "avy") (depends-on "avy")
(depends-on "editorconfig") (depends-on "editorconfig")
@ -65,11 +66,6 @@
(depends-on "rotate-text" :git "https://github.com/debug-ito/rotate-text.el") (depends-on "rotate-text" :git "https://github.com/debug-ito/rotate-text.el")
(depends-on "smart-forward") (depends-on "smart-forward")
(depends-on "smartparens") (depends-on "smartparens")
(depends-on "vimrc-mode")
(depends-on "json-mode")
(depends-on "toml-mode")
(depends-on "yaml-mode")
(depends-on "dockerfile-mode")
;; Completion --- core/core-company.el ;; Completion --- core/core-company.el
(depends-on "company") (depends-on "company")
@ -110,11 +106,9 @@
(depends-on "projectile") (depends-on "projectile")
(depends-on "helm-describe-modes" :git "https://github.com/emacs-helm/helm-describe-modes") (depends-on "helm-describe-modes" :git "https://github.com/emacs-helm/helm-describe-modes")
;; Code evaluation/REPLs -- core/core-eval.el ;; Code evaluation/REPLs/debug -- core/core-eval.el
(depends-on "quickrun") (depends-on "quickrun")
(depends-on "repl-toggle") (depends-on "repl-toggle")
;; Debugging -- core/core-debug.el
(depends-on "realgud") (depends-on "realgud")
;; Sessions --- core/core-sessions.el ;; Sessions --- core/core-sessions.el
@ -128,6 +122,7 @@
(depends-on "company-sourcekit") (depends-on "company-sourcekit")
;; C/C++ -- modules/module-cc.el ;; C/C++ -- modules/module-cc.el
(depends-on "disaster")
(depends-on "cmake-mode") (depends-on "cmake-mode")
(depends-on "glsl-mode") (depends-on "glsl-mode")
(depends-on "cuda-mode") (depends-on "cuda-mode")
@ -146,6 +141,14 @@
(depends-on "omnisharp") (depends-on "omnisharp")
(depends-on "shader-mode") (depends-on "shader-mode")
;; Data -- modules/module-data.el
(depends-on "vimrc-mode")
(depends-on "json-mode")
(depends-on "toml-mode")
(depends-on "yaml-mode")
(depends-on "dockerfile-mode")
(depends-on "company-ansible")
;; Golang -- modules/module-go.el ;; Golang -- modules/module-go.el
(depends-on "go-mode") (depends-on "go-mode")
(depends-on "go-eldoc") (depends-on "go-eldoc")
@ -186,6 +189,7 @@
(depends-on "php-refactor-mode") (depends-on "php-refactor-mode")
(depends-on "php-boris") (depends-on "php-boris")
(depends-on "php-extras") (depends-on "php-extras")
(depends-on "ac-php")
(depends-on "hack-mode" :git "https://github.com/beefsack/hack-mode") (depends-on "hack-mode" :git "https://github.com/beefsack/hack-mode")
;; Processing -- modules/module-processing.el ;; Processing -- modules/module-processing.el
@ -219,7 +223,6 @@
(depends-on "markdown-toc") (depends-on "markdown-toc")
;; Web -- modules/module-web.el ;; Web -- modules/module-web.el
(depends-on "web-beautify")
(depends-on "web-mode") (depends-on "web-mode")
(depends-on "emmet-mode") (depends-on "emmet-mode")
(depends-on "haml-mode") (depends-on "haml-mode")

53
core/core-company.el Normal file
View file

@ -0,0 +1,53 @@
;;; core-company.el
(use-package company
:init
(setq company-idle-delay nil
company-minimum-prefix-length 2
company-tooltip-limit 10
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-dabbrev-code-other-buffers t
company-tooltip-align-annotations t
company-require-match 'never
company-global-modes '(not eshell-mode comint-mode erc-mode message-mode help-mode)
company-frontends '(company-pseudo-tooltip-frontend company-echo-metadata-frontend)
company-backends '((company-capf company-dabbrev-code) company-dabbrev)
company-quickhelp-delay nil
company-statistics-file (concat narf-temp-dir "/company-stats-cache.el"))
:config
;; Rewrites evil-complete to use company-dabbrev
(setq evil-complete-next-func 'narf/company-evil-complete-next
evil-complete-previous-func 'narf/company-evil-complete-previous)
(push 'company-sort-by-occurrence company-transformers)
(setq-default company-backends (append '(company-keywords) company-backends))
(def-company-backend! nxml-mode (nxml yasnippet))
(define-key company-active-map "\C-w" nil)
(global-company-mode +1))
(use-package company-quickhelp
:after company
:config (company-quickhelp-mode +1))
(use-package company-statistics
:after company
:config (company-statistics-mode +1))
(use-package company-files
:commands company-files)
(use-package company-dict
:commands company-dict
:config (setq company-dict-dir (concat narf-private-dir "/dict")))
(use-package company-template
:after ac-php-company)
(provide 'core-company)
;;; core-company.el ends here

View file

@ -1,52 +0,0 @@
;;; core-completion.el --- auto completion backend (Company-mode)
(use-package company
:init
(setq company-idle-delay nil
company-minimum-prefix-length 2
company-tooltip-limit 10
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-dabbrev-code-other-buffers t
company-tooltip-align-annotations t
company-require-match 'never
company-global-modes '(not eshell-mode comint-mode erc-mode message-mode help-mode)
company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
company-backends '((company-capf company-dabbrev-code)
company-dabbrev))
:config
;; Rewrites evil-complete to use company-dabbrev
(setq evil-complete-next-func 'narf/company-evil-complete-next
evil-complete-previous-func 'narf/company-evil-complete-previous)
(push 'company-sort-by-occurrence company-transformers)
(setq-default company-backends (append '(company-keywords) company-backends))
(define-company-backend! nxml-mode (nxml yasnippet))
(define-company-backend! emacs-lisp-mode (elisp yasnippet))
(define-key company-active-map "\C-w" nil)
(global-company-mode +1)
(use-package company-files :commands (company-files))
;; NOTE: pos-tip.el in Emacs 25+ does not work
(use-package company-quickhelp
:config
(company-quickhelp-mode +1)
(setq company-quickhelp-delay nil))
(use-package company-statistics
:config
(company-statistics-mode +1)
(setq company-statistics-file (concat narf-temp-dir "/company-stats-cache.el"))))
(use-package company-dict
:commands (company-dict)
:config (setq company-dict-dir (concat narf-private-dir "/dict")))
(provide 'core-completion)
;;; core-completion.el ends here

View file

@ -1,35 +0,0 @@
;;; core-debug.el
(after! debug
;; For elisp debugging
(map! :map debugger-mode-map
:n "RET" 'debug-help-follow
:n "n" 'debugger-step-through
:n "c" 'debugger-continue))
(use-package realgud
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
:config
(map! :map realgud:shortkey-mode-map
:n "j" 'evil-next-line
:n "k" 'evil-previous-line
:n "h" 'evil-backward-char
:n "l" 'evil-forward-char
;; FIXME Greedy command buffer always grabs focus
:m "n" 'realgud:cmd-next
:m "b" 'realgud:cmd-break
:m "B" 'realgud:cmd-clear
:n "c" 'realgud:cmd-continue)
;; Temporary Ex commands for the debugger
(define-temp-ex-cmd! narf:def-debug-on narf:def-debug-off
("n[ext]" . realgud:cmd-next)
("s[tep]" . realgud:cmd-step)
("b[reak]" . narf:debug-toggle-breakpoint)
("c[ontinue]" . realgud:cmd-continue))
(advice-add 'realgud-cmdbuf-init :after 'narf:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'narf:def-debug-off))
(provide 'core-debug)
;;; core-debug.el ends here

View file

@ -112,10 +112,10 @@ Examples:
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)" (t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)"
mode in match files)))))) mode in match files))))))
(defmacro define-project-type! (name lighter &rest body) (defmacro def-project-type! (name lighter &rest body)
"Define a minor mode for a specific framework, library or project type. e.g. "Define a minor mode for a specific framework, library or project type. e.g.
(define-project-type! angularjs \"angjs\" (def-project-type! angularjs \"angjs\"
:modes (js2-mode) :modes (js2-mode)
:files (\"package.json\"))" :files (\"package.json\"))"
(declare (indent 2)) (declare (indent 2))
@ -133,7 +133,7 @@ Examples:
(pop body)) (pop body))
`(progn `(progn
(define-minor-mode ,mode (define-minor-mode ,mode
"Auto-generated by `define-project-type!'" "Auto-generated by `def-project-type!'"
:init-value nil :init-value nil
:lighter ,(concat " " lighter) :lighter ,(concat " " lighter)
:keymap (make-sparse-keymap) :keymap (make-sparse-keymap)
@ -146,14 +146,14 @@ Examples:
(yas-deactivate-extra-mode ',mode))))))) (yas-deactivate-extra-mode ',mode)))))))
(after! company-dict (after! company-dict
(add-to-list 'company-dict-minor-mode-list ',mode)) (push ',mode company-dict-minor-mode-list))
,(when build ,(when build
(when (listp build) (when (listp build)
(setq build (car-safe (cdr-safe build)))) (setq build (car-safe (cdr-safe build))))
(let ((cmd (or (car-safe build) build)) (let ((cmd (or (car-safe build) build))
(file (car-safe (cdr-safe build)))) (file (car-safe (cdr-safe build))))
`(define-builder! ,mode ,cmd ,file))) `(def-builder! ,mode ,cmd ,file)))
,(when bind ,(when bind
`(map! :map ,mode-map ,bind)) `(map! :map ,mode-map ,bind))
@ -255,7 +255,9 @@ Examples:
(let ((dir (or dir (narf/project-root)))) (let ((dir (or dir (narf/project-root))))
(with-current-buffer (get-buffer-create "*scratch*") (with-current-buffer (get-buffer-create "*scratch*")
(setq default-directory dir) (setq default-directory dir)
(setq header-line-format '(:eval (concat "" (abbreviate-file-name default-directory))))))) (setq header-line-format
'(:eval
(concat "" (abbreviate-file-name default-directory)))))))
;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;; ;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;

View file

@ -71,6 +71,10 @@
recentf-auto-cleanup 600) recentf-auto-cleanup 600)
(recentf-mode 1) (recentf-mode 1)
;; Let editorconfig handle global whitespace settings
(require 'editorconfig)
(editorconfig-mode +1)
;; ;;
;; Automatic minor modes ;; Automatic minor modes
@ -105,10 +109,7 @@ enable multiple minor modes for the same regexp.")
;; Modes 'n hooks ;; Modes 'n hooks
;; ;;
(associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$")
(associate! makefile-gmake-mode :match "/Makefile$") (associate! makefile-gmake-mode :match "/Makefile$")
(associate! nxml-mode :match "\\.plist$")
(associate! conf-mode :match "/\\.?editorconfig$")
(add-hook! special-mode (setq truncate-lines nil)) (add-hook! special-mode (setq truncate-lines nil))
(add-hook! change-major-mode-hook (add-hook! change-major-mode-hook
@ -136,10 +137,10 @@ enable multiple minor modes for the same regexp.")
;; Smarter electric-indent ;; Smarter electric-indent
(electric-indent-mode -1) ; on by default (electric-indent-mode -1) ; on by default
(defvar narf-electric-indent-p nil)
(defvar narf-electric-indent-words '()) (defvar narf-electric-indent-words '())
(make-variable-buffer-local 'narf-electric-indent-words) (make-variable-buffer-local 'narf-electric-indent-words)
(setq electric-indent-chars '(?\n ?\^?)) (setq electric-indent-chars '(?\n ?\^?))
(defvar narf-electric-indent-p nil)
(push (lambda (c) (push (lambda (c)
(when (eolp) (when (eolp)
(save-excursion (save-excursion
@ -162,43 +163,10 @@ enable multiple minor modes for the same regexp.")
(setq winner-boring-buffers narf-ignore-buffers)) (setq winner-boring-buffers narf-ignore-buffers))
;;
;; Extra modes
;;
(use-package vimrc-mode :mode ("/\\.?g?vimrc$" "\\.vim$" "/\\.vim/rc/.+$"))
;; Data formats
(use-package toml-mode :mode "\\.toml$")
(use-package yaml-mode :mode "\\.ya?ml$"
:config
(add-hook! yaml-mode (setq electric-indent-chars '(?\n ?: ?-))))
(use-package json-mode :mode "\\.js\\(on\\|hintrc\\)$"
:config
(add-hook! json-mode (setq electric-indent-chars '(?\n ?: ?}))))
(add-hook! (yaml-mode json-mode) 'electric-indent-local-mode)
;; Configuration formats
(use-package dockerfile-mode :mode "/Dockerfile$"
:config
(define-docset! dockerfile-mode "docker")
(define-builder! dockerfile-mode dockerfile-build-buffer "Dockerfile"))
;; ;;
;; Plugins ;; Plugins
;; ;;
(use-package editorconfig
:config
;; Don't affect lisp indentation (only `tab-width')
(setq editorconfig-indentation-alist
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
editorconfig-indentation-alist))
(editorconfig-mode +1))
(use-package ace-window (use-package ace-window
:commands ace-window :commands ace-window
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) :config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
@ -217,8 +185,18 @@ enable multiple minor modes for the same regexp.")
(use-package expand-region (use-package expand-region
:commands (er/expand-region er/contract-region er/mark-symbol er/mark-word)) :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
(use-package dumb-jump
:commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back)
:config
(setq dumb-jump-default-project narf-emacs-dir)
(dumb-jump-mode +1))
(use-package goto-last-change :commands goto-last-change) (use-package goto-last-change :commands goto-last-change)
(use-package help-fns+ ; Improved help commands
:commands (describe-buffer describe-command describe-file
describe-keymap describe-option describe-option-of-type))
(use-package hideshow (use-package hideshow
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p) :commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
:config (setq hs-isearch-open t) :config (setq hs-isearch-open t)
@ -247,6 +225,33 @@ enable multiple minor modes for the same regexp.")
(overlay-put ov 'before-string marker-string) (overlay-put ov 'before-string marker-string)
(overlay-put ov 'display display-string)))))) (overlay-put ov 'display display-string))))))
(use-package imenu-list
:commands imenu-list-minor-mode
:config
(setq imenu-list-mode-line-format nil
imenu-list-position 'right
imenu-list-size 32)
(map! :map imenu-list-major-mode-map
:n [escape] 'narf/imenu-list-quit
:n "RET" 'imenu-list-goto-entry
:n "SPC" 'imenu-list-display-entry
:n [tab] 'hs-toggle-hiding))
(use-package re-builder
:commands (re-builder reb-mode-buffer-p)
:init
(add-hook 'reb-mode-hook 'narf|reb-cleanup)
(evil-set-initial-state 'reb-mode 'insert)
:config
(setq reb-re-syntax 'string)
(map! :map rxt-help-mode-map
:n [escape] 'kill-buffer-and-window
:map reb-mode-map
:n "C-g" 'reb-quit
:n [escape] 'reb-quit
:n [backtab] 'reb-change-syntax))
(use-package rotate-text (use-package rotate-text
:commands (rotate-text rotate-text-backward) :commands (rotate-text rotate-text-backward)
:init :init
@ -259,7 +264,7 @@ enable multiple minor modes for the same regexp.")
("advice-add" "advice-remove") ("advice-add" "advice-remove")
("add-hook" "add-hook!" "remove-hook")))) ("add-hook" "add-hook!" "remove-hook"))))
:config :config
(add-to-list 'rotate-text-words '("true" "false"))) (push '("true" "false") rotate-text-words))
(use-package smart-forward :commands (smart-up smart-down smart-left smart-right)) (use-package smart-forward :commands (smart-up smart-down smart-left smart-right))
@ -295,23 +300,5 @@ enable multiple minor modes for the same regexp.")
(sp-with-modes '(xml-mode nxml-mode php-mode) (sp-with-modes '(xml-mode nxml-mode php-mode)
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC"))))) (sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
(use-package help-fns+ ; Improved help commands
:commands (describe-buffer describe-command describe-file
describe-keymap describe-option describe-option-of-type))
(use-package re-builder
:commands (re-builder reb-mode-buffer-p)
:init
(add-hook 'reb-mode-hook 'narf|reb-cleanup)
(evil-set-initial-state 'reb-mode 'insert)
:config
(setq reb-re-syntax 'string)
(map! :map rxt-help-mode-map
:n [escape] 'kill-buffer-and-window
:map reb-mode-map
:n "C-g" 'reb-quit
:n [escape] 'reb-quit
:n [backtab] 'reb-change-syntax))
(provide 'core-editor) (provide 'core-editor)
;;; core-editor.el ends here ;;; core-editor.el ends here

View file

@ -1,5 +1,10 @@
;;; core-eval.el ;;; core-eval.el
;; + Running inline code + REPLs (using `quickrun' + `repl-toggle')
;; + Almost-universal debugging (with `realgud')
;; + Simple code navigation (using `dump-jump' and `imenu-list')
;; + A universal tags config (WIP)
(use-package quickrun (use-package quickrun
:commands (quickrun :commands (quickrun
quickrun-region quickrun-region
@ -34,5 +39,37 @@
:ei "<down>" 'comint-next-input :ei "<down>" 'comint-next-input
:ei "<up>" 'comint-previous-input)) :ei "<up>" 'comint-previous-input))
;;
(after! debug
;; For elisp debugging
(map! :map debugger-mode-map
:n "RET" 'debug-help-follow
:n "n" 'debugger-step-through
:n "c" 'debugger-continue))
(use-package realgud
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
:config
(map! :map realgud:shortkey-mode-map
:n "j" 'evil-next-line
:n "k" 'evil-previous-line
:n "h" 'evil-backward-char
:n "l" 'evil-forward-char
;; FIXME Greedy command buffer always grabs focus
:m "n" 'realgud:cmd-next
:m "b" 'realgud:cmd-break
:m "B" 'realgud:cmd-clear
:n "c" 'realgud:cmd-continue)
;; Temporary Ex commands for the debugger
(def-tmp-excmd! narf:def-debug-on narf:def-debug-off
("n[ext]" . realgud:cmd-next)
("s[tep]" . realgud:cmd-step)
("b[reak]" . narf:debug-toggle-breakpoint)
("c[ontinue]" . realgud:cmd-continue))
(advice-add 'realgud-cmdbuf-init :after 'narf:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'narf:def-debug-off))
(provide 'core-eval) (provide 'core-eval)
;;; core-eval.el ends here ;;; core-eval.el ends here

View file

@ -13,10 +13,8 @@
;; Disable highlights on insert-mode ;; Disable highlights on insert-mode
(add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight) (add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight)
:config (setq evil-magic t
(setq evil-want-C-u-scroll t
evil-magic t
evil-want-C-u-scroll t ; enable C-u for scrolling
evil-ex-visual-char-range t ; column range for ex commands evil-ex-visual-char-range t ; column range for ex commands
evil-want-visual-char-semi-exclusive t evil-want-visual-char-semi-exclusive t
evil-ex-search-vim-style-regexp t evil-ex-search-vim-style-regexp t
@ -24,7 +22,6 @@
evil-echo-state nil evil-echo-state nil
evil-ex-substitute-global t evil-ex-substitute-global t
evil-insert-skip-empty-lines t evil-insert-skip-empty-lines t
evil-search-module 'evil-search
evil-normal-state-tag "N" evil-normal-state-tag "N"
evil-insert-state-tag "I" evil-insert-state-tag "I"
@ -39,13 +36,15 @@
evil-normal-state-cursor 'box evil-normal-state-cursor 'box
evil-emacs-state-cursor '("cyan" box) evil-emacs-state-cursor '("cyan" box)
evil-insert-state-cursor 'bar evil-insert-state-cursor 'bar
evil-visual-state-cursor 'hollow) evil-visual-state-cursor 'hollow
;; NOTE: a bug in emacs 25 breaks undoing in evil. See ;; NOTE: a bug in emacs 25 breaks undoing in evil. See
;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim ;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim
(setq-default evil-want-fine-undo (if (> emacs-major-version 24) 'fine 'no)) evil-want-fine-undo (if (> emacs-major-version 24) 'fine))
:config
(evil-mode 1) (evil-mode 1)
(evil-select-search-module 'evil-search-module 'evil-search)
(map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window) (map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window)
@ -56,6 +55,7 @@
(debugger-mode . normal) (debugger-mode . normal)
(image-mode . normal) (image-mode . normal)
(doc-view-mode . normal) (doc-view-mode . normal)
(tabulated-list-mode . emacs)
(profile-report-mode . emacs) (profile-report-mode . emacs)
(Info-mode . emacs) (Info-mode . emacs)
(view-mode . emacs) (view-mode . emacs)
@ -82,7 +82,7 @@
(with-selected-window w (with-selected-window w
(unless (derived-mode-p 'comint-mode) (unless (derived-mode-p 'comint-mode)
(narf/popup-close w))) (narf/popup-close w)))
(narf--popup-remove w))) (narf/popup-remove w)))
narf-popup-windows))) narf-popup-windows)))
;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by ;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by
@ -96,30 +96,30 @@
(add-hook! isearch-mode-end (setq echo-keystrokes 0.02)) (add-hook! isearch-mode-end (setq echo-keystrokes 0.02))
;; Repeat motions with SPC/S-SPC ;; Repeat motions with SPC/S-SPC
(defmacro define-repeat! (command next-func prev-func) (defmacro def-repeat! (command next-func prev-func)
`(defadvice ,command `(defadvice ,command
(before ,(intern (format "narf-space--%s" (symbol-name command))) activate) (before ,(intern (format "narf-space--%s" (symbol-name command))) activate)
(define-key evil-motion-state-map (kbd "SPC") ',next-func) (define-key evil-motion-state-map (kbd "SPC") ',next-func)
(define-key evil-motion-state-map (kbd "S-SPC") ',prev-func))) (define-key evil-motion-state-map (kbd "S-SPC") ',prev-func)))
(after! evil-snipe (after! evil-snipe
(define-repeat! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse) (def-repeat! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
(define-repeat! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse)) (def-repeat! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
(after! evil-visualstar (after! evil-visualstar
(define-repeat! evil-visualstar/begin-search-forward evil-ex-search-next evil-ex-search-previous) (def-repeat! evil-visualstar/begin-search-forward evil-ex-search-next evil-ex-search-previous)
(define-repeat! evil-visualstar/begin-search-backward evil-ex-search-previous evil-ex-search-next)) (def-repeat! evil-visualstar/begin-search-backward evil-ex-search-previous evil-ex-search-next))
(define-repeat! evil-ex-search-next evil-ex-search-next evil-ex-search-previous) (def-repeat! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
(define-repeat! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous) (def-repeat! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
(define-repeat! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous) (def-repeat! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
(define-repeat! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous) (def-repeat! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
;; A monkey patch to add all of vim's file ex substitution flags to evil-mode. ;; A monkey patch to add all of vim's file ex substitution flags to evil-mode.
(defun evil-ex-replace-special-filenames (file-name) (defun evil-ex-replace-special-filenames (file-name)
@ -347,18 +347,17 @@
:config :config
(global-evil-surround-mode 1) (global-evil-surround-mode 1)
;; Escaped surround characters
(setq-default evil-surround-pairs-alist
(cons '(?\\ . narf/evil-surround-escaped)
evil-surround-pairs-alist))
(add-hook! org-mode (add-hook! org-mode
(push '(?l . narf/evil-surround-latex) evil-surround-pairs-alist)) (push '(?l . narf/evil-surround-latex) evil-surround-pairs-alist))
(add-hook! emacs-lisp-mode (add-hook! emacs-lisp-mode
(push '(?\` . ("`" . "'")) evil-surround-pairs-alist)) (push '(?\` . ("`" . "'")) evil-surround-pairs-alist))
(add-hook! python-mode (add-hook! python-mode
(push '((?d . ("\"\"\"" . "\"\"\""))) (push '((?d . ("\"\"\"" . "\"\"\""))) evil-surround-pairs-alist)))
evil-surround-pairs-alist))
;; Escaped surround characters
(setq-default evil-surround-pairs-alist
(cons '(?\\ . narf/evil-surround-escaped)
evil-surround-pairs-alist)))
(use-package evil-visualstar (use-package evil-visualstar
:commands (global-evil-visualstar-mode :commands (global-evil-visualstar-mode
@ -372,12 +371,13 @@
:config :config
(setq evil-escape-key-sequence "jk" (setq evil-escape-key-sequence "jk"
evil-escape-delay 0.25) evil-escape-delay 0.25)
(evil-escape-mode +1)
;; evil-escape causes noticable lag in linewise motions in visual mode, so only enable ;; evil-escape causes noticable lag in linewise motions in visual mode, so disable it in
;; it in insert mode. (I only need jk for insert mode anyway) ;; visual mode
(defun narf|evil-escape-disable () (evil-escape-mode -1)) (defun narf|evil-escape-disable () (evil-escape-mode -1))
(add-hook 'evil-insert-state-entry-hook 'evil-escape-mode) (add-hook 'evil-visual-state-entry-hook 'narf|evil-escape-disable)
(add-hook 'evil-insert-state-exit-hook 'narf|evil-escape-disable)) (add-hook 'evil-visual-state-exit-hook 'evil-escape-mode))
(provide 'core-evil) (provide 'core-evil)
;;; core-evil.el ends here ;;; core-evil.el ends here

View file

@ -1,7 +1,7 @@
;;; core-file-templates.el ;;; core-file-templates.el
(use-package autoinsert (use-package autoinsert
:defer t :after yasnippet
:init :init
(setq auto-insert-query nil ; Don't prompt before insertion (setq auto-insert-query nil ; Don't prompt before insertion
auto-insert-alist '()) ; Tabula rasa auto-insert-alist '()) ; Tabula rasa

View file

@ -9,15 +9,11 @@
flycheck-disabled-checkers '(emacs-lisp emacs-lisp-checkdoc make)) flycheck-disabled-checkers '(emacs-lisp emacs-lisp-checkdoc make))
:config :config
(require 'flycheck-package) ;; fixes Unknown defun property `interactive-only' error by compiling flycheck
(flycheck-package-setup) (let ((path (locate-library "flycheck")))
(unless (f-ext? path "elc")
(byte-compile-file path)))
(require 'flycheck-pos-tip)
(setq flycheck-pos-tip-timeout 10
flycheck-display-errors-delay 0.5)
(flycheck-pos-tip-mode +1)
(evil-initial-state 'flycheck-error-list-mode 'emacs)
(map! :map flycheck-error-list-mode-map (map! :map flycheck-error-list-mode-map
:n "C-n" 'flycheck-error-list-next-error :n "C-n" 'flycheck-error-list-next-error
:n "C-p" 'flycheck-error-list-previous-error :n "C-p" 'flycheck-error-list-previous-error
@ -48,6 +44,17 @@
;; "........") ;; "........")
)) ))
(use-package flycheck-package
:after flycheck
:config (flycheck-package-setup))
(use-package flycheck-pos-tip
:after flycheck
:config
(setq flycheck-pos-tip-timeout 10
flycheck-display-errors-delay 0.5)
(flycheck-pos-tip-mode +1))
(use-package flyspell :commands flyspell-mode) (use-package flyspell :commands flyspell-mode)
(provide 'core-flycheck) (provide 'core-flycheck)

View file

@ -77,10 +77,14 @@
;; Hide mode-line in helm windows ;; Hide mode-line in helm windows
(advice-add 'helm-display-mode-line :override 'narf*helm-hide-header) (advice-add 'helm-display-mode-line :override 'narf*helm-hide-header)
(after! yasnippet (push 'helm-alive-p yas-dont-activate)) (after! yasnippet (push 'helm-alive-p yas-dont-activate)))
(require 'helm-mode) (use-package helm-mode
(helm-mode 1)) :after helm
:config (helm-mode 1))
(use-package helm-tags
:commands (helm-tags-get-tag-file helm-etags-select))
(use-package helm-bookmark (use-package helm-bookmark
:commands (helm-bookmarks helm-filtered-bookmarks) :commands (helm-bookmarks helm-filtered-bookmarks)
@ -88,6 +92,7 @@
(use-package helm-projectile (use-package helm-projectile
:commands (helm-projectile-find-other-file :commands (helm-projectile-find-other-file
helm-projectile-switch-project
helm-projectile-find-file helm-projectile-find-file
helm-projectile-find-dir)) helm-projectile-find-dir))

View file

@ -4,7 +4,7 @@
(interactive) (interactive)
(error "Not yet implemented")) (error "Not yet implemented"))
(defun define-docset! (&rest _) (defun def-docset! (&rest _)
(message "No docset function defined!")) (message "No docset function defined!"))
(provide 'core-os-linux) (provide 'core-os-linux)

View file

@ -49,7 +49,7 @@
(use-package dash-at-point (use-package dash-at-point
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search dash-at-point-guess-docset) :commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search dash-at-point-guess-docset)
:init :init
(defmacro define-docset! (mode docset) (defmacro def-docset! (mode docset)
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset)))) `(add-hook! ,mode (setq-local dash-at-point-docset ,docset))))
(after! evil (after! evil

View file

@ -79,7 +79,7 @@
(local-set-key [escape escape] 'narf/popup-close) (local-set-key [escape escape] 'narf/popup-close)
(when (or (bound-and-true-p repl-toggle-mode) (when (or (bound-and-true-p repl-toggle-mode)
(derived-mode-p 'tabulated-list-mode) (derived-mode-p 'tabulated-list-mode)
(memq major-mode '(messages-buffer-mode flycheck-error-list-mode-hook))) (memq major-mode '(messages-buffer-mode flycheck-error-list-mode-hook esup-mode)))
(let ((map evil-normal-state-local-map)) (let ((map evil-normal-state-local-map))
(define-key map [escape] 'narf/popup-close) (define-key map [escape] 'narf/popup-close)
(define-key map (kbd "ESC") 'narf/popup-close)))) (define-key map (kbd "ESC") 'narf/popup-close))))
@ -90,11 +90,6 @@
;; Hacks ;; Hacks
;; ;;
(after! ert
(map! :map ert-results-mode-map
[escape] 'quit-window
"<escape>" 'quit-window))
(after! help-mode (after! help-mode
;; So that help buffer links do not open in the help popup, we need to redefine these ;; So that help buffer links do not open in the help popup, we need to redefine these
;; three button types to use `switch-to-buffer-other-window' rather than ;; three button types to use `switch-to-buffer-other-window' rather than

View file

@ -37,7 +37,6 @@
;; ;;
(use-package ido (use-package ido
:defines (flx-ido-mode ido-ubiquitous-debug-mode ido-context-switch-command ido-temp-list)
:functions (ido-to-end) :functions (ido-to-end)
:init :init
(setq ido-ignore-buffers (setq ido-ignore-buffers
@ -57,8 +56,8 @@
(add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind) (add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind)
:config :config
(add-hook! ido-setup (add-hook! ido-setup
(add-to-list 'ido-ignore-files "\\`.DS_Store$") (push "\\`.DS_Store$" ido-ignore-files)
(add-to-list 'ido-ignore-files "Icon\\?$") (push "Icon\\?$" ido-ignore-files)
(advice-add 'ido-sort-mtime :override 'narf*ido-sort-mtime) (advice-add 'ido-sort-mtime :override 'narf*ido-sort-mtime)
(require 'ido-vertical-mode) (require 'ido-vertical-mode)
@ -83,7 +82,6 @@
neotree-dir neotree-dir
neotree-find neotree-find
neo-global--window-exists-p) neo-global--window-exists-p)
:functions (neo-buffer--unlock-width neo-buffer--lock-width)
:init :init
(setq neo-create-file-auto-open t (setq neo-create-file-auto-open t
neo-auto-indent-point t neo-auto-indent-point t
@ -115,9 +113,6 @@
"r" 'neotree-rename-node "r" 'neotree-rename-node
"R" 'neotree-change-root)) "R" 'neotree-change-root))
(after! projectile
(setq projectile-switch-project-action 'neotree-projectile-action))
;; Shorter pwd in neotree ;; Shorter pwd in neotree
(defun narf*neotree-shorten-pwd (node) (defun narf*neotree-shorten-pwd (node)
(list (abbreviate-file-name (car node)))) (list (abbreviate-file-name (car node))))

View file

@ -3,7 +3,7 @@
;; I use workgroups to accomplish two things: ;; I use workgroups to accomplish two things:
;; 1. Vim-like tab emulation (type :tabs to see a list of tabs -- maybe I'll add some ;; 1. Vim-like tab emulation (type :tabs to see a list of tabs -- maybe I'll add some
;; code to make a permanent frame header to display these some day) ;; code to make a permanent frame header to display these some day)
;; 2. Session persistence ;; 2. Session persistence (with :ss and :sl)
(defvar narf-wg-frames '() (defvar narf-wg-frames '()
"A list of all the frames opened as separate workgroups. See "A list of all the frames opened as separate workgroups. See
@ -17,8 +17,8 @@ automatically renamed to the project name.")
:when (display-graphic-p) :when (display-graphic-p)
:init :init
(setq-default (setq-default
wg-session-file (expand-file-name "workgroups/last" narf-temp-dir) wg-session-file (concat narf-temp-dir "/workgroups/last")
wg-workgroup-directory (expand-file-name "workgroups/" narf-temp-dir) wg-workgroup-directory (concat narf-temp-dir "/workgroups/")
wg-first-wg-name "*untitled*" wg-first-wg-name "*untitled*"
wg-session-load-on-start nil wg-session-load-on-start nil
wg-mode-line-display-on nil wg-mode-line-display-on nil
@ -29,7 +29,7 @@ automatically renamed to the project name.")
;; NOTE: Some of these make workgroup-restoration unstable ;; NOTE: Some of these make workgroup-restoration unstable
wg-restore-mark t wg-restore-mark t
wg-restore-frame-position nil wg-restore-frame-position t
wg-restore-remote-buffers nil wg-restore-remote-buffers nil
wg-restore-scroll-bars nil wg-restore-scroll-bars nil
wg-restore-fringes nil wg-restore-fringes nil
@ -46,15 +46,8 @@ automatically renamed to the project name.")
(add-hook 'emacs-startup-hook 'workgroups-mode) (add-hook 'emacs-startup-hook 'workgroups-mode)
:config :config
(unless (file-exists-p wg-workgroup-directory)
(mkdir wg-workgroup-directory))
;; Remember the set names in between sessions ;; Remember the set names in between sessions
(add-to-list 'savehist-additional-variables 'narf-wg-names) (push 'narf-wg-names savehist-additional-variables)
(after! projectile
;; Create a new workgroup on switch-project
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project))
;; `wg-mode-line-display-on' wasn't enough ;; `wg-mode-line-display-on' wasn't enough
(advice-add 'wg-change-modeline :override 'ignore) (advice-add 'wg-change-modeline :override 'ignore)
@ -62,6 +55,10 @@ automatically renamed to the project name.")
;; Don't remember popup and neotree windows ;; Don't remember popup and neotree windows
(add-hook 'kill-emacs-hook 'narf|wg-cleanup) (add-hook 'kill-emacs-hook 'narf|wg-cleanup)
(after! projectile
;; Create a new workgroup on switch-project
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project))
;; This helps abstract some of the underlying functions away, just in case I want to ;; This helps abstract some of the underlying functions away, just in case I want to
;; switch to a different package in the future, like persp-mode, eyebrowse or wconf. ;; switch to a different package in the future, like persp-mode, eyebrowse or wconf.
(defalias 'narf/tab-display 'narf/workgroup-display) (defalias 'narf/tab-display 'narf/workgroup-display)

View file

@ -100,7 +100,7 @@
? ?∧ )))) ? ?∧ ))))
;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it ;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it
(when (and (featurep 'eldoc) (>= emacs-major-version 25)) (when (and (> emacs-major-version 24) (featurep 'eldoc))
(global-eldoc-mode -1)) (global-eldoc-mode -1))
;; line highlighting ;; line highlighting
@ -118,8 +118,6 @@
(add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on) (add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on)
;; Hide modeline in help windows ;; Hide modeline in help windows
(defun narf|hide-mode-line (&rest _)
(setq mode-line-format nil))
(add-hook 'help-mode-hook 'narf|hide-mode-line) (add-hook 'help-mode-hook 'narf|hide-mode-line)
;; Highlight TODO/FIXME/NOTE tags ;; Highlight TODO/FIXME/NOTE tags
@ -151,14 +149,14 @@
(use-package highlight-indentation (use-package highlight-indentation
:commands (highlight-indentation-mode highlight-indentation-current-column-mode) :commands (highlight-indentation-mode highlight-indentation-current-column-mode)
:init :init
(add-hook! (web-mode nxml-mode yaml-mode json-mode scss-mode (add-hook! (nxml-mode yaml-mode json-mode scss-mode
c-mode-common ruby-mode python-mode lua-mode) c-mode-common ruby-mode python-mode lua-mode)
'highlight-indentation-mode) 'highlight-indentation-mode)
(after! editorconfig
(defun narf/hl-indent-guess-offset () (defun narf/hl-indent-guess-offset ()
(when (featurep 'editorconfig) (string-to-int (gethash 'indent_size (editorconfig-get-properties))))
(string-to-int (gethash 'indent_size (editorconfig-get-properties))))) (advice-add 'highlight-indentation-guess-offset :override 'narf/hl-indent-guess-offset))
(advice-add 'highlight-indentation-guess-offset :override 'narf/hl-indent-guess-offset)
;; A long-winded method for ensuring whitespace is maintained (so that ;; A long-winded method for ensuring whitespace is maintained (so that
;; highlight-indentation-mode can display them consistently) ;; highlight-indentation-mode can display them consistently)
@ -173,19 +171,6 @@
(use-package highlight-numbers :commands (highlight-numbers-mode)) (use-package highlight-numbers :commands (highlight-numbers-mode))
(use-package imenu-list
:commands (imenu-list-minor-mode)
:config
(setq imenu-list-mode-line-format nil
imenu-list-position 'right
imenu-list-size 35)
(map! :map imenu-list-major-mode-map
:n [escape] 'narf/imenu-list-quit
:n "RET" 'imenu-list-goto-entry
:n "SPC" 'imenu-list-display-entry
:n [tab] 'hs-toggle-hiding))
(use-package rainbow-delimiters (use-package rainbow-delimiters
:commands rainbow-delimiters-mode :commands rainbow-delimiters-mode
:init :init
@ -335,7 +320,7 @@
(spaceline-define-segment *env-version (spaceline-define-segment *env-version
"Shows the environment version of a mode (e.g. pyenv for python or rbenv for ruby). "Shows the environment version of a mode (e.g. pyenv for python or rbenv for ruby).
See `define-env-command!' to define one for a mode." See `def-env-command!' to define one for a mode."
narf--env-version narf--env-version
:when narf--env-version :when narf--env-version
:face other-face :face other-face
@ -358,7 +343,6 @@ anzu to be enabled."
:skip-alternate t :skip-alternate t
:tight t) :tight t)
;; TODO mode-line-iedit-face default face
(spaceline-define-segment *iedit (spaceline-define-segment *iedit
"Show the number of matches and what match you're on (or after). Requires iedit." "Show the number of matches and what match you're on (or after). Requires iedit."
(let ((this-oc (iedit-find-current-occurrence-overlay)) (let ((this-oc (iedit-find-current-occurrence-overlay))

View file

@ -17,12 +17,6 @@
:config :config
(require 'git-gutter-fringe) (require 'git-gutter-fringe)
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk)
(define-fringe-bitmap 'git-gutter-fr:added (define-fringe-bitmap 'git-gutter-fr:added
[240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240] [240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240]
nil nil 'center) nil nil 'center)
@ -33,8 +27,16 @@
[0 0 0 0 0 0 0 128 192 224 240 248] [0 0 0 0 0 0 0 128 192 224 240 248]
nil nil 'center) nil nil 'center)
;; Refresh git-gutter on ESC in normal mode
(advice-add 'evil-force-normal-state :after 'git-gutter) (advice-add 'evil-force-normal-state :after 'git-gutter)
(add-hook 'focus-in-hook 'git-gutter:update-all-windows))
(add-hook 'focus-in-hook 'git-gutter:update-all-windows)
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk))
(after! vc-annotate (after! vc-annotate
(evil-set-initial-state 'vc-annotate-mode 'normal) (evil-set-initial-state 'vc-annotate-mode 'normal)

View file

@ -1,4 +1,4 @@
;;; core-yasnippet.el --- For the lazy typist ;;; core-yasnippet.el
(use-package yasnippet (use-package yasnippet
:mode ("emacs\\.d/private/\\(snippets\\|templates\\)/.+$" . snippet-mode) :mode ("emacs\\.d/private/\\(snippets\\|templates\\)/.+$" . snippet-mode)

View file

@ -172,11 +172,6 @@ gets killed.")
async-wait async-wait
async-inject-variables)) async-inject-variables))
(require (cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32)))
;; ;;
;; We add this to `after-init-hook' to allow errors to stop this advice ;; We add this to `after-init-hook' to allow errors to stop this advice
(add-hook! after-init (add-hook! after-init

View file

@ -1,6 +1,7 @@
;;; defuns-popups.el ;;; defuns-popups.el
(defun narf--popup-remove (window) ;;;###autoload
(defun narf/popup-remove (window)
(setq narf-popup-windows (delete window narf-popup-windows))) (setq narf-popup-windows (delete window narf-popup-windows)))
;;;###autoload ;;;###autoload
@ -8,7 +9,7 @@
"Whether WINDOW is a shackle popup window or not." "Whether WINDOW is a shackle popup window or not."
(and narf-popup-windows (and narf-popup-windows
(-any? (lambda (w) (-any? (lambda (w)
(if (window-live-p w) t (narf--popup-remove w) nil)) (if (window-live-p w) t (narf/popup-remove w) nil))
narf-popup-windows) narf-popup-windows)
(if window (if window
(-any? (lambda (w) (eq window w)) narf-popup-windows) (-any? (lambda (w) (eq window w)) narf-popup-windows)
@ -39,7 +40,7 @@
((eq major-mode 'messages-buffer-mode) ((eq major-mode 'messages-buffer-mode)
(bury-buffer) (bury-buffer)
(setq dont-kill t))) (setq dont-kill t)))
(narf--popup-remove window) (narf/popup-remove window)
(unless dont-kill (unless dont-kill
(let ((kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))) (let ((kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions)))
(kill-buffer (window-buffer window)))) (kill-buffer (window-buffer window))))

View file

@ -20,10 +20,6 @@ determine if a directory is a project."
(file-exists-p file))))) (file-exists-p file)))))
found-p)) found-p))
;;;###autoload
(defun narf/project-name (&optional root)
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
;;;###autoload ;;;###autoload
(defalias 'narf/project-p 'projectile-project-p) (defalias 'narf/project-p 'projectile-project-p)

View file

@ -13,9 +13,8 @@
;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t) ;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t)
(evil-define-command narf:build (arg) (evil-define-command narf:build (arg)
"Call a build command in the current directory. "Call a build command in the current directory. If ARG is nil this function calls
If ARG is nil this function calls `recompile', otherwise it calls `recompile', otherwise it calls `compile' passing ARG as build command."
`compile' passing ARG as build command."
(interactive "<sh>") (interactive "<sh>")
(when (null narf--build-command) (when (null narf--build-command)
(user-error "No build command was set")) (user-error "No build command was set"))
@ -34,6 +33,7 @@ If ARG is nil this function calls `recompile', otherwise it calls
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;; ;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t) ;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t)
(evil-define-command narf:eval-buffer () (evil-define-command narf:eval-buffer ()
"Evaluate the whole buffer."
:move-point nil :repeat nil :move-point nil :repeat nil
(interactive) (interactive)
(cond ((eq major-mode 'emacs-lisp-mode) (cond ((eq major-mode 'emacs-lisp-mode)
@ -42,26 +42,27 @@ If ARG is nil this function calls `recompile', otherwise it calls
;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t) ;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t)
(evil-define-operator narf:eval-region (beg end) (evil-define-operator narf:eval-region (beg end)
"Evaluate a region and, if large enough, prints its output to a popup buffer (if an
elisp buffer). Otherwise forward the region to Quickrun."
:move-point nil :repeat nil :move-point nil :repeat nil
(interactive "<r>") (interactive "<r>")
(cond ((eq major-mode 'emacs-lisp-mode) (cond ((eq major-mode 'emacs-lisp-mode)
(require 'pp) (require 'pp)
(let* ((pp-escape-newlines nil) (let* ((pp-escape-newlines nil)
(out (s-trim (pp-to-string (eval (read (buffer-substring-no-properties beg end)))))) (out (pp-to-string (eval (read (buffer-substring-no-properties beg end)))))
(lines (length (s-lines out)))) (lines (length (s-lines out))))
(if (< lines 5) (if (< lines 5)
(princ out t) (princ out t)
(let ((buf (get-buffer-create "*eval*"))) (with-current-buffer (get-buffer-create "*eval*")
(with-current-buffer buf ;; (rename-buffer (buffer-name old-buf))
(read-only-mode -1) (read-only-mode -1)
(emacs-lisp-mode)
(setq-local scroll-margin 0) (setq-local scroll-margin 0)
(emacs-lisp-mode)
(erase-buffer) (erase-buffer)
(insert out) (insert out)
(goto-char (point-min))
(read-only-mode 1) (read-only-mode 1)
(narf|hide-mode-line) (goto-char (point-min))
(narf/popup-buffer buf)))))) (narf/popup-buffer (current-buffer))))))
(t (quickrun-region beg end)))) (t (quickrun-region beg end))))
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t) ;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t)

View file

@ -62,8 +62,7 @@ end file."
(start (or start (point-min)))) (start (or start (point-min))))
(goto-char start) (goto-char start)
(while (and (re-search-forward "^$" end-marker t) (not (>= (point) end-marker))) (while (and (re-search-forward "^$" end-marker t) (not (>= (point) end-marker)))
(let (line-start line-end (let (line-start line-end next-start next-end)
next-start next-end)
(save-excursion (save-excursion
;; Check previous line indent ;; Check previous line indent
(forward-line -1) (forward-line -1)
@ -79,7 +78,7 @@ end file."
(let* ((line-indent (- line-end line-start)) (let* ((line-indent (- line-end line-start))
(next-indent (- next-end next-start)) (next-indent (- next-end next-start))
(indent (min line-indent next-indent))) (indent (min line-indent next-indent)))
(insert (make-string indent ? ))))) (insert (make-string (if (zerop indent) 0 (1+ indent)) ? )))))
(forward-line 1))))) (forward-line 1)))))
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
nil) nil)
@ -93,5 +92,9 @@ end file."
(imenu-list-minor-mode -1)))) (imenu-list-minor-mode -1))))
(narf/get-visible-buffers (narf/get-real-buffers)))) (narf/get-visible-buffers (narf/get-real-buffers))))
;;;###autoload
(defun narf|hide-mode-line (&rest _)
(setq mode-line-format nil))
(provide 'defuns-ui) (provide 'defuns-ui)
;;; defuns-ui.el ends here ;;; defuns-ui.el ends here

View file

@ -8,7 +8,11 @@
;;;###autoload ;;;###autoload
(defun narf/wg-projectile-switch-project () (defun narf/wg-projectile-switch-project ()
(narf:workgroup-new nil (file-name-nondirectory (directory-file-name (narf/project-root))) t)) (let ((project-root (narf/project-root)))
(narf:workgroup-new nil (file-name-nondirectory (directory-file-name project-root)) t)
(narf|update-scratch-buffer-cwd project-root)
(when (featurep 'neotree)
(neotree-projectile-action))))
;;;###autoload (autoload 'narf:save-session "defuns-workgroup" nil t) ;;;###autoload (autoload 'narf:save-session "defuns-workgroup" nil t)
(evil-define-command narf:save-session (&optional bang session-name) (evil-define-command narf:save-session (&optional bang session-name)

View file

@ -2,9 +2,11 @@
;; for ../core-company.el ;; for ../core-company.el
;;;###autoload ;;;###autoload
(defmacro define-company-backend! (hook backends) (defmacro def-company-backend! (hooks backends)
"Register a company backend for a mode." "Register a company backend for a mode."
(let ((def-name (intern (format "narf--init-company-%s" hook))) (let* ((hooks (if (listp hooks) hooks (list hooks)))
(def-name (intern (format "narf--init-company-%s"
(s-join "-" (mapcar 'symbol-name hooks)))))
(quoted (eq (car-safe backends) 'quote))) (quoted (eq (car-safe backends) 'quote)))
`(progn `(progn
(defun ,def-name () (defun ,def-name ()
@ -15,7 +17,7 @@
(intern (format "company-%s" backend)))) (intern (format "company-%s" backend))))
(if quoted (cadr backends) backends)))) (if quoted (cadr backends) backends))))
company-backends))) company-backends)))
(add-hook ',(intern (format "%s-hook" hook)) ',def-name)))) (add-hook! ,hooks ',def-name))))
(provide 'macros-company) (provide 'macros-company)
;;; macros-company.el ends here ;;; macros-company.el ends here

View file

@ -1,7 +1,7 @@
;;; macros-evil.el ;;; macros-evil.el
;;;###autoload ;;;###autoload
(defmacro define-text-object! (key start-regex end-regex) (defmacro def-textobj! (key start-regex end-regex)
(let ((inner-name (make-symbol "narf--inner-name")) (let ((inner-name (make-symbol "narf--inner-name"))
(outer-name (make-symbol "narf--outer-name"))) (outer-name (make-symbol "narf--outer-name")))
`(progn `(progn
@ -13,7 +13,7 @@
(define-key evil-outer-text-objects-map ,key (quote ,outer-name))))) (define-key evil-outer-text-objects-map ,key (quote ,outer-name)))))
;;;###autoload ;;;###autoload
(defmacro define-temp-ex-cmd! (cmd-on cmd-off &rest commands) (defmacro def-tmp-excmd! (cmd-on cmd-off &rest commands)
"Creates on-off defuns for a set of ex commands, named CMD-ON and CMD-OFF." "Creates on-off defuns for a set of ex commands, named CMD-ON and CMD-OFF."
(declare (indent 2)) (declare (indent 2))
`(progn `(progn

View file

@ -1,7 +1,7 @@
;;; macros-quickrun.el ;;; macros-quickrun.el
;;;###autoload ;;;###autoload
(defmacro define-builder! (mode command &optional build-file) (defmacro def-builder! (mode command &optional build-file)
"Register major/minor MODE with build COMMAND. If FILES are provided, do an "Register major/minor MODE with build COMMAND. If FILES are provided, do an
additional check to make sure they exist in the project root." additional check to make sure they exist in the project root."
`(add-hook! ,mode `(add-hook! ,mode
@ -10,7 +10,7 @@ additional check to make sure they exist in the project root."
(setq narf--build-command '(,command . ,build-file))))) (setq narf--build-command '(,command . ,build-file)))))
;;;###autoload ;;;###autoload
(defmacro define-repl! (mode command) (defmacro def-repl! (mode command)
`(push '(,mode . ,command) rtog/mode-repl-alist)) `(push '(,mode . ,command) rtog/mode-repl-alist))
(provide 'macros-quickrun) (provide 'macros-quickrun)

View file

@ -1,12 +1,12 @@
;;; defuns-spaceline.el ;;; defuns-spaceline.el
;;;###autoload ;;;###autoload
(defmacro define-env-command! (mode command) (defmacro def-env-command! (mode command)
"Define a COMMAND for MODE that will set `narf--env-command' when that mode is "Define a COMMAND for MODE that will set `narf--env-command' when that mode is
activated, which should return the version number of the current environment. It is used activated, which should return the version number of the current environment. It is used
by `narf|spaceline-env-update' to display a version number in the modeline. For instance: by `narf|spaceline-env-update' to display a version number in the modeline. For instance:
(define-env-command! ruby-mode \"ruby --version | cut -d' ' -f2\") (def-env-command! ruby-mode \"ruby --version | cut -d' ' -f2\")
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
first time." first time."

View file

@ -2,15 +2,14 @@
;; for ../core-yasnippet.el ;; for ../core-yasnippet.el
;;;###autoload ;;;###autoload
(defmacro add-yas-minor-mode! (mode) (defmacro def-yas-mode! (mode)
"Register minor MODES in yasnippet." "Register minor MODES in yasnippet."
`(after! yasnippet `(after! yasnippet
(when (boundp 'yas--extra-modes) (when (boundp 'yas--extra-modes)
(add-hook ',(intern (concat (symbol-name (cadr mode)) "-hook")) (add-hook! ,mode
(lambda ()
(if (symbol-value ,mode) (if (symbol-value ,mode)
(yas-activate-extra-mode ,mode) (yas-activate-extra-mode ,mode)
(yas-deactivate-extra-mode ,mode))))))) (yas-deactivate-extra-mode ,mode))))))
(provide 'macros-yasnippet) (provide 'macros-yasnippet)
;;; macros-yasnippet.el ends here ;;; macros-yasnippet.el ends here

View file

@ -25,7 +25,7 @@ csharp:
js: js:
@echo "Installing js2-mode dependencies" @echo "Installing js2-mode dependencies"
npm -g install web-beautify trepanjs npm -g install trepanjs tern
sh: sh:
@echo "Installing zsh/bash dependencies" @echo "Installing zsh/bash dependencies"

27
init.el
View file

@ -46,29 +46,34 @@
(defconst narf-default-theme 'narf-dark) (defconst narf-default-theme 'narf-dark)
(defconst narf-default-font (font-spec :family "Hack" :size 12)) (defconst narf-default-font (font-spec :family "Hack" :size 12))
(narf '(core ; core/core.el (narf `(core ; core/core.el
;; OS-specific config
,(cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32))
;; The heart of NARF ;; The heart of NARF
core-popup ; taming sudden and inevitable windows core-popup ; taming sudden and inevitable windows
core-ui ; draw me like one of your French editors core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies core-evil ; come to the dark side, we have cookies
core-editor ; filling the editor-shaped hole in the emacs OS core-editor ; filling the editor-shaped hole in the emacs OS
core-completion ; for the lazy typist core-company ; for the lazy typist
core-yasnippet ; for the lazier typist core-yasnippet ; for the lazier typist
core-file-templates ; for the laziest typist core-file-templates ; for the laziest typist
core-flycheck ; code police; tazing you for every semicolon you forget core-flycheck ; code police; tazing you for every semicolon you forget
core-project ; whose project am I in? core-project ; whose project am I in?
core-vcs ; remember remember, that commit in November core-vcs ; remember remember, that commit in November
core-helm ; a search engine for life and love core-helm ; a search engine for life and love
core-eval ; run code, run.
core-debug ; emacs as a universal debugger
core-sessions ; cure Emacs alzheimers + tab emulation core-sessions ; cure Emacs alzheimers + tab emulation
core-eval ; run code, run; debugging too
;; Environments ;; Environments
module-apple ; Applescript, Swift, Launchbar, iOS, wallet syphons, etc. module-apple ; Applescript, Swift, Launchbar, iOS, wallet syphons, etc.
module-cc ; C/C++/obj-c madness module-cc ; C/C++/obj-c madness
module-crystal ; ruby at the speed of c module-crystal ; ruby at the speed of c
module-csharp ; unity, .NET, and mono shenanigans module-csharp ; unity, .NET, and mono shenanigans
module-data ; config and data formats
module-go ; the hipster dialect module-go ; the hipster dialect
module-haskell ; a language that's lazier than I am module-haskell ; a language that's lazier than I am
module-java ; the poster child for carpal tunnel syndome module-java ; the poster child for carpal tunnel syndome
@ -76,26 +81,26 @@
module-julia ; MATLAB, but fast module-julia ; MATLAB, but fast
module-lisp ; drowning in parentheses module-lisp ; drowning in parentheses
module-lua ; one-based indices? one-based indices. module-lua ; one-based indices? one-based indices.
module-org ; for organized fearless leader
module-php ; making php less painful to work with module-php ; making php less painful to work with
module-processing ; pretty prototypes module-processing ; pretty prototypes
module-python ; beautiful is better than ugly module-python ; beautiful is better than ugly
module-ruby ; 1.step do {|i| p "Ruby is #{i&1==0?'love':'life'}"} module-ruby ; 1.step do {|i| p "Ruby is #{i&1==0?'love':'life'}"}
module-rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() module-rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
module-sh ; she sells Z-shells by the C XOR module-sh ; she sells Z-shells by the C XOR
module-text ; writing docs for people to ignore module-text ; writing docs for people to ignore + latex
module-web ; #big-bang::before { content: ""; } module-web ; #big-bang::before { content: ""; }
;; Experimental ;; Experimental
;;module-eshell ; for inferior OSes *cough*windows ;;module-eshell ; for inferior OSes *cough*windows
;; Organizational/Notes
;;module-org ; for organized fearless leader
;;module-write ; for writing papers and fiction in Emacs
;; Extra libraries ;; Extra libraries
extra-tmux ; closing the rift between GUI & terminal
extra-demo ; allow me to demonstrate...
extra-ansible ; extra-ansible ;
extra-demo ; allow me to demonstrate...
extra-tags ; if you liked it you should've generated a tag for it
extra-text ; break in case of word documents from clients
extra-tmux ; closing the rift between GUI & terminal
extra-write ; for writing papers and fiction in Emacs
;; Customization ;; Customization
my-bindings my-bindings

View file

@ -9,6 +9,19 @@
'+ '+
'++)))) '++))))
;;;###autoload
(defun narf/c-lineup-arglist (orig-fun &rest args)
"Improve indentation of continued C++11 lambda function opened as argument."
(if (and (eq major-mode 'c++-mode)
(ignore-errors
(save-excursion
(goto-char (c-langelem-pos langelem))
;; Detect "[...](" or "[...]{". preceded by "," or "(",
;; and with unclosed brace.
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
0 ; no additional indent
(apply orig-fun args)))
;;;###autoload ;;;###autoload
(defun narf|init-c/c++-settings () (defun narf|init-c/c++-settings ()
(when (memq major-mode '(c-mode c++-mode objc-mode)) (when (memq major-mode '(c-mode c++-mode objc-mode))

View file

@ -1,12 +1,12 @@
;;; extra-ansible.el ;;; extra-ansible.el
(define-project-type! ansible-mode "ans" (def-project-type! ansible-mode "ans"
:modes (yaml-mode) :modes (yaml-mode)
:files ("roles/")) :files ("roles/"))
(use-package company-ansible (use-package company-ansible
:commands (company-ansible) :commands (company-ansible)
:init (define-company-backend! ansible-mode (ansible))) :init (def-company-backend! ansible-mode (ansible)))
(provide 'extra-ansible) (provide 'extra-ansible)
;;; module-ansible.el ends here ;;; module-ansible.el ends here

View file

@ -3,15 +3,17 @@
;; This library offers: ;; This library offers:
;; + impatient-mode: for broadcasting my emacs session ;; + impatient-mode: for broadcasting my emacs session
;; + big-mode: for enlarged text while screencasting ;; + big-mode: for enlarged text while screencasting
;; + integration with reveal.js for presentations ;; + TODO integration with reveal.js for presentations
;; + TODO peer programming collab
(defvar powerline-height)
;; Big-mode settings ;; Big-mode settings
(defconst big-mode-font (font-spec :family "Hack" :size 16)) (defconst big-mode-font (font-spec :family "Hack" :size 16))
(defconst big-mode-line-spacing 0) (defconst big-mode-line-spacing 0)
(defconst big-mode-modeline-height 26) (defconst big-mode-modeline-height 30)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
(use-package impatient-mode (use-package impatient-mode
:defer t :defer t
:commands httpd-start) :commands httpd-start)

10
modules/extra-text.el Normal file
View file

@ -0,0 +1,10 @@
;;; extra-text.el
;; TODO
(evil-define-operator narf/html-encode (beg end)
"HTML encode the selected region."
(interactive "<r>")
(shell-command-on-region beg end "sort" nil t))
(provide 'extra-text)
;;; extra-text.el ends here

View file

@ -1,10 +1,8 @@
;;; extra-tmux.el ;;; extra-tmux.el
;; This library offers: ;; This library offers:
;; + TODO An integration/abstraction layer to make it seem like tmux and emacs are one ;; + A way of communicating with a tmux instance
;; program. ;; + TODO A way to manage tmuxifier from emacs
;; + TODO A way to manage tmux sessions and layouts from emacs; possibly trigger them
;; depending on current project.
;;;###autoload ;;;###autoload
(defun tmux (command &optional modes) (defun tmux (command &optional modes)

View file

@ -1,4 +1,4 @@
;; module-write.el ;; extra-write.el
;; This library offers the following: ;; This library offers the following:
;; + Write-mode: a mode that turns Emacs into an app for writing notes, papers, or ;; + Write-mode: a mode that turns Emacs into an app for writing notes, papers, or
@ -14,14 +14,7 @@
(defconst write-mode--last-mode-line mode-line-format) (defconst write-mode--last-mode-line mode-line-format)
(defconst write-mode--last-line-spacing line-spacing) (defconst write-mode--last-line-spacing line-spacing)
;; (defvar write-mode-org-font-lock-keywords ;;
;; `(("[-+*] \\[X\\] \\([^$\n\r]+\\)"
;; (1 'org-headline-done))
;; ("^ *\\([-+]\\|[0-9]+[).]\\)\\( \\)+[^$\n\r]"
;; (1 'org-list-bullet))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq-default visual-fill-column-center-text nil (setq-default visual-fill-column-center-text nil
visual-fill-column-width 80) visual-fill-column-width 80)
@ -93,43 +86,6 @@ functionality with buffer-local ones, which can be buggy in a minor-mode."
(visual-fill-column--adjust-window)))) (visual-fill-column--adjust-window))))
(apply fn window args)))) (apply fn window args))))
;;; LaTeX
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq bibtex-dialect 'biblatex)
(setq bibtex-align-at-equal-sign t)
(setq bibtex-text-indentation 20)
(add-hook! bibtex-mode
(local-set-key (kbd "C-c \\") 'bibtex-fill-entry)
(setq fill-column 140))
(add-hook! latex-mode 'turn-on-auto-fill)
(add-hook! LaTeX-mode 'turn-on-auto-fill)
(use-package reftex (provide 'extra-write)
:config ;;; extra-write.el ends here
(add-hook 'latex-mode-hook 'turn-on-reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t
reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref")
reftex-default-bibliography
`(,(expand-file-name "phys.bib" write-mode-biblio-dir))))
;;; Bibtex
;; NOTE: http://bibdesk.sourceforge.net/
(use-package helm-bibtex
:defer t
:config
(setq helm-bibtex-bibliography
`(,(expand-file-name "phys.bib" write-mode-biblio-dir))
helm-bibtex-library-path
`(,(expand-file-name "phys-pdf" write-mode-biblio-dir))
helm-bibtex-notes-path (expand-file-name "notes" write-mode-biblio-dir)
helm-bibtex-notes-extension ".org"
helm-bibtex-pdf-open-function
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))
(provide 'module-write)
;;; module-write.el ends here

View file

@ -7,7 +7,7 @@
;; LaunchBar: https://www.obdev.at/products/launchbar ;; LaunchBar: https://www.obdev.at/products/launchbar
;; ;;
(define-project-type! lb6 "lb6" (def-project-type! lb6 "lb6"
:match "\\.lb\\(action\\|ext\\)/.+$" :match "\\.lb\\(action\\|ext\\)/.+$"
:build (lambda () :build (lambda ()
(awhen (f-traverse-upwards (lambda (f) (f-ext? f "lbaction"))) (awhen (f-traverse-upwards (lambda (f) (f-ext? f "lbaction")))
@ -21,12 +21,14 @@
;; TODO Set up emacs task runners for fruitstrap ;; TODO Set up emacs task runners for fruitstrap
(use-package swift-mode (use-package swift-mode
:mode "\\.swift$" :mode "\\.swift$"
:init (add-hook 'swift-mode-hook 'flycheck-mode) :init
(def-company-backend! swift-mode (sourcekit yasnippet))
(add-hook 'swift-mode-hook 'flycheck-mode)
:config :config
(after! flycheck (push 'swift flycheck-checkers)) (push 'swift flycheck-checkers))
(require 'company-sourcekit) (use-package company-sourcekit
(define-company-backend! swift-mode (sourcekit yasnippet))) :after swift-mode)
(provide 'module-apple) (provide 'module-apple)
;;; module-apple.el ends here ;;; module-apple.el ends here

View file

@ -1,61 +1,13 @@
;;; module-cc.el --- C, C++, and Objective-C ;;; module-cc.el --- C, C++, and Objective-C
(use-package cmake-mode
:mode "CMakeLists\\.txt$"
:config
(require 'company-cmake)
(define-company-backend! cmake-mode (cmake yasnippet)))
(use-package glsl-mode :mode ("\\.glsl\\'" "\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))
(use-package cuda-mode :mode "\\.cuh?$")
(use-package cc-mode (use-package cc-mode
:defines (c-syntactic-context)
:functions (c-toggle-electric-state c-toggle-auto-newline
c-skip-comments-and-strings c-forward-sws c-end-of-macro
c-font-lock-invalid-string csharp-log c-font-lock-declarators
c-get-lang-constant c-forward-keyword-clause
c-fontify-recorded-types-and-refs c-forward-type imenu--split
c-backward-sws c-determine-limit c-beginning-of-decl-1)
:commands (c-mode c++-mode objc-mode java-mode) :commands (c-mode c++-mode objc-mode java-mode)
:init :init
(associate! objc-mode :match "\\.mm$") (associate! objc-mode :match "\\.mm$")
(def-electric! (c-mode c++-mode objc-mode) :chars (?\n ?\}))
(def-company-backend! (c-mode c++-mode objc-mode) (irony-c-headers irony))
(add-hook! 'c++-mode-hook '(highlight-numbers-mode narf|init-c++-C11-highlights))
(add-hook 'c-initialization-hook 'narf|init-c/c++-settings) (add-hook 'c-initialization-hook 'narf|init-c/c++-settings)
(add-hook 'c++-mode-hook 'highlight-numbers-mode)
(add-hook 'c++-mode-hook 'narf|init-c++-C11-highlights)
:config
(setq c-tab-always-indent nil
c-electric-flag nil)
(map! :map c-mode-base-map
(:localleader :nv ";" 'narf/append-semicolon))
(define-text-object! "<" "<" ">")
(sp-local-pair '(c-mode c++-mode) "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p))
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
;; Doxygen blocks
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
(add-hook! (c-mode c++-mode objc-mode)
(electric-indent-local-mode +1)
(setq electric-indent-chars '(?\n ?})))
;; C/C++
(advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist)
(defun narf/c-lineup-arglist (orig-fun &rest args)
"Improve indentation of continued C++11 lambda function opened as argument."
(if (and (eq major-mode 'c++-mode)
(ignore-errors
(save-excursion
(goto-char (c-langelem-pos langelem))
;; Detect "[...](" or "[...]{". preceded by "," or "(",
;; and with unclosed brace.
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
0 ; no additional indent
(apply orig-fun args)))
;; C++ header files ;; C++ header files
(push `(,(lambda () (and (f-ext? buffer-file-name "h") (push `(,(lambda () (and (f-ext? buffer-file-name "h")
@ -71,21 +23,34 @@
. objc-mode) . objc-mode)
magic-mode-alist) magic-mode-alist)
:config
(setq c-tab-always-indent nil
c-electric-flag nil)
(map! :map c-mode-base-map (:localleader :nv ";" 'narf/append-semicolon))
(def-textobj! "<" "<" ">")
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
(sp-local-pair "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p))
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
;; Doxygen blocks
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
;; Improve indentation of inline lambdas in C++11
(advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist))
(use-package irony (use-package irony
:after cc-mode
:config :config
(setq irony-server-install-prefix (concat narf-temp-dir "/irony/")) (setq irony-server-install-prefix (concat narf-temp-dir "/irony/"))
(push "-std=c++11" irony-additional-clang-options) (push "-std=c++11" irony-additional-clang-options)
(require 'irony-eldoc) (require 'irony-eldoc)
(require 'flycheck-irony)
(flycheck-irony-setup)
(require 'company-irony) (require 'company-irony)
(require 'company-irony-c-headers) (require 'company-irony-c-headers)
(define-company-backend! c-mode (irony-c-headers irony)) (require 'flycheck-irony)
(define-company-backend! c++-mode (irony-c-headers irony)) (flycheck-irony-setup)
(define-company-backend! objc-mode (irony-c-headers irony))
;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode) ;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode)
(add-hook! (c-mode c++-mode ojbc-mode) (add-hook! (c-mode c++-mode ojbc-mode)
@ -93,7 +58,19 @@
(flycheck-mode +1) (flycheck-mode +1)
(irony-mode +1) (irony-mode +1)
(eldoc-mode +1) (eldoc-mode +1)
(irony-eldoc +1))))) (irony-eldoc +1))))
(use-package disaster :commands (disaster))
;;
(use-package cmake-mode
:mode "CMakeLists\\.txt$"
:init (def-company-backend! cmake-mode (cmake yasnippet)))
(use-package company-cmake :after cmake-mode)
(use-package glsl-mode :mode ("\\.glsl\\'" "\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))
(use-package cuda-mode :mode "\\.cuh?$")
(provide 'module-cc) (provide 'module-cc)
;;; module-cc.el ends here ;;; module-cc.el ends here

View file

@ -1,12 +1,10 @@
;;; module-csharp.el ;;; module-csharp.el
(use-package csharp-mode (use-package csharp-mode
:functions (csharp-log)
:mode "\\.cs$" :mode "\\.cs$"
:init (add-hook 'csharp-mode-hook 'flycheck-mode)) :init (add-hook 'csharp-mode-hook 'flycheck-mode))
;; unity shaders (use-package shader-mode :mode "\\.shader$") ; unity shaders
(use-package shader-mode :mode "\\.shader$")
(use-package omnisharp (use-package omnisharp
:commands (omnisharp-mode) :commands (omnisharp-mode)
@ -15,7 +13,8 @@
omnisharp-server-executable-path (concat narf-ext-dir "/OmniSharp.exe")) omnisharp-server-executable-path (concat narf-ext-dir "/OmniSharp.exe"))
:when (file-exists-p omnisharp-server-executable-path) :when (file-exists-p omnisharp-server-executable-path)
:init :init
(add-hook! csharp-mode '(emr-initialize omnisharp-mode)) (def-company-backend! csharp-mode (omnisharp))
(add-hook! csharp-mode '(turn-on-eldoc-mode emr-initialize omnisharp-mode))
:config :config
(map! :map omnisharp-mode-map (map! :map omnisharp-mode-map
"gd" 'omnisharp-go-to-definition "gd" 'omnisharp-go-to-definition
@ -24,9 +23,6 @@
"ts" (λ! (omnisharp-unit-test "single")) "ts" (λ! (omnisharp-unit-test "single"))
"ta" (λ! (omnisharp-unit-test "all")))) "ta" (λ! (omnisharp-unit-test "all"))))
(define-company-backend! csharp-mode (omnisharp))
(add-hook! csharp-mode 'turn-on-eldoc-mode)
;; Map all refactor commands (see emr) ;; Map all refactor commands (see emr)
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))

View file

@ -1,17 +1,24 @@
;;; module-go.el ;;; module-go.el
(use-package gorepl-mode :commands (gorepl-run gorepl-run-load-current-file))
(use-package go-mode (use-package go-mode
:mode "\\.go$" :mode "\\.go$"
:interpreter "go" :interpreter "go"
:init :init
(add-hook! go-mode '(emr-initialize flycheck-mode)) (def-builder! go-mode "go build")
(define-builder! go-mode "go build") (def-company-backend! go-mode (go yasnippet))
(define-repl! go-mode gorepl-run) (def-repl! go-mode gorepl-run)
(add-hook! go-mode '(emr-initialize flycheck-mode go-eldoc-setup))
:config :config
(after! emr (map! :map go-mode-map
:n "gd" 'godef-jump
:n "gD" 'godef-describe
(:localleader
:n "p" 'helm-go-package
:n "tr" 'narf:go-test-run-all
:n "ta" 'narf:go-test-run-all
:n "ts" 'narf:go-test-run-package))
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))
(title (cadr x)) (title (cadr x))
@ -26,23 +33,13 @@
'((go-remove-unused-imports "Remove unushed imports" nil) '((go-remove-unused-imports "Remove unushed imports" nil)
(gofmt "Format code" nil)))) (gofmt "Format code" nil))))
(after! helm (use-package go-eldoc :after go-mode)
(use-package helm-go-package :defer t))
(require 'go-eldoc) (use-package company-go :after go-mode)
(add-hook 'go-mode-hook 'go-eldoc-setup)
(require 'company-go) (use-package gorepl-mode :commands (gorepl-run gorepl-run-load-current-file))
(define-company-backend! go-mode (go yasnippet))
(map! :map go-mode-map (use-package helm-go-package :commands helm-go-package)
:n "gd" 'godef-jump
:n "gD" 'godef-describe
(:localleader
:n "p" 'helm-go-package
:n "tr" 'narf:go-test-run-all
:n "ta" 'narf:go-test-run-all
:n "ts" 'narf:go-test-run-package)))
(provide 'module-go) (provide 'module-go)
;;; module-go.el ends here ;;; module-go.el ends here

View file

@ -7,14 +7,13 @@
:interpreter (("runghc" . haskell-mode) :interpreter (("runghc" . haskell-mode)
("runhaskell" . haskell-mode)) ("runhaskell" . haskell-mode))
:init :init
(define-repl! haskell-mode switch-to-haskell) (def-repl! haskell-mode switch-to-haskell)
(add-hook! haskell-mode '(interactive-haskell-mode flycheck-mode)) (add-hook! haskell-mode '(interactive-haskell-mode flycheck-mode))
:config :config
(push ".hi" completion-ignored-extensions)) (push ".hi" completion-ignored-extensions))
(use-package inf-haskell (use-package inf-haskell
:commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell) :commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell)
:init (evil-set-initial-state 'inferior-haskell-mode 'emacs)
:config :config
(map! :map inf-haskell-mode-map "ESC ESC" 'narf/popup-close)) (map! :map inf-haskell-mode-map "ESC ESC" 'narf/popup-close))

View file

@ -1,15 +1,15 @@
;;; module-java.el --- the poster child for carpal tunnel ;;; module-java.el --- the poster child for carpal tunnel
(define-docset! java-mode "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc") (def-docset! java-mode "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")
(use-package eclim (use-package eclim
:functions (eclim--project-dir eclim--project-name) :functions (eclim--project-dir eclim--project-name)
:commands (eclim-mode global-eclim-mode) :commands (eclim-mode global-eclim-mode)
:init :preface
(setq eclim-eclipse-dirs '("/Applications/eclipse") (setq eclim-eclipse-dirs '("/Applications/eclipse")
eclim-executable "/Applications/eclipse/eclim") eclim-executable "/Applications/eclipse/eclim")
(when (file-exists-p eclim-executable) :when (file-exists-p eclim-executable)
(add-hook 'java-mode-hook 'eclim-mode)) :init (add-hook 'java-mode-hook 'eclim-mode)
:config :config
;; (require 'eclim-ant) ;; (require 'eclim-ant)
;; (require 'eclim-maven) ;; (require 'eclim-maven)
@ -20,25 +20,24 @@
(setq help-at-pt-timer-delay 0.1) (setq help-at-pt-timer-delay 0.1)
(help-at-pt-set-timer) (help-at-pt-set-timer)
(use-package company-emacs-eclim
:functions company-emacs-eclim-setup
:config (company-emacs-eclim-setup))
(map! :map java-mode-map :m "gd" 'eclim-java-find-declaration)) (map! :map java-mode-map :m "gd" 'eclim-java-find-declaration))
(use-package company-emacs-eclim
:after eclim
:config (company-emacs-eclim-setup))
(use-package android-mode (use-package android-mode
:commands android-mode :commands android-mode
:init :init
(after! company-dict (add-to-list 'company-dict-minor-mode-list 'android-mode)) (def-yas-mode! 'android-mode)
(add-hook! (java-mode groovy-mode nxml-mode) 'narf|android-mode-enable-maybe) (add-hook! (java-mode groovy-mode nxml-mode) 'narf|android-mode-enable-maybe)
(add-hook! android-mode (add-yas-minor-mode! 'android-mode))) :config
(after! company-dict
(push 'android-mode company-dict-minor-mode-list)))
(use-package groovy-mode (use-package groovy-mode :mode "\\.g\\(radle\\|vy\\|roovy\\)$")
:functions (is-groovy-mode)
:mode "\\.g\\(radle\\|vy\\|roovy\\)$")
(use-package scala-mode2 (use-package scala-mode2 :mode ("\\.s\\(cala\\|bt\\)$" . scala-mode))
:mode ("\\.s\\(cala\\|bt\\)$" . scala-mode))
(provide 'module-java) (provide 'module-java)
;;; module-java.el ends here ;;; module-java.el ends here

View file

@ -4,15 +4,11 @@
:mode "\\.js$" :mode "\\.js$"
:interpreter "node" :interpreter "node"
:init :init
(add-hook 'js2-mode-hook '(tern-mode emr-initialize)) (def-repl! js2-mode nodejs-repl)
(define-repl! js2-mode nodejs-repl) (def-docset! js2-mode "js,javascript,nodejs,angularjs,express,jquery,mongoose")
(define-docset! js2-mode "js,javascript,nodejs,angularjs,express,jquery,mongoose") (def-company-backend! js2-mode (tern))
(define-company-backend! js2-mode (tern)) (def-electric! js2-mode :chars (?\} ?\) ?.) :words ("||" "&&"))
(add-hook! js2-mode '(tern-mode emr-initialize))
(add-hook! js2-mode
(electric-indent-local-mode +1)
(setq electric-indent-chars '(?} ?\) ?.)
narf-electric-indent-words '("||" "&&")))
:config :config
(setq-default (setq-default
@ -25,17 +21,21 @@
;; Launchbar API ;; Launchbar API
"LaunchBar" "File" "Action" "HTTP" "include" "Lib")) "LaunchBar" "File" "Action" "HTTP" "include" "Lib"))
(require 'tern)
(require 'company-tern)
;; [pedantry intensifies] ;; [pedantry intensifies]
(defadvice js2-mode (after js2-mode-rename-modeline activate) (add-hook! js2-mode (setq mode-name "JS2"))
(setq mode-name "JS2"))
(map! :map js2-mode-map (:localleader :nv ";" 'narf/append-semicolon)) (map! :map js2-mode-map (:localleader :nv ";" 'narf/append-semicolon)))
(require 'js2-refactor) (use-package tern
(require 'emr) :after js2-mode
:commands (tern-mode))
(use-package company-tern
:after tern)
(use-package js2-refactor
:after js2-mode
:config
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))
(title (cadr x)) (title (cadr x))
@ -75,6 +75,9 @@
(forward-slurp "forward slurp" nil) (forward-slurp "forward slurp" nil)
(forward-barf "forward barf" nil)))) (forward-barf "forward barf" nil))))
(use-package nodejs-repl :commands (nodejs-repl))
;;
(use-package jsx-mode :mode "\\.jsx$") (use-package jsx-mode :mode "\\.jsx$")
(use-package unityjs-mode (use-package unityjs-mode
@ -85,25 +88,21 @@
:mode "\\.coffee$" :mode "\\.coffee$"
:config (setq-default coffee-indent-like-python-mode t)) :config (setq-default coffee-indent-like-python-mode t))
(use-package nodejs-repl
:commands (nodejs-repl)
:config (evil-set-initial-state 'nodejs-repl-mode 'emacs))
;; ;;
(define-project-type! nodejs "node" (def-project-type! nodejs "node"
:modes (web-mode js-mode js2-mode json-mode coffee-mode scss-mode sass-mode less-css-mode) :modes (web-mode js-mode js2-mode json-mode coffee-mode scss-mode sass-mode less-css-mode)
:files ("package.json")) :files ("package.json"))
(define-project-type! angularjs "angular" (def-project-type! angularjs "angular"
:modes (web-mode js-mode js2-mode json-mode coffee-mode scss-mode sass-mode less-css-mode) :modes (web-mode js-mode js2-mode json-mode coffee-mode scss-mode sass-mode less-css-mode)
:files ("public/libraries/angular/")) :files ("public/libraries/angular/"))
(define-project-type! electron "electron" (def-project-type! electron "electron"
:modes (nodejs-project-mode) :modes (nodejs-project-mode)
:files ("app/index.html" "app/main.js")) :files ("app/index.html" "app/main.js"))
;; TODO electron-compile support ;; TODO electron-compile support
(define-project-type! expressjs "express" (def-project-type! expressjs "express"
:modes (nodejs-project-mode) :modes (nodejs-project-mode)
:files ("node_modules/express/")) :files ("node_modules/express/"))

View file

@ -3,10 +3,7 @@
(use-package julia-mode (use-package julia-mode
:mode "\\.jl$" :mode "\\.jl$"
:interpreter "julia" :interpreter "julia"
:init :init (def-repl! julia-mode narf/julia-repl))
(define-repl! julia-mode narf/julia-repl)
(evil-set-initial-state 'inferior-julia-mode 'emacs)
(push '(julia-mode julia-indent-offset) editorconfig-indentation-alist))
(provide 'module-julia) (provide 'module-julia)
;;; module-julia.el ends here ;;; module-julia.el ends here

View file

@ -1,18 +1,30 @@
;;; module-lisp --- all things lisp ;;; module-lisp --- all things lisp
(add-hook! emacs-lisp-mode (associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$")
'(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode highlight-quoted-mode)) (def-company-backend! emacs-lisp-mode (elisp yasnippet))
(def-repl! emacs-lisp-mode narf/elisp-inf-ielm)
;; Pop-up REPL
(define-repl! emacs-lisp-mode narf/elisp-inf-ielm)
(use-package highlight-quoted :commands (highlight-quoted-mode))
;; 'Emacs Lisp' is too long [pedantry intensifies]
(defadvice emacs-lisp-mode (after emacs-lisp-mode-rename-modeline activate)
(setq mode-name "Elisp"))
(add-hook! emacs-lisp-mode (add-hook! emacs-lisp-mode
'(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode))
;; Real go-to-definition for elisp
(map! :map emacs-lisp-mode-map :m "gd" 'narf/elisp-find-function-at-pt)
(use-package highlight-quoted
:commands (highlight-quoted-mode)
:init (add-hook 'emacs-lisp-mode-hook 'highlight-quoted-mode))
(use-package slime :defer t
:config (setq inferior-lisp-program "clisp"))
;; Don't affect lisp indentation (only `tab-width')
(setq editorconfig-indentation-alist
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
editorconfig-indentation-alist))
(add-hook! emacs-lisp-mode
(setq mode-name "Elisp") ; [pedantry intensifies]
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
(add-hook 'after-save-hook 'narf/elisp-auto-compile nil t) (add-hook 'after-save-hook 'narf/elisp-auto-compile nil t)
@ -56,16 +68,18 @@
'emacs-lisp-mode `(("(\\(lambda\\)" 'emacs-lisp-mode `(("(\\(lambda\\)"
(1 (narf/show-as ))) (1 (narf/show-as )))
;; Highlight narf macros (macros are fontified in emacs 25+) ;; Highlight narf macros (macros are fontified in emacs 25+)
(,(concat
"(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend"
"builder" "repl" "textobj" "tmp-excmd"
"repeat" "yas-mode" "env-command" "docset"))
"!\\)")
(1 font-lock-keyword-face append))
(,(concat (,(concat
"(\\(" "(\\("
(regexp-opt '("λ" "in" "map" "after" "exmap" "shut-up" "add-hook" (regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "open-with" "define-repl" "associate" "open-with" "define-org-link"
"define-builder" "narf-space-setup" "define-org-section"))
"define-env-command" "define-text-object"
"add-yas-minor-mode" "define-docset"
"define-org-link" "define-company-backend"
"define-org-section" "define-temp-ex-cmd"
"define-project-type"))
"!\\)") "!\\)")
(1 font-lock-keyword-face append)) (1 font-lock-keyword-face append))
;; Ert ;; Ert
@ -77,19 +91,14 @@
(2 font-lock-function-name-face)))) (2 font-lock-function-name-face))))
;; ;;
(use-package slime :defer t (def-project-type! emacs-ert "ert"
:config (setq inferior-lisp-program "clisp"))
;; Real go-to-definition for elisp
(map! :map emacs-lisp-mode-map :m "gd" 'narf/elisp-find-function-at-pt)
(define-project-type! emacs-ert "ert"
:modes (emacs-lisp-mode) :modes (emacs-lisp-mode)
:match "/test/.+-test\\.el$" :match "/test/.+-test\\.el$"
:bind (:localleader :bind (:localleader
:n "tr" 'narf/ert-rerun-test :n "tr" 'narf/ert-rerun-test
:n "ta" 'narf/ert-run-all-tests :n "ta" 'narf/ert-run-all-tests
:n "ts" 'narf/ert-run-test)) :n "ts" 'narf/ert-run-test)
(add-hook 'ert-results-mode-hook 'narf|hide-mode-line))
(provide 'module-lisp) (provide 'module-lisp)
;;; module-elisp.el ends here ;;; module-elisp.el ends here

View file

@ -4,12 +4,11 @@
:mode "\\.lua$" :mode "\\.lua$"
:interpreter "lua" :interpreter "lua"
:init :init
(define-repl! lua-mode narf/inf-lua) (def-company-backend! lua-mode (yasnippet))
(define-company-backend! lua-mode (yasnippet)) (def-electric! lua-mode :words ("else" "end"))
(def-repl! lua-mode narf/inf-lua)
(add-hook 'lua-mode-hook 'flycheck-mode) (add-hook 'lua-mode-hook 'flycheck-mode)
(add-hook! lua-mode
(electric-indent-local-mode +1)
(setq narf-electric-indent-words '("else" "end")))
:config :config
(sp-with-modes '(lua-mode) (sp-with-modes '(lua-mode)
;; disable defaults ;; disable defaults
@ -28,12 +27,12 @@
(sp-local-pair "function " " end" :unless '(sp-point-after-bol-p)))) (sp-local-pair "function " " end" :unless '(sp-point-after-bol-p))))
;; ;;
(define-project-type! love "" (def-project-type! love ""
:modes (lua-mode markdown-mode json-mode) :modes (lua-mode markdown-mode json-mode)
:files ("main.lua" "conf.lua") :files ("main.lua" "conf.lua")
:build ("open -a love.app '%s'" "main.lua")) :build ("open -a love.app '%s'" "main.lua"))
(define-project-type! hammerspoon "hammer" (def-project-type! hammerspoon "hammer"
:modes (lua-mode markdown-mode) :modes (lua-mode markdown-mode)
:match "/\\.?hammerspoon/.+\\.lua$" :match "/\\.?hammerspoon/.+\\.lua$"
:build "open hammerspoon://reload") :build "open hammerspoon://reload")

View file

@ -2,26 +2,42 @@
(use-package hack-mode (use-package hack-mode
:mode "\\.hh$" :mode "\\.hh$"
:config (define-company-backend! hack-mode (capf))) :init (def-company-backend! hack-mode (capf)))
(use-package php-mode (use-package php-mode
:mode ("\\.php[s345]?$" "\\.inc$" ) :mode ("\\.php[s345]?$" "\\.inc$" )
:interpreter "php" :interpreter "php"
:init :init
(define-docset! php-mode "php,laravel") (def-repl! php-mode php-boris)
(define-company-backend! php-mode '(php-extras-company)) (def-docset! php-mode "php,laravel")
(def-company-backend! php-mode '(company-ac-php-backend php-extras-company))
(add-hook 'php-mode-hook 'flycheck-mode) (add-hook 'php-mode-hook 'flycheck-mode)
(setq php-template-compatibility nil (setq php-template-compatibility nil
php-extras-eldoc-functions-file (concat narf-temp-dir "/php-extras-eldoc-functions")) php-extras-eldoc-functions-file (concat narf-temp-dir "/php-extras-eldoc-functions"))
:config
(require 'php-extras)
(defun php-extras-company-setup ()) ;; company will set up itself
:config
(map! :map php-mode-map (:localleader :nv ";" 'narf/append-semicolon))
(sp-with-modes '(php-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "<? " " ?>")
(sp-local-pair "<?php " " ?>")
(sp-local-pair "<?=" " ?>")
(sp-local-pair "<?" "?>" :when '(("RET")) :post-handlers '("||\n[i]"))
(sp-local-pair "<?php" "?>" :when '(("RET")) :post-handlers '("||\n[i]"))))
(use-package ac-php-company
:after php-mode
:config
(map! :map php-mode-map (map! :map php-mode-map
(:localleader :nv ";" 'narf/append-semicolon)
:n "gd" 'ac-php-find-symbol-at-point :n "gd" 'ac-php-find-symbol-at-point
:n "gD" 'ac-php-location-stack-back) :n "gD" 'ac-php-location-stack-back))
(use-package php-extras
:after php-mode
:config
(defun php-extras-company-setup ()) ;; company will set up itself
;; Generate php-extras documentation and completion asynchronously ;; Generate php-extras documentation and completion asynchronously
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el")) (unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
@ -31,18 +47,10 @@
(php-extras-generate-eldoc-1 t)) (php-extras-generate-eldoc-1 t))
(lambda (_) (lambda (_)
(load (concat php-extras-eldoc-functions-file ".el")) (load (concat php-extras-eldoc-functions-file ".el"))
(message "PHP eldoc updated!")))) (message "PHP eldoc updated!")))))
(sp-with-modes '(php-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "<? " " ?>")
(sp-local-pair "<?php " " ?>")
(sp-local-pair "<?=" " ?>")
(sp-local-pair "<?" "?>" :when '(("RET")) :post-handlers '("||\n[i]"))
(sp-local-pair "<?php" "?>" :when '(("RET")) :post-handlers '("||\n[i]")))
(use-package php-refactor-mode (use-package php-refactor-mode
:after php-mode
:init (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)) :init (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode))
:config :config
(mapc (lambda (x) (mapc (lambda (x)
@ -59,15 +67,12 @@
'((convert-local-to-instance-variable "convert local var to instance var" nil) '((convert-local-to-instance-variable "convert local var to instance var" nil)
(optimize-use "optimize FQNs in file" nil) (optimize-use "optimize FQNs in file" nil)
(extract-method "extract method" t) (extract-method "extract method" t)
(rename-local-variable "rename local variable" nil))))) (rename-local-variable "rename local variable" nil))))
;; PHP Repl (use-package php-boris :commands php-boris) ; PHP REPL
(use-package php-boris :defer t
:init (define-repl! php-mode php-boris)
:config (evil-set-initial-state 'php-boris-mode 'emacs))
;; ;;
(define-project-type! laravel "laravel" (def-project-type! laravel "laravel"
:modes (php-mode yaml-mode web-mode nxml-mode js2-mode scss-mode) :modes (php-mode yaml-mode web-mode nxml-mode js2-mode scss-mode)
:files ("artisan" "server.php")) :files ("artisan" "server.php"))

View file

@ -5,7 +5,7 @@
:commands (processing-mode processing-find-sketch) :commands (processing-mode processing-find-sketch)
:mode "\\.pde$" :mode "\\.pde$"
:init :init
(define-builder! processing-mode processing-sketch-build) (def-builder! processing-mode processing-sketch-build)
(add-hook 'processing-compilation-mode-hook 'narf|hide-mode-line) (add-hook 'processing-compilation-mode-hook 'narf|hide-mode-line)
:config :config
@ -14,14 +14,6 @@
processing-sketchbook-dir "~/Dropbox/work/pde" processing-sketchbook-dir "~/Dropbox/work/pde"
processing-output-dir "/tmp") processing-output-dir "/tmp")
(after! quickrun
(quickrun-add-command
"processing" `((:command . ,processing-location)
(:exec . (lambda () (format "--sketch=%s --output=%s --force --run"
(narf/project-root) processing-output-dir)))
(:description . "Run Processing sketch"))
:mode 'processing-mode))
(map! :map processing-mode-map (map! :map processing-mode-map
:nv "M-r" 'processing-sketch-run :nv "M-r" 'processing-sketch-run
:m "gd" 'processing-find-in-reference :m "gd" 'processing-find-in-reference
@ -32,6 +24,14 @@
"e" 'processing-open-examples "e" 'processing-open-examples
"o" 'processing-open-sketchbook)) "o" 'processing-open-sketchbook))
(after! quickrun
(quickrun-add-command
"processing" `((:command . ,processing-location)
(:exec . (lambda () (format "--sketch=%s --output=%s --force --run"
(narf/project-root) processing-output-dir)))
(:description . "Run Processing sketch"))
:mode 'processing-mode))
(add-hook! processing-mode (add-hook! processing-mode
(setq-local company-backends '((company-keywords (setq-local company-backends '((company-keywords
:with :with

View file

@ -17,15 +17,17 @@
python-shell-completion-string-code python-shell-completion-string-code
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n") "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(define-docset! python-mode "py,py3,python") (def-company-backend! python-mode (anaconda))
(define-env-command! python-mode "python --version 2>&1 | cut -d' ' -f2") (def-docset! python-mode "py,py3,python")
(define-repl! python-mode narf/inf-python) (def-env-command! python-mode "python --version 2>&1 | cut -d' ' -f2")
(add-hook! python-mode '(emr-initialize narf|flycheck-enable-maybe)) (def-repl! python-mode narf/inf-python)
(add-hook 'python-mode-hook 'flycheck-mode)
:config :config
(define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens (define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
(use-package anaconda-mode (use-package anaconda-mode
:after python
:init :init
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode)) (add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
(setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/") (setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/")
@ -35,11 +37,12 @@
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions) (map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit) (map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
(advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer) (advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer))
(require 'company-anaconda) (use-package company-anaconda
(define-company-backend! python-mode (anaconda)) :after anaconda-mode
(after! emr :init (add-hook 'anaconda-mode-hook 'emr-initialize)
:config
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))
(title (cadr x)) (title (cadr x))
@ -54,18 +57,19 @@
(find-assignments "find assignments" t) (find-assignments "find assignments" t)
(find-definitions "find definitions" t) (find-definitions "find definitions" t)
(find-file "find assignments" t) (find-file "find assignments" t)
(find-references "show usages" nil)))))) (find-references "show usages" nil))))
(use-package pip-requirements (use-package pip-requirements
:mode ("/requirements.txt$" . pip-requirements-mode) :mode ("/requirements.txt$" . pip-requirements-mode)
:config (define-company-backend! pip-requirements-mode (capf))) :config (def-company-backend! pip-requirements-mode (capf)))
(use-package nose (use-package nose
:commands nose-mode :commands nose-mode
:preface (defvar nose-mode-map (make-sparse-keymap)) :preface (defvar nose-mode-map (make-sparse-keymap))
:init (associate! nose-mode :match "/test_.+\\.py$" :in (python-mode)) :init
(associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
(def-yas-mode! 'nose-mode)
:config :config
(add-yas-minor-mode! 'nose-mode)
(map! :map nose-mode-map (map! :map nose-mode-map
(:localleader (:localleader
:n "tr" 'nosetests-again :n "tr" 'nosetests-again

View file

@ -5,39 +5,24 @@
"/\\(Gem\\|Cap\\|Vagrant\\|Rake\\)file$") "/\\(Gem\\|Cap\\|Vagrant\\|Rake\\)file$")
:interpreter "ruby" :interpreter "ruby"
:init :init
(add-hook 'ruby-mode-hook 'flycheck-mode) (def-builder! ruby-mode "rake %s" "Rakefile")
(define-docset! ruby-mode "rb,ruby,rubygem") (def-company-backend! ruby-mode (dabbrev-code))
(define-builder! ruby-mode "rake %s" "Rakefile") (def-docset! ruby-mode "rb,ruby,rubygem")
(define-env-command! ruby-mode "ruby --version | cut -d' ' -f2") (def-env-command! ruby-mode "ruby --version | cut -d' ' -f2")
(define-company-backend! ruby-mode (dabbrev-code)) (def-repl! ruby-mode inf-ruby)
(def-electric! ruby-mode :words ("else" "end" "elseif"))
(add-hook! 'ruby-mode-hook '(flycheck-mode yard-mode))
:config :config
(setq ruby-deep-indent-paren t) ; Formatting (setq ruby-deep-indent-paren t) ; Formatting
(add-hook! ruby-mode
(electric-indent-local-mode +1)
(setq narf-electric-indent-words '("else" "end" "elseif")))
;; Don't interfere with my custom RET behavior ;; Don't interfere with my custom RET behavior
(define-key ruby-mode-map [?\n] nil) (define-key ruby-mode-map [?\n] nil))
;; Highlight doc comments
(use-package yard-mode :init (add-hook 'ruby-mode-hook 'yard-mode))
;; FIXME: Doesn't work
;; (use-package robe
;; :commands (robe-mode robe-start ruby-load-file company-robe)
;; :init
;; (add-hook! ruby-mode
;; (narf|ruby-load-file)
;; (add-hook 'after-save-hook 'narf|ruby-load-file nil t))
;; (define-company-backend! ruby-mode (robe))
;; :config
;; (require 'company-robe))
(use-package ruby-refactor (use-package ruby-refactor
:after ruby-mode
:init (add-hook 'ruby-mode-hook 'emr-initialize) :init (add-hook 'ruby-mode-hook 'emr-initialize)
:config :config
(require 'emr)
(mapc (lambda (x) (mapc (lambda (x)
(let ((command-name (car x)) (let ((command-name (car x))
(title (cadr x)) (title (cadr x))
@ -55,7 +40,10 @@
(refactor-extract-constant "extract constant" t) (refactor-extract-constant "extract constant" t)
(refactor-add-parameter "add parameter" nil) (refactor-add-parameter "add parameter" nil)
(refactor-extract-to-let "extract to let" t) (refactor-extract-to-let "extract to let" t)
(refactor-convert-post-conditional "convert post conditional" t))))) (refactor-convert-post-conditional "convert post conditional" t))))
;; Highlight doc comments
(use-package yard-mode :commands yard-mode)
(use-package rspec-mode (use-package rspec-mode
:mode ("/\\.rspec$" . text-mode) :mode ("/\\.rspec$" . text-mode)
@ -80,19 +68,13 @@
(use-package inf-ruby (use-package inf-ruby
:commands (inf-ruby inf-ruby-console-auto) :commands (inf-ruby inf-ruby-console-auto)
:init :init (def-company-backend! inf-ruby-mode (inf-ruby)))
(define-repl! ruby-mode inf-ruby)
(evil-set-initial-state 'inf-ruby-mode 'emacs) (use-package company-inf-ruby :after inf-ruby)
:config
(require 'company-inf-ruby)
(define-company-backend! inf-ruby-mode (inf-ruby)))
;; ;;
(define-project-type! rake "rake" (def-project-type! rake "rake"
:files ("Rakefile")) :files ("Rakefile"))
(define-project-type! vagrant "vagrant"
:files ("Vagrantfile"))
(provide 'module-ruby) (provide 'module-ruby)
;;; module-ruby.el ends here ;;; module-ruby.el ends here

View file

@ -2,25 +2,25 @@
(use-package rust-mode (use-package rust-mode
:mode "\\.rs$" :mode "\\.rs$"
:config :init
(define-builder! rust-mode "cargo run" "Cargo.toml") (def-builder! rust-mode "cargo run" "Cargo.toml")
(define-builder! toml-mode "cargo run" "Cargo.toml") (def-builder! toml-mode "cargo run" "Cargo.toml")
(add-hook 'rust-mode-hook 'flycheck-mode))
(require 'flycheck-rust) (use-package flycheck-rust :after rust-mode)
(add-hook 'rust-mode-hook 'flycheck-mode)
(use-package racer (use-package racer
:after rust-mode
:preface :preface
(setq racer-cmd (concat narf-ext-dir "/racer") (setq racer-cmd (concat narf-ext-dir "/racer")
racer-rust-src-path (concat narf-ext-dir "/rust/src/")) racer-rust-src-path (concat narf-ext-dir "/rust/src/"))
:when (file-exists-p racer-cmd) :when (file-exists-p racer-cmd)
:init
(add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
:config :config
(define-company-backend! rust-mode (racer))
(map! :map rust-mode-map :m "gd" 'racer-find-definition)
;; TODO Unit test keybinds ;; TODO Unit test keybinds
(def-company-backend! rust-mode (racer))
(add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup)))) (map! :map rust-mode-map :m "gd" 'racer-find-definition))
(provide 'module-rust) (provide 'module-rust)
;;; module-rust.el ends here ;;; module-rust.el ends here

View file

@ -3,20 +3,17 @@
(associate! sh-mode :match "\\.\\(ba\\|z\\)sh$") (associate! sh-mode :match "\\.\\(ba\\|z\\)sh$")
(associate! sh-mode :match "/\\.?z\\(sh\\(/.*\\|$\\)\\|profile\\|login\\|logout\\|shrc\\|shenv\\)$") (associate! sh-mode :match "/\\.?z\\(sh\\(/.*\\|$\\)\\|profile\\|login\\|logout\\|shrc\\|shenv\\)$")
(associate! sh-mode :match "/\\.?bash\\(/.*\\|rc\\|_profile\\)$") (associate! sh-mode :match "/\\.?bash\\(/.*\\|rc\\|_profile\\)$")
(after! sh-script (def-electric! sh-mode :words ("else" "elif" "fi" "done"))
(define-repl! sh-mode narf/inf-shell)
(after! sh-script
(def-repl! sh-mode narf/inf-shell)
(setq sh-indent-after-continuation 'always) (setq sh-indent-after-continuation 'always)
(add-hook 'sh-mode-hook 'flycheck-mode)
(add-hook 'sh-mode-hook 'narf|sh-extra-font-lock-activate) ; Fontify variables in strings
(add-hook! sh-mode (setq mode-name "sh")) ; [pedantry intensifies] (add-hook! sh-mode (setq mode-name "sh")) ; [pedantry intensifies]
(add-hook! sh-mode (add-hook! sh-mode
(electric-indent-local-mode +1) '(flycheck-mode
(setq narf-electric-indent-words '("else" "elif" "fi" "done"))) ;; Fontify variables in strings
narf|sh-extra-font-lock-activate))
(require 'company-shell)
(setq company-shell-delete-duplicates t)
(sp-with-modes '(sh-mode) (sp-with-modes '(sh-mode)
(sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
@ -25,5 +22,9 @@
(sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)) (sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
(sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert)))) (sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))))
(use-package company-shell
:after sh-script
:config (setq company-shell-delete-duplicates t))
(provide 'module-sh) (provide 'module-sh)
;;; module-sh.el ends here ;;; module-sh.el ends here

View file

@ -2,8 +2,7 @@
(use-package markdown-mode (use-package markdown-mode
:mode ("\\.md$" "/README$") :mode ("\\.md$" "/README$")
:init :init (add-hook 'markdown-mode-hook 'turn-on-auto-fill)
(add-hook 'markdown-mode-hook 'turn-on-auto-fill)
:config :config
(map! :map markdown-mode-map (map! :map markdown-mode-map
"<backspace>" nil "<backspace>" nil
@ -28,9 +27,45 @@
:n "[p" 'markdown-promote :n "[p" 'markdown-promote
:n "]p" 'markdown-demote :n "]p" 'markdown-demote
:i "M--" 'markdown-insert-hr) :i "M--" 'markdown-insert-hr))
(use-package markdown-toc :commands (markdown-toc-generate-toc))) (use-package markdown-toc :after markdown-mode)
(use-package reftex
:config
(add-hook 'latex-mode-hook 'turn-on-reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t
reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref")
reftex-default-bibliography
`(,(expand-file-name "phys.bib" write-mode-biblio-dir))))
(use-package helm-bibtex
:defer t
:init
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq bibtex-dialect 'biblatex)
(setq bibtex-align-at-equal-sign t)
(setq bibtex-text-indentation 20)
(add-hook! bibtex-mode
(local-set-key (kbd "C-c \\") 'bibtex-fill-entry)
(setq fill-column 140))
(add-hook! latex-mode 'turn-on-auto-fill)
(add-hook! LaTeX-mode 'turn-on-auto-fill)
:config
(setq helm-bibtex-bibliography
`(,(expand-file-name "phys.bib" write-mode-biblio-dir))
helm-bibtex-library-path
`(,(expand-file-name "phys-pdf" write-mode-biblio-dir))
helm-bibtex-notes-path (expand-file-name "notes" write-mode-biblio-dir)
helm-bibtex-notes-extension ".org"
helm-bibtex-pdf-open-function
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))
(provide 'module-text) (provide 'module-text)
;;; module-text.el ends here ;;; module-text.el ends here

View file

@ -1,8 +1,8 @@
;;; module-web.el ;;; module-web.el
(define-company-backend! sass-mode (css)) (def-company-backend! sass-mode (css))
(define-company-backend! scss-mode (css)) (def-company-backend! scss-mode (css))
(define-docset! scss-mode "sass,bourbon") (def-docset! scss-mode "sass,bourbon")
(add-hook! (sass-mode scss-mode less-css-mode) (add-hook! (sass-mode scss-mode less-css-mode)
'(flycheck-mode narf|hl-line-off hs-minor-mode)) '(flycheck-mode narf|hl-line-off hs-minor-mode))
@ -34,9 +34,6 @@
:n ";" 'helm-css-scss :n ";" 'helm-css-scss
:n ":" 'helm-css-scss-multi)) :n ":" 'helm-css-scss-multi))
(after! web-beautify
(map! :map scss-mode-map :m "gQ" 'web-beautify-css))
(after! emr (after! emr
(emr-declare-command 'narf/scss-toggle-inline-or-block (emr-declare-command 'narf/scss-toggle-inline-or-block
:title "toggle inline/block" :title "toggle inline/block"
@ -44,21 +41,29 @@
:predicate (lambda () (not (use-region-p)))))) :predicate (lambda () (not (use-region-p))))))
(use-package jaded-mode (use-package jaded-mode
:load-path "/Volumes/hlissner/Dropbox/work/plugins/jaded-mode"
:mode "\\.jade$" :mode "\\.jade$"
:config :config
(push '("jade" "html") projectile-other-file-alist)
(map! :map jaded-mode-map (map! :map jaded-mode-map
:i [tab] 'narf/dumb-indent :i [tab] 'narf/dumb-indent
:i [backtab] 'narf/dumb-dedent)) :i [backtab] 'narf/dumb-dedent))
(use-package web-mode (use-package web-mode
:mode ("\\.\\(p\\)?htm\\(l\\)?$" :mode ("\\.p?html?$"
"\\.\\(tpl\\|blade\\)\\(\\.php\\)?$" "\\.\\(tpl\\|blade\\)\\(\\.php\\)?$"
"\\.erb$" "\\.erb$"
"\\.as[cp]x$"
"\\.mustache$"
"wp-content/themes/.+/.+\\.php$") "wp-content/themes/.+/.+\\.php$")
:init :init
(add-hook 'web-mode-hook 'turn-off-smartparens-mode) (add-hook 'web-mode-hook 'turn-off-smartparens-mode)
:config :config
(setq web-mode-enable-html-entities-fontification t
web-mode-enable-current-column-highlight t)
(push '("html" "jade") projectile-other-file-alist)
(map! :map web-mode-map :i "SPC" 'self-insert-command) (map! :map web-mode-map :i "SPC" 'self-insert-command)
(after! nlinum (after! nlinum
@ -67,12 +72,11 @@
(map! :map web-mode-map (map! :map web-mode-map
"M-/" 'web-mode-comment-or-uncomment "M-/" 'web-mode-comment-or-uncomment
:n "M-r" 'narf/web-refresh-browser
:n "za" 'web-mode-fold-or-unfold :n "za" 'web-mode-fold-or-unfold
(:localleader :n "t" 'web-mode-element-rename) (:localleader :n "t" 'web-mode-element-rename)
:n "M-r" 'narf/web-refresh-browser
:nv "]a" 'web-mode-attribute-next :nv "]a" 'web-mode-attribute-next
:nv "[a" 'web-mode-attribute-previous :nv "[a" 'web-mode-attribute-previous
:nv "]t" 'web-mode-tag-next :nv "]t" 'web-mode-tag-next
@ -81,15 +85,6 @@
:nv "[T" 'web-mode-element-parent)) :nv "[T" 'web-mode-element-parent))
;; ;;
(use-package web-beautify
:commands (web-beautify-js web-beautify-css web-beautify-html)
:init
(add-hook! (web-mode css-mode scss-mode sass-mode less-css-mode js2-mode)
(setenv "jsbeautify_indent_size" (int-to-string tab-width)))
(map! (:after web-mode :map web-mode-map :m "gQ" 'web-beautify-html)
(:after css-mode :map css-mode-map :m "gQ" 'web-beautify-css)
(:after js2-mode :map js2-mode-map :m "gQ" 'web-beautify-js)))
(use-package emmet-mode (use-package emmet-mode
:commands (emmet-mode) :commands (emmet-mode)
:init :init
@ -103,7 +98,7 @@
:i "M-E" 'emmet-expand-line)) :i "M-E" 'emmet-expand-line))
;; ;;
(define-project-type! jekyll ":{" (def-project-type! jekyll ":{"
:modes (web-mode scss-mode html-mode markdown-mode yaml-mode) :modes (web-mode scss-mode html-mode markdown-mode yaml-mode)
:match "/\\(\\(css\\|_\\(layouts\\|posts\\|sass\\)\\)/.+\\|.+.html\\)$" :match "/\\(\\(css\\|_\\(layouts\\|posts\\|sass\\)\\)/.+\\|.+.html\\)$"
:files ("config.yml" "_layouts/") :files ("config.yml" "_layouts/")
@ -111,7 +106,7 @@
(when (eq major-mode 'web-mode) (when (eq major-mode 'web-mode)
(web-mode-set-engine "django")))) (web-mode-set-engine "django"))))
(define-project-type! wordpress "wp" (def-project-type! wordpress "wp"
:modes (php-mode web-mode css-mode scss-mode sass-mode) :modes (php-mode web-mode css-mode scss-mode sass-mode)
:match "/wp-\\(\\(content\\|admin\\|includes\\)/\\)?.+$" :match "/wp-\\(\\(content\\|admin\\|includes\\)/\\)?.+$"
:files ("wp-config.php" "wp-content/")) :files ("wp-config.php" "wp-content/"))