mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
Clean slate, so I can add my rewritten config
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "el-get/el-get"]
|
||||
path = el-get/el-get
|
||||
url = https://github.com/dimitri/el-get.git
|
||||
|
||||
85
README.md
85
README.md
@@ -1,85 +0,0 @@
|
||||
# My .emacs.d Config Folder
|
||||
|
||||
This is my personal Emacs configuration. Having been primarily a TextMate user
|
||||
previously, my setup might also work nicely for other TM users who are curious
|
||||
about Emacs.
|
||||
|
||||
That said, this is not some form of an Emacs starter kit, it's simply my
|
||||
personal config with any quirks, oddities, bugs, and man-eating errors I live
|
||||
with on a daily basis.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
My config uses Emacs 24's new package system, and also the awesome [el-get][]
|
||||
package manager. The latest stable version of Emacs is currently 23, so you'll
|
||||
need to get ahold of a nightly build.
|
||||
|
||||
[el-get]: https://github.com/dimitri/el-get
|
||||
|
||||
|
||||
### Mac OS X
|
||||
|
||||
Personally I compile my own build of Emacs for Mac OS X using a custom build
|
||||
script I wrote: [build-emacs-for-osx][]
|
||||
|
||||
[build-emacs-for-osx]: https://github.com/jimeh/build-emacs-for-osx
|
||||
|
||||
Or if you prefer to not compile it yourself, and you can live without
|
||||
full-screen and the sRGB patch, you can download the latest nightly from:
|
||||
[emacsformacosx.com][].
|
||||
|
||||
[emacsformacosx.com]: http://emacsformacosx.com/builds
|
||||
|
||||
|
||||
### Linux, Windows
|
||||
|
||||
I'm afraid you'll have to figure out how to get Emacs 24 yourself. Like I
|
||||
said, this is not a starter kit.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Simply clone my config repo to `~/.emacs.d` update git submodules, and launch
|
||||
Emacs:
|
||||
|
||||
git clone git://github.com/jimeh/.emacs.d.git ~/.emacs.d
|
||||
cd ~/.emacs.d
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
Once you launch Emacs, it'll load in the config and the list of packages to
|
||||
use, automatically installing any packages which are not installed. This means
|
||||
your first launch can take as long as 5-10 minutes, and also display some
|
||||
ruby-related errors. On subsequent launches it's fast and error free.
|
||||
|
||||
*Remember how I said you'll have to live with the bugs too if you wanna use my
|
||||
config? ;)*
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
* Feel free to fork and tweak :)
|
||||
* Theme-wise I use a slightly tweaked version of [Joe Bergantine][]'s [Birds of
|
||||
Paradise][] theme, which I've made available [here][my-theme]. The original
|
||||
Emacs port was created by Paul M. Rodriguez, and I can't remember or find
|
||||
where I got it from originally, so I posted it to [this][ori-theme] Gist.
|
||||
* I've customized keyboard shortcuts a decent bit, which you can overview in
|
||||
[keybindings.el][].
|
||||
* Flyspell is set to use `aspell` instead of the default `ispell` command.
|
||||
* Most language specific tweaks are in the respective files in the
|
||||
[languages][] folder.
|
||||
* There's a lot of stuff in here, dig through the config files manually :)
|
||||
|
||||
[Joe Bergantine]: http://joebergantine.com/
|
||||
[Birds of Paradise]: http://joebergantine.com/werkstatt/birds-of-paradise
|
||||
[my-theme]: https://github.com/jimeh/birds-of-paradise-plus-theme.el
|
||||
[ori-theme]: https://gist.github.com/1130343
|
||||
[keybindings.el]: https://github.com/jimeh/.emacs.d/blob/master/keybindings.el
|
||||
[languages]: https://github.com/jimeh/.emacs.d/tree/master/languages
|
||||
|
||||
|
||||
## Todo ##
|
||||
|
||||
* Improve ReadMe.
|
||||
* Come up with more todos.
|
||||
36
aliases.el
36
aliases.el
@@ -1,36 +0,0 @@
|
||||
;;
|
||||
;; Setup a few global command aliases
|
||||
;;
|
||||
|
||||
;; Text Manipulation
|
||||
(defalias 'rs 'replace-string)
|
||||
(defalias 'qr 'query-replace-regexp)
|
||||
(defalias 'al 'align-regexp)
|
||||
(defalias 'sl 'sort-lines)
|
||||
(defalias 'rr 'reverse-region)
|
||||
(defalias 'wc 'whitespace-cleanup)
|
||||
(defalias 'rw 'sp-rewrap-sexp)
|
||||
|
||||
(defalias 'lml 'list-matching-lines)
|
||||
(defalias 'dml 'delete-matching-lines)
|
||||
(defalias 'dnml 'delete-non-matching-lines)
|
||||
(defalias 'dtw 'delete-trailing-whitespace)
|
||||
|
||||
;; Buffer Manipulation
|
||||
(defalias 'rb 'revert-buffer)
|
||||
|
||||
;; Emacs Lisp
|
||||
(defalias 'eb 'eval-buffer)
|
||||
(defalias 'er 'eval-region)
|
||||
(defalias 'ed 'eval-defun)
|
||||
(defalias 'eis 'elisp-index-search)
|
||||
(defalias 'lf 'load-file)
|
||||
|
||||
;; Dired
|
||||
(defalias 'wd 'wdired-change-to-wdired-mode)
|
||||
|
||||
;; Modes
|
||||
(defalias 'sh 'shell-script-mode)
|
||||
|
||||
;; Magit
|
||||
(defalias 'bl 'magit-blame-mode)
|
||||
168
appearance.el
168
appearance.el
@@ -1,168 +0,0 @@
|
||||
;; Disable splash page
|
||||
(setq inhibit-startup-message t)
|
||||
|
||||
;; Set default font
|
||||
(if gui-window-system
|
||||
;;; Large
|
||||
;; (set-face-attribute 'default nil :family "Monaco" :height 110)
|
||||
;; (set-face-attribute 'default nil :family "Menlo" :height 110)
|
||||
|
||||
;;; Small
|
||||
(set-face-attribute 'default nil :family "Monaco" :height 100)
|
||||
;; (set-face-attribute 'default nil :family "Menlo" :height 100)
|
||||
;; (set-face-attribute 'default nil :family "Inconsolata" :height 120)
|
||||
)
|
||||
|
||||
;; Load Theme
|
||||
(if gui-window-system (require 'twilight-anti-bright-theme)
|
||||
(require 'tomorrow-night-paradise-theme))
|
||||
|
||||
;; Disable menu-bar
|
||||
(menu-bar-mode 0)
|
||||
|
||||
;; Disable toolbar
|
||||
(tool-bar-mode -1)
|
||||
|
||||
;; Disable Scrollbar
|
||||
(if gui-window-system (set-scroll-bar-mode 'nil))
|
||||
|
||||
;; Show matching parentheses
|
||||
(show-paren-mode t)
|
||||
|
||||
;; Show column number globally
|
||||
(column-number-mode t)
|
||||
|
||||
;; Highlight current line globally
|
||||
(global-hl-line-mode t)
|
||||
|
||||
;; Don't use OSX Native fullscreen mode
|
||||
(setq ns-use-native-fullscreen nil)
|
||||
|
||||
;; Customize line numbers - In gui mode the fringe is the spacer between line
|
||||
;; numbers and code, while in console mode we add an extra space for it.
|
||||
(if gui-window-system (setq linum+-dynamic-format " %%%dd")
|
||||
(setq linum+-dynamic-format " %%%dd "))
|
||||
|
||||
;; Linum+ resets linum-format to "smart" when it's loaded, hence we have to
|
||||
;; use a eval-after-load hook to set it to "dynamic".
|
||||
(eval-after-load "linum+" '(progn (setq linum-format 'dynamic)))
|
||||
|
||||
;; Enable git-gutter-fringe mode.
|
||||
(if gui-window-system
|
||||
(when (require 'git-gutter-fringe nil 'noerror)
|
||||
(global-git-gutter-mode)))
|
||||
|
||||
;; Display up to 20 results in when using grizzl completion.
|
||||
(when (require 'grizzl nil 'noerror)
|
||||
(setq *grizzl-read-max-results* 20))
|
||||
|
||||
;; Use ido completion in projectile.
|
||||
(setq projectile-completion-system 'ido)
|
||||
|
||||
;; Display ido results vertically, rather than horizontally.
|
||||
(when (require 'ido-vertical-mode nil 'noerror)
|
||||
(ido-vertical-mode 1))
|
||||
|
||||
;; meaningful names for buffers with the same name
|
||||
(require 'uniquify)
|
||||
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
|
||||
(setq uniquify-separator "/")
|
||||
(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
|
||||
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
|
||||
|
||||
;; Display whitespace characters globally
|
||||
(global-whitespace-mode t)
|
||||
|
||||
;; Customize Whitespace Characters
|
||||
;; - Newline: \u00AC = ¬
|
||||
;; - Tab: \u2192 = →
|
||||
;; \u00BB = »
|
||||
;; \u25B6 = ▶
|
||||
(setq whitespace-display-mappings
|
||||
(quote ((newline-mark ?\n [?\u00AC ?\n] [?$ ?\n])
|
||||
(tab-mark ?\t [?\u2192 ?\t] [?\u00BB ?\t] [?\\ ?\t]))))
|
||||
|
||||
(setq whitespace-style
|
||||
(quote (face tabs trailing space-before-tab newline
|
||||
indentation space-after-tab tab-mark newline-mark
|
||||
empty)))
|
||||
|
||||
;; Cursor
|
||||
(blink-cursor-mode t)
|
||||
(setq initial-frame-alist
|
||||
(cons '(cursor-type . bar) (copy-alist initial-frame-alist)))
|
||||
(setq default-frame-alist
|
||||
(cons '(cursor-type . bar) (copy-alist default-frame-alist)))
|
||||
|
||||
;; Transparency (via helpers.el)
|
||||
(setq transparency-level 99)
|
||||
(transparency-set-value transparency-level)
|
||||
(add-hook 'after-make-frame-functions
|
||||
(lambda (selected-frame)
|
||||
(set-frame-parameter selected-frame 'alpha transparency-level)))
|
||||
|
||||
(when (require 'diminish nil 'noerror)
|
||||
(diminish 'visual-line-mode)
|
||||
(eval-after-load "undo-tree" '(diminish 'undo-tree-mode))
|
||||
(eval-after-load "auto-complete" '(diminish 'auto-complete-mode))
|
||||
(eval-after-load "yasnippet" '(diminish 'yas-minor-mode))
|
||||
(eval-after-load "smartparens" '(diminish 'smartparens-mode))
|
||||
(eval-after-load "hs-minor-mode" '(diminish 'hs-minor-mode))
|
||||
(eval-after-load "git-gutter-mode" '(diminish 'git-gutter-mode))
|
||||
(eval-after-load "whitespace-mode" '(diminish 'whitespace-mode))
|
||||
(eval-after-load "textmate-mode" '(diminish 'textmate-mode)))
|
||||
|
||||
|
||||
;; Relative line numbers -- from: http://stackoverflow.com/a/6928112/42146
|
||||
;; (defvar my-linum-format-string "%3d ")
|
||||
;; ;; (add-hook 'linum-before-numbering-hook 'my-linum-get-format-string)
|
||||
;; (defun my-linum-get-format-string ()
|
||||
;; (let* ((width (1+ (length (number-to-string
|
||||
;; (count-lines (point-min) (point-max))))))
|
||||
;; (format (concat "%" (number-to-string width) "d")))
|
||||
;; (setq my-linum-format-string format)))
|
||||
;; (defvar my-linum-current-line-number 0)
|
||||
;; (setq linum-format 'my-linum-relative-line-numbers)
|
||||
;; (defun my-linum-relative-line-numbers (line-number)
|
||||
;; (let ((offset (abs(- line-number my-linum-current-line-number))))
|
||||
;; (propertize (format my-linum-format-string offset) 'face 'linum)))
|
||||
;; (defadvice linum-update (around my-linum-update)
|
||||
;; (let ((my-linum-current-line-number (line-number-at-pos)))
|
||||
;; ad-do-it))
|
||||
;; (ad-activate 'linum-update)
|
||||
|
||||
|
||||
;; Customize git-gutter-fringe glyphs.
|
||||
(when (and gui-window-system (require 'fringe-helper nil 'noerror))
|
||||
;; (setq-default left-fringe-width 20)
|
||||
;; (setq-default right-fringe-width 20)
|
||||
(fringe-helper-define 'git-gutter-fr:added nil
|
||||
"........"
|
||||
"........"
|
||||
"........"
|
||||
"...XX..."
|
||||
"...XX..."
|
||||
"........"
|
||||
"........"
|
||||
"........")
|
||||
|
||||
(fringe-helper-define 'git-gutter-fr:deleted nil
|
||||
"........"
|
||||
"........"
|
||||
"........"
|
||||
"...XX..."
|
||||
"...XX..."
|
||||
"........"
|
||||
"........"
|
||||
"........")
|
||||
|
||||
(fringe-helper-define 'git-gutter-fr:modified nil
|
||||
"........"
|
||||
"........"
|
||||
"........"
|
||||
"...XX..."
|
||||
"...XX..."
|
||||
"........"
|
||||
"........"
|
||||
"........")
|
||||
)
|
||||
103
behavior.el
103
behavior.el
@@ -1,103 +0,0 @@
|
||||
;; Default tab-width of 2 spaces
|
||||
(setq-default tab-width 2)
|
||||
|
||||
;; Electric behavior
|
||||
(electric-layout-mode t)
|
||||
|
||||
;; Always indent with spaces
|
||||
(setq-default indent-tabs-mode nil)
|
||||
|
||||
;; Answer yes/no questions by typing y/n
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Enable C-x C-l and C-x C-u for down/up-case conversions
|
||||
(put 'downcase-region 'disabled nil)
|
||||
(put 'upcase-region 'disabled nil)
|
||||
|
||||
;; Enable Projectile global mode.
|
||||
(when (require 'projectile nil 'noerror)
|
||||
(projectile-global-mode))
|
||||
|
||||
;; Popwin
|
||||
(when (require 'popwin nil 'noerror)
|
||||
(setq display-buffer-function 'popwin:display-buffer))
|
||||
|
||||
;; Recentf
|
||||
(require 'recentf)
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-menu-items 100)
|
||||
(setq recentf-exclude '("\\.git.*" "\\.hg.*" "\\.svn.*"))
|
||||
|
||||
;; Enable delete-selection-mode
|
||||
(delete-selection-mode t)
|
||||
|
||||
;; Disable ECB's pre-scanning for empty directories, as it for some reason
|
||||
;; kept trying scan files as if they were directories, causing constant error
|
||||
;; messages in the mini-buffer.
|
||||
(setq ecb-prescan-directories-for-emptyness nil)
|
||||
|
||||
;; Save places within files.
|
||||
(require 'saveplace)
|
||||
(setq save-place-file "~/.emacs.d/saved-places")
|
||||
(setq-default save-place t)
|
||||
|
||||
;; Use textmate-mode
|
||||
(when (require 'textmate nil 'noerror)
|
||||
(textmate-mode))
|
||||
|
||||
;; Highlight matching parenthesis
|
||||
(show-paren-mode 1)
|
||||
|
||||
;; Make sure all backup files only live in one place
|
||||
(setq backup-directory-alist '(("." . "~/.saves")))
|
||||
|
||||
;; Make re-builder easier to use
|
||||
(require 're-builder)
|
||||
(setq reb-re-syntax 'string)
|
||||
|
||||
;; smoother scrolling (less "jumpy" than defaults)
|
||||
(setq redisplay-dont-pause t
|
||||
mouse-wheel-scroll-amount '(1 ((shift) . 10)) ;; one line at a time
|
||||
mouse-wheel-follow-mouse 't ;; scroll window under mouse
|
||||
scroll-margin 4
|
||||
scroll-step 1
|
||||
scroll-conservatively 10000)
|
||||
|
||||
;; Enable mouse support when running in a console
|
||||
(unless window-system
|
||||
(xterm-mouse-mode 1)
|
||||
(global-set-key [mouse-4] 'scroll-down-line)
|
||||
(global-set-key [mouse-5] 'scroll-up-line))
|
||||
|
||||
;; Auto-complete when indenting.
|
||||
(defadvice indent-for-tab-command (around ac-before-indent activate)
|
||||
"Call `auto-complete' if text was recently entered"
|
||||
(if (ac-trigger-command-p last-command)
|
||||
(auto-complete)
|
||||
ad-do-it))
|
||||
|
||||
;; Scroll half a screen when using scroll-up and scroll-down functions.
|
||||
(defadvice scroll-up (around half-window activate)
|
||||
(setq next-screen-context-lines
|
||||
(max 1 (/ (1- (window-height (selected-window))) 2)))
|
||||
ad-do-it)
|
||||
|
||||
(defadvice scroll-down (around half-window activate)
|
||||
(setq next-screen-context-lines
|
||||
(max 1 (/ (1- (window-height (selected-window))) 2)))
|
||||
ad-do-it)
|
||||
|
||||
|
||||
;; Make Project Explorer open selected file in last used buffer
|
||||
(setq pe/display-content-buffer-function
|
||||
(lambda (buffer)
|
||||
(let* (( last-buffer
|
||||
(car (cl-remove 'project-explorer-mode
|
||||
(buffer-list)
|
||||
:key (apply-partially 'buffer-local-value
|
||||
'major-mode))))
|
||||
( window (get-buffer-window last-buffer)))
|
||||
(if window
|
||||
(set-window-buffer window buffer)
|
||||
(pe/show-buffer buffer)))
|
||||
))
|
||||
@@ -1,163 +0,0 @@
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(ac-auto-show-menu 0.2)
|
||||
'(ac-auto-start 3)
|
||||
'(ac-delay 0.05)
|
||||
'(ac-menu-height 15)
|
||||
'(ack-arguments
|
||||
(quote
|
||||
("--ignore-dir=vendor/ruby" "--ignore-dir=vendor/bundle" "--ignore-dir=coverage" "--ignore-dir=docs" "--ignore-dir=doc" "--type-add=js=.js,.js.erb" "--type-add=ruby=.jbuilder,.rabl" "--type-add=html=.haml,.hamlc,.jade" "--type-add=css=.sass,.scss,.styl" "--type-set=coffee=.coffee" "--type-set=cucumber=.feature")))
|
||||
'(ack-project-root-file-patterns
|
||||
(quote
|
||||
(".project\\'" ".xcodeproj\\'" ".sln\\'" "\\`Project.ede\\'" "\\`.git\\'" "\\`.bzr\\'" "\\`_darcs\\'" "\\`.hg\\'" "\\`Gemfile\\'" "\\`Rakefile\\'" "\\`Makefile\\'")))
|
||||
'(ack-prompt-for-directory (quote unless-guessed))
|
||||
'(aquamacs-additional-fontsets nil t)
|
||||
'(aquamacs-customization-version-id 211 t)
|
||||
'(aquamacs-tool-bar-user-customization nil t)
|
||||
'(column-number-mode t)
|
||||
'(display-time-24hr-format t)
|
||||
'(display-time-day-and-date nil)
|
||||
'(display-time-interval 10)
|
||||
'(display-time-load-average-threshold 1.0)
|
||||
'(display-time-mode t)
|
||||
'(ecb-basic-buffer-sync (quote (Info-mode dired-mode magit-mode)))
|
||||
'(ecb-create-layout-file "~/.emacs.d/ecb-user-layouts.el")
|
||||
'(ecb-layout-name "left13")
|
||||
'(ecb-options-version "2.40")
|
||||
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
|
||||
'(ecb-source-path
|
||||
(quote
|
||||
(("~/Projects" "Projects")
|
||||
("~/.emacs.d" ".emacs.d")
|
||||
("~/.dotfiles" ".dotfiles")
|
||||
("~/Projects/fitzdares" "fitzdares")
|
||||
("~/.go" ".go")
|
||||
("~/src" "src")
|
||||
("~/Sites" "Sites")
|
||||
("~" "~")
|
||||
("/" "/"))))
|
||||
'(ecb-tip-of-the-day nil)
|
||||
'(ecb-toggle-layout-sequence (quote ("left13" "left15")))
|
||||
'(ecb-tree-indent 3)
|
||||
'(ecb-tree-make-parent-node-sticky nil)
|
||||
'(ecb-windows-width 0.24)
|
||||
'(elscreen-display-tab t)
|
||||
'(elscreen-tab-display-control t)
|
||||
'(elscreen-tab-display-kill-screen nil)
|
||||
'(eproject-completing-read-function (quote eproject--ido-completing-read))
|
||||
'(evil-default-cursor (quote (t)))
|
||||
'(exec-path-from-shell-variables (quote ("PATH" "MANPATH" "GOPATH")))
|
||||
'(fci-handle-truncate-lines nil)
|
||||
'(fci-rule-width 1)
|
||||
'(feature-indent-initial-offset 0)
|
||||
'(fill-column 78)
|
||||
'(flycheck-completion-system (quote ido))
|
||||
'(flycheck-idle-change-delay 1.0)
|
||||
'(flycheck-indication-mode (quote right-fringe))
|
||||
'(global-auto-revert-mode t)
|
||||
'(global-undo-tree-mode t)
|
||||
'(helm-ag-source-type (quote file-line))
|
||||
'(helm-open-github-commit-limit 10000)
|
||||
'(history-length 500)
|
||||
'(ibuffer-formats
|
||||
(quote
|
||||
((mark modified read-only " "
|
||||
(name 48 48 :left :elide)
|
||||
" "
|
||||
(size 9 -1 :right)
|
||||
" "
|
||||
(mode 16 16 :left :elide)
|
||||
" " filename-and-process)
|
||||
(mark " "
|
||||
(name 16 -1)
|
||||
" " filename))))
|
||||
'(icomplete-mode t)
|
||||
'(ido-vertical-define-keys (quote C-n-C-p-up-down-left-right))
|
||||
'(imenu-auto-rescan t)
|
||||
'(imenu-max-item-length 160)
|
||||
'(imenu-max-items 100)
|
||||
'(isearch-resume-in-command-history t)
|
||||
'(ispell-program-name "aspell")
|
||||
'(magit-completing-read-function (quote magit-ido-completing-read))
|
||||
'(magit-default-tracking-name-function (quote magit-default-tracking-name-branch-only))
|
||||
'(magit-repository-directories (quote ("~/Projects" "~/src" "~/.emacs.d" "~/.dotfiles")))
|
||||
'(magit-status-buffer-switch-function (quote switch-to-buffer))
|
||||
'(markdown-command "redcarpet")
|
||||
'(mc/edit-lines-empty-lines (quote ignore))
|
||||
'(minimap-width-fraction 0.1)
|
||||
'(minimap-window-location (quote right))
|
||||
'(neo-smart-open t)
|
||||
'(neo-window-width 54)
|
||||
'(ns-tool-bar-display-mode nil t)
|
||||
'(ns-tool-bar-size-mode nil t)
|
||||
'(nxhtml-skip-welcome t)
|
||||
'(org-agenda-files
|
||||
(list "~/.org-files/todos.org" "~/.org-files/notes.org" "~/.org-files/events.org"))
|
||||
'(org-agenda-ndays 7)
|
||||
'(org-agenda-show-all-dates t)
|
||||
'(org-agenda-skip-deadline-if-done t)
|
||||
'(org-agenda-skip-scheduled-if-done t)
|
||||
'(org-agenda-start-on-weekday nil)
|
||||
'(org-deadline-warning-days 14)
|
||||
'(org-default-notes-files "~/.org-files/notes.org")
|
||||
'(org-directory "~/.org-files/")
|
||||
'(org-fast-tag-selection-single-key (quote expert))
|
||||
'(org-log-done t)
|
||||
'(org-remember-store-without-prompt t)
|
||||
'(org-remember-templates
|
||||
(quote
|
||||
(("Todo" 116 "** TODO %?
|
||||
" "~/.org-files/todos.org" "Tasks")
|
||||
("Note" 110 "** %?
|
||||
" "~/.org-files/notes.org" "Notes"))))
|
||||
'(org-reverse-note-order t)
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(find-file-in-project zencoding-mode yaml-mode writeroom-mode writegood-mode undo-tree twilight-bright-theme twilight-anti-bright-theme textmate stylus-mode string-inflection smooth-scrolling smex smartparens scss-mode sass-mode ruby-interpolation ruby-compilation rubocop rhtml-mode restclient rbenv rainbow-mode puppet-mode pt project-explorer php-mode phi-search nvm neotree multiple-cursors move-text minimap markdown-mode magit less-css-mode jade-mode ido-vertical-mode highlight-indentation helm-projectile helm-open-github helm-github-stars helm-ag helm-ack grizzl go-snippets go-mode go-autocomplete github-browse-file gitconfig-mode git-timemachine git-gutter-fringe full-ack flymake-php flymake-cursor flymake-css flycheck fill-column-indicator feature-mode expand-region exec-path-from-shell ecb dired+ diminish dash-at-point coffee-mode buffer-move browse-kill-ring ace-jump-buffer)))
|
||||
'(pe/follow-current t)
|
||||
'(pe/width 54)
|
||||
'(persp-modestring-dividers (quote (" [" "]" "|")))
|
||||
'(persp-show-modestring t)
|
||||
'(php-mode-dot-property-warning t)
|
||||
'(projectile-enable-caching nil)
|
||||
'(projectile-globally-ignored-directories
|
||||
(quote
|
||||
(".idea" ".eunit" ".git" ".hg" ".fslckout" ".bzr" ".svn" "_darcs" "vendor/bundle" "vendor/ruby" "coverage" "docs" "doc" "log" "logs" "tmp")))
|
||||
'(projectile-globally-ignored-files (quote ("TAGS" "*.log")))
|
||||
'(projectile-sort-order (quote recently-active))
|
||||
'(ruby-use-encoding-map nil)
|
||||
'(safe-local-variable-values (quote ((eval rainbow-mode 1))))
|
||||
'(scss-compile-at-save nil)
|
||||
'(search-exit-option nil)
|
||||
'(smooth-scroll-margin 6)
|
||||
'(sort-fold-case t t)
|
||||
'(sp-autoescape-string-quote nil)
|
||||
'(speedbar-show-unknown-files t)
|
||||
'(standard-indent 2)
|
||||
'(tabbar-mode nil)
|
||||
'(tool-bar-mode nil)
|
||||
'(undo-limit 160000)
|
||||
'(undo-strong-limit 240000)
|
||||
'(undo-tree-mode-lighter "")
|
||||
'(visual-line-mode nil t)
|
||||
'(whitespace-action nil)
|
||||
'(winner-mode t nil (winner))
|
||||
'(writeroom-disable-mode-line nil)
|
||||
'(writeroom-width 78)
|
||||
'(yas-global-mode t nil (yasnippet))
|
||||
'(yas-use-menu t))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(mumamo-background-chunk-major ((t nil)) t)
|
||||
'(mumamo-background-chunk-submode1 ((t nil)) t)
|
||||
'(mumamo-background-chunk-submode2 ((t nil)) t)
|
||||
'(mumamo-background-chunk-submode3 ((t nil)) t)
|
||||
'(mumamo-background-chunk-submode4 ((t nil)) t)
|
||||
'(persp-selected-face ((t (:foreground "royal blue" :weight bold))))
|
||||
'(sp-pair-overlay-face ((t (:inherit nil)))))
|
||||
@@ -1,75 +0,0 @@
|
||||
;;; .ecb-user-layouts.el --- user defined ECB-layouts
|
||||
|
||||
;; Copyright (C) 2001 - 2005 Jesper Nordenberg
|
||||
;; Copyright (C) 2001 - 2005 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2001 - 2005 Klaus Berndl <klaus.berndl@sdm.de>
|
||||
|
||||
;; Author: Klaus Berndl <klaus.berndl@sdm.de>
|
||||
;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
|
||||
;; Keywords: java, class, browser
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify it
|
||||
;; under the terms of the GNU General Public License as published by the Free
|
||||
;; Software Foundation; either version 2, or (at your option) any later
|
||||
;; version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
;; more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License along
|
||||
;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
|
||||
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains all user-defined ECB-layouts created by the command
|
||||
;; `ecb-create-new-layout'.
|
||||
|
||||
;; !!! DO NOT EDIT THIS FILE MANUALLY - IT IS GENERATED BY ECB !!!
|
||||
|
||||
(ecb-layout-define "user-left1" left nil
|
||||
(if (fboundp (quote ecb-set-directories-buffer)) (ecb-set-directories-buffer) (ecb-set-default-ecb-buffer))
|
||||
(dotimes (i 2) (other-window 1) (if (equal (selected-window) ecb-compile-window) (other-window 1)))
|
||||
(ecb-split-ver 0.75 t)
|
||||
(if (fboundp (quote ecb-set-directories-buffer)) (ecb-set-directories-buffer) (ecb-set-default-ecb-buffer))
|
||||
(dotimes (i 1) (other-window 1) (if (equal (selected-window) ecb-compile-window) (other-window 1)))
|
||||
(if (fboundp (quote ecb-set-methods-buffer)) (ecb-set-methods-buffer) (ecb-set-default-ecb-buffer))
|
||||
(dotimes (i 2) (other-window 1) (if (equal (selected-window) ecb-compile-window) (other-window 1)))
|
||||
(dotimes (i 2) (other-window 1) (if (equal (selected-window) ecb-compile-window) (other-window 1)))
|
||||
)
|
||||
|
||||
(ecb-layout-define "user-left2" left
|
||||
"This function creates the following layout:
|
||||
|
||||
-------------------------------------------------------
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| Directories | |
|
||||
| | |
|
||||
| | Edit |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
|--------------| |
|
||||
| | |
|
||||
| Methods | |
|
||||
| | |
|
||||
-------------------------------------------------------
|
||||
| |
|
||||
| Compilation |
|
||||
| |
|
||||
-------------------------------------------------------
|
||||
|
||||
If you have not set a compilation-window in `ecb-compile-window-height' then
|
||||
the layout contains no persistent compilation window and the other windows get a
|
||||
little more place. This layout works best if it is contained in
|
||||
`ecb-show-sources-in-directories-buffer'!"
|
||||
(ecb-set-directories-buffer)
|
||||
(ecb-split-ver 0.75)
|
||||
(ecb-set-methods-buffer)
|
||||
(select-window (next-window)))
|
||||
Submodule el-get/el-get deleted from 4b053bc515
5
env.el
5
env.el
@@ -1,5 +0,0 @@
|
||||
;; Nix package manager
|
||||
(push "~/.nix-profile/bin" exec-path)
|
||||
|
||||
;; Homebrew
|
||||
(push "/usr/local/bin" exec-path)
|
||||
238
helpers.el
238
helpers.el
@@ -1,238 +0,0 @@
|
||||
;;
|
||||
;; Auto-indent on Paste
|
||||
;;
|
||||
|
||||
(dolist (command '(yank yank-pop))
|
||||
(eval `(defadvice ,command (after indent-region activate)
|
||||
(and (not current-prefix-arg)
|
||||
(member major-mode '(emacs-lisp-mode lisp-mode
|
||||
clojure-mode scheme-mode
|
||||
haskell-mode ruby-mode
|
||||
rspec-mode python-mode
|
||||
c-mode c++-mode
|
||||
objc-mode latex-mode
|
||||
plain-tex-mode))
|
||||
(let ((mark-even-if-inactive transient-mark-mode))
|
||||
(indent-region (region-beginning) (region-end) nil))))))
|
||||
|
||||
|
||||
;;
|
||||
;; Insert Hash
|
||||
;;
|
||||
|
||||
(defun insert-hash()
|
||||
"Inserts a hash into the buffer. Useful for UK keyboard layout users."
|
||||
(interactive)
|
||||
(insert "#"))
|
||||
|
||||
;;
|
||||
;; Duplicate Line
|
||||
;; - from: http://tuxicity.se/emacs/elisp/2010/03/11/duplicate-current-line-or-region-in-emacs.html
|
||||
;;
|
||||
|
||||
(defun duplicate-current-line-or-region (arg)
|
||||
"Duplicates the current line or region ARG times.
|
||||
If there's no region, the current line will be duplicated. However, if
|
||||
there's a region, all lines that region covers will be duplicated."
|
||||
(interactive "p")
|
||||
(let (beg end (origin (point)))
|
||||
(if (and mark-active (> (point) (mark)))
|
||||
(exchange-point-and-mark))
|
||||
(setq beg (line-beginning-position))
|
||||
(if mark-active
|
||||
(exchange-point-and-mark))
|
||||
(setq end (line-end-position))
|
||||
(let ((region (buffer-substring-no-properties beg end)))
|
||||
(dotimes (i arg)
|
||||
(goto-char end)
|
||||
(newline)
|
||||
(insert region)
|
||||
(setq end (point)))
|
||||
(goto-char (+ origin (* (length region) arg) arg)))))
|
||||
|
||||
|
||||
;;
|
||||
;; Align Equal Signs
|
||||
;;
|
||||
|
||||
(defun align-region-to-equals (begin end)
|
||||
"Align region to equal signs"
|
||||
(interactive "r")
|
||||
(align-regexp begin end "\\(\\s-*\\)=" 1 1 ))
|
||||
|
||||
(defun align-region-to-opening-brace (begin end)
|
||||
"Align region to equal signs"
|
||||
(interactive "r")
|
||||
(align-regexp begin end "\\(\\s-*\\){" 1 1 ))
|
||||
|
||||
|
||||
;;
|
||||
;; Yank Pop Forwards
|
||||
;;
|
||||
|
||||
(defun yank-pop-forwards (arg)
|
||||
(interactive "p")
|
||||
(yank-pop (- arg)))
|
||||
|
||||
|
||||
;;
|
||||
;; Window Switching
|
||||
;;
|
||||
|
||||
(defun other-window-reverse ()
|
||||
"Switch to the previous window"
|
||||
(interactive)
|
||||
(other-window -1))
|
||||
|
||||
|
||||
;;
|
||||
;; Window Re-sizing
|
||||
;;
|
||||
|
||||
(defun enlarge-window-down () (interactive) (enlarge-window 1))
|
||||
(defun enlarge-window-up () (interactive) (enlarge-window -1))
|
||||
(defun enlarge-window-left () (interactive) (enlarge-window -1 t))
|
||||
(defun enlarge-window-right () (interactive) (enlarge-window 1 t))
|
||||
|
||||
|
||||
;;
|
||||
;; Window Swapping
|
||||
;; - from https://gist.github.com/287633
|
||||
;;
|
||||
|
||||
(defun swap-with (dir)
|
||||
(interactive)
|
||||
(let ((other-window (windmove-find-other-window dir)))
|
||||
(when other-window
|
||||
(let* ((this-window (selected-window))
|
||||
(this-buffer (window-buffer this-window))
|
||||
(other-buffer (window-buffer other-window))
|
||||
(this-start (window-start this-window))
|
||||
(other-start (window-start other-window)))
|
||||
(set-window-buffer this-window other-buffer)
|
||||
(set-window-buffer other-window this-buffer)
|
||||
(set-window-start this-window other-start)
|
||||
(set-window-start other-window this-start)))))
|
||||
|
||||
(defun swap-with-down () (interactive) (swap-with 'down))
|
||||
(defun swap-with-up () (interactive) (swap-with 'up))
|
||||
(defun swap-with-left () (interactive) (swap-with 'left))
|
||||
(defun swap-with-right () (interactive) (swap-with 'right))
|
||||
|
||||
;;
|
||||
;; Transparency
|
||||
;;
|
||||
|
||||
(defun transparency-set-initial-value ()
|
||||
"Set initial value of alpha parameter for the current frame"
|
||||
(interactive)
|
||||
(if (equal (frame-parameter nil 'alpha) nil)
|
||||
(set-frame-parameter nil 'alpha 100)))
|
||||
|
||||
(defun transparency-set-value (numb)
|
||||
"Set level of transparency for the current frame"
|
||||
(interactive "nEnter transparency level in range 0-100: ")
|
||||
(if (> numb 100)
|
||||
(message "Error! The maximum value for transparency is 100!")
|
||||
(if (< numb 0)
|
||||
(message "Error! The minimum value for transparency is 0!")
|
||||
(set-frame-parameter nil 'alpha numb))))
|
||||
|
||||
(defun transparency-increase ()
|
||||
"Increase level of transparency for the current frame"
|
||||
(interactive)
|
||||
(transparency-set-initial-value)
|
||||
(if (> (frame-parameter nil 'alpha) 0)
|
||||
(set-frame-parameter nil 'alpha (+ (frame-parameter nil 'alpha) -1))
|
||||
(message "This is a minimum value of transparency!")))
|
||||
|
||||
(defun transparency-decrease ()
|
||||
"Decrease level of transparency for the current frame"
|
||||
(interactive)
|
||||
(transparency-set-initial-value)
|
||||
(if (< (frame-parameter nil 'alpha) 100)
|
||||
(set-frame-parameter nil 'alpha (+ (frame-parameter nil 'alpha) +1))
|
||||
(message "This is a minimum value of transparency!")))
|
||||
|
||||
|
||||
;;
|
||||
;; Escreen Helper
|
||||
;; - from http://blog.nguyenvq.com/2011/03/07/escreen-instead-of-elscreen-for-screen-like-features-in-emacs/
|
||||
;;
|
||||
|
||||
(defun escreen-get-active-screen-numbers-with-emphasis ()
|
||||
"what the name says"
|
||||
(interactive)
|
||||
(let ((escreens (escreen-get-active-screen-numbers))
|
||||
(emphased ""))
|
||||
(dolist (s escreens)
|
||||
(setq emphased
|
||||
(concat emphased (if (= escreen-current-screen-number s)
|
||||
(propertize (number-to-string s)
|
||||
;;'face 'custom-variable-tag) " ")
|
||||
;;'face 'info-title-3)
|
||||
'face 'font-lock-warning-face)
|
||||
;;'face 'secondary-selection)
|
||||
(number-to-string s))
|
||||
" ")))
|
||||
(message "escreen: active screens: %s" emphased)))
|
||||
|
||||
|
||||
;;
|
||||
;; File and Buffer Renaming
|
||||
;; - from: http://emacsredux.com/blog/2013/05/04/rename-file-and-buffer/
|
||||
;;
|
||||
|
||||
(defun rename-file-and-buffer ()
|
||||
"Rename the current buffer and file it is visiting."
|
||||
(interactive)
|
||||
(let ((filename (buffer-file-name)))
|
||||
(if (not (and filename (file-exists-p filename)))
|
||||
(message "Buffer is not visiting a file!")
|
||||
(let ((new-name (read-file-name "New name: " filename)))
|
||||
(cond
|
||||
((vc-backend filename) (vc-rename-file filename new-name))
|
||||
(t
|
||||
(rename-file filename new-name t)
|
||||
(rename-buffer new-name)
|
||||
(set-visited-file-name new-name)
|
||||
(set-buffer-modified-p nil)))))))
|
||||
|
||||
|
||||
;;
|
||||
;; HideShow mode helpers
|
||||
;; - from: http://www.emacswiki.org/emacs/HideShow
|
||||
;;
|
||||
(defun toggle-selective-display (column)
|
||||
(interactive "P")
|
||||
(set-selective-display
|
||||
(or column
|
||||
(unless selective-display
|
||||
(1+ (current-column))))))
|
||||
|
||||
(defun toggle-hiding (column)
|
||||
(interactive "P")
|
||||
(if hs-minor-mode
|
||||
(if (condition-case nil
|
||||
(hs-toggle-hiding)
|
||||
(error t))
|
||||
(hs-show-all))
|
||||
(toggle-selective-display column)))
|
||||
|
||||
|
||||
;;
|
||||
;; Remove duplicates lines
|
||||
;; - from: http://www.emacswiki.org/emacs/DuplicateLines#toc4
|
||||
;;
|
||||
(defun uniquify-region-lines (beg end)
|
||||
"Remove duplicate adjacent lines in region."
|
||||
(interactive "*r")
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(while (re-search-forward "^\\(.*\n\\)\\1+" end t)
|
||||
(replace-match "\\1"))))
|
||||
|
||||
(defun uniquify-buffer-lines ()
|
||||
"Remove duplicate adjacent lines in the current buffer."
|
||||
(interactive)
|
||||
(uniquify-region-lines (point-min) (point-max)))
|
||||
36
init.el
36
init.el
@@ -9,39 +9,3 @@
|
||||
;; the `packages.el' file that's loaded in further down.
|
||||
;;
|
||||
;; (package-initialize)
|
||||
|
||||
(setq emacs-config-dir
|
||||
(file-name-directory (or load-file-name (buffer-file-name))))
|
||||
|
||||
;; Determine if GUI or console settings should apply
|
||||
(setq gui-window-system
|
||||
(if (or (getenv "EMACS_GUI_SERVER") window-system) t 'nil))
|
||||
|
||||
;; Helper function for config path
|
||||
(defun get-config-path(path)
|
||||
"Appends argument at the end of emacs-config-dir using expand-file-name"
|
||||
(expand-file-name path emacs-config-dir))
|
||||
|
||||
;; Load various config files
|
||||
(load-file (get-config-path "env.el"))
|
||||
(load-file (get-config-path "packages.el"))
|
||||
(load-file (get-config-path "helpers.el"))
|
||||
(load-file (get-config-path "mode-customizations.el"))
|
||||
(load-file (get-config-path "vendor.el"))
|
||||
(load-file (get-config-path "behavior.el"))
|
||||
(load-file (get-config-path "appearance.el"))
|
||||
(load-file (get-config-path "keybindings.el"))
|
||||
(load-file (get-config-path "aliases.el"))
|
||||
(load-file (get-config-path "remember.el"))
|
||||
(load-file (get-config-path "project-definitions.el"))
|
||||
|
||||
;; Custom variables file
|
||||
(setq custom-file (get-config-path "custom-variables.el"))
|
||||
(load-file custom-file)
|
||||
|
||||
;; Load runtime specific setup files
|
||||
(load-file (get-config-path "runtimes/ruby.el"))
|
||||
(load-file (get-config-path "runtimes/nodejs.el"))
|
||||
|
||||
;; Initialize packages in packages.el
|
||||
(initialize-my-packages)
|
||||
|
||||
342
keybindings.el
342
keybindings.el
@@ -1,342 +0,0 @@
|
||||
;;
|
||||
;; Setup a few global keyboard shortcuts
|
||||
;;
|
||||
|
||||
;; Alternative to M-x
|
||||
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
|
||||
(global-set-key (kbd "C-c C-m") 'execute-extended-command)
|
||||
|
||||
;; Enable dabbrev-expand via custom keybinding.
|
||||
(global-set-key (kbd "C-x M-/") 'dabbrev-expand)
|
||||
|
||||
;; If Smex is available, use it instead of extended-command
|
||||
(when (require 'smex nil 'noerror)
|
||||
(global-set-key (kbd "M-x") 'smex)
|
||||
(global-set-key (kbd "C-x C-m") 'smex)
|
||||
(global-set-key (kbd "C-c C-m") 'smex)
|
||||
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
|
||||
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command))
|
||||
|
||||
;; Easier version of "C-x k" to kill buffer
|
||||
(global-set-key (kbd "C-x C-k") 'kill-buffer)
|
||||
|
||||
;; Evaluate buffer
|
||||
(global-set-key (kbd "C-c C-e") 'eval-buffer)
|
||||
|
||||
;; Goto line
|
||||
(global-set-key (kbd "C-c C-l") 'goto-line)
|
||||
|
||||
;; Switch to next/previous buffer
|
||||
(global-set-key (kbd "C-c C-n") 'switch-to-next-buffer)
|
||||
(global-set-key (kbd "C-c C-p") 'switch-to-prev-buffer)
|
||||
|
||||
;; Duplicate line (via helpers.el)
|
||||
(global-set-key (kbd "C-x C-d") 'duplicate-current-line-or-region)
|
||||
|
||||
;; Window switching (via helpers.el).
|
||||
(global-set-key (kbd "C-x i") 'other-window-reverse)
|
||||
(global-set-key (kbd "C-x C-o") 'other-window)
|
||||
(global-set-key (kbd "C-x C-i") 'other-window-reverse)
|
||||
|
||||
;; Kill-Ring related (via helpers.el).
|
||||
(global-set-key (kbd "M-Y") 'yank-pop-forwards)
|
||||
|
||||
;; Align to equal signs (via helpers.el).
|
||||
(global-set-key (kbd "C-x a =") 'align-region-to-equals)
|
||||
(global-set-key (kbd "M-]") 'align-region-to-equals)
|
||||
(global-set-key (kbd "C-x a {") 'align-region-to-opening-brace)
|
||||
|
||||
;; align-regexp
|
||||
(global-set-key (kbd "C-c C-a") 'align-regexp)
|
||||
|
||||
;; Toggle auto-fill-mode.
|
||||
(global-set-key (kbd "C-c q") 'auto-fill-mode)
|
||||
|
||||
;; Comment or uncomment line
|
||||
(global-set-key (kbd "C-c /") 'comment-or-uncomment-region-or-line)
|
||||
(global-set-key (kbd "C-c C-/") 'comment-or-uncomment-region-or-line)
|
||||
|
||||
;; Custom HideShow toggles (via helpers.el)
|
||||
(global-set-key (kbd "C-=") 'toggle-selective-display)
|
||||
(global-set-key (kbd "C-\\") 'toggle-hiding)
|
||||
|
||||
(when (require 'auto-complete nil 'noerror)
|
||||
(define-key ac-completing-map (kbd "RET") 'ac-complete)
|
||||
(define-key ac-completing-map (kbd "C-m") 'ac-complete)
|
||||
(define-key ac-completing-map (kbd "C-s") 'ac-isearch)
|
||||
(define-key ac-completing-map (kbd "C-n") 'ac-next)
|
||||
(define-key ac-completing-map (kbd "C-p") 'ac-previous))
|
||||
|
||||
;; phi-search (enables C-s and C-r searching with multiple-cursors-mode).
|
||||
(when (require 'phi-search nil 'noerror)
|
||||
(global-set-key (kbd "C-s") 'phi-search)
|
||||
(global-set-key (kbd "C-r") 'phi-search-backward))
|
||||
|
||||
;; Helm
|
||||
(when (require 'helm nil 'noerror)
|
||||
(define-key helm-map (kbd "<up>") 'previous-history-element)
|
||||
(define-key helm-map (kbd "<down>") 'next-history-element)
|
||||
(define-key helm-map (kbd "M-p") 'helm-previous-source)
|
||||
(define-key helm-map (kbd "M-n") 'helm-next-source)
|
||||
(global-set-key (kbd "C-c h") 'helm-mini))
|
||||
|
||||
;; Helm Swoop
|
||||
(when (require 'helm-swoop nil 'noerror)
|
||||
(global-set-key (kbd "M-r") 'helm-swoop)
|
||||
(global-set-key (kbd "M-R") 'helm-swoop-back-to-last-point)
|
||||
(global-set-key (kbd "C-c M-r") 'helm-multi-swoop)
|
||||
(global-set-key (kbd "C-x M-r") 'helm-multi-swoop-all))
|
||||
|
||||
;; Helm Projectile
|
||||
(when (require 'helm-projectile nil 'noerror)
|
||||
(global-set-key (kbd "C-c ;") 'helm-projectile)
|
||||
(global-set-key (kbd "C-c C-;") 'helm-projectile))
|
||||
|
||||
;; Helm Open Github
|
||||
(when (require 'helm-open-github nil 'noerror)
|
||||
(global-set-key (kbd "C-c o f") 'helm-open-github-from-file)
|
||||
(global-set-key (kbd "C-c o c") 'helm-open-github-from-commit)
|
||||
(global-set-key (kbd "C-c o i") 'helm-open-github-from-issues)
|
||||
(global-set-key (kbd "C-c o p") 'helm-open-github-from-pull-requests))
|
||||
|
||||
;; Expand region
|
||||
(when (require 'expand-region nil 'noerror)
|
||||
(global-set-key (kbd "M-.") 'er/expand-region)
|
||||
(global-set-key (kbd "M-,") 'er/contract-region))
|
||||
|
||||
;; multiple-cursors
|
||||
(when (require 'multiple-cursors nil 'noerror)
|
||||
(global-set-key (kbd "C-x C-@") 'mc/edit-lines) ;; Terminal
|
||||
(global-set-key (kbd "C-x C-SPC") 'mc/edit-lines) ;; GUI
|
||||
(global-set-key (kbd "M-/") 'mc/mark-next-like-this)
|
||||
(global-set-key (kbd "M-m") 'mc/mark-previous-like-this)
|
||||
(global-set-key (kbd "C-c M-/") 'mc/mark-all-like-this)
|
||||
(global-set-key (kbd "M-RET") 'set-rectangular-region-anchor)
|
||||
;; Make alt-<click> add additional cursors
|
||||
(global-unset-key (kbd "M-<down-mouse-1>")) ;; must unset key first
|
||||
(global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click))
|
||||
|
||||
;; Browse the kill-ring.
|
||||
(when (require 'browse-kill-ring nil 'noerror)
|
||||
(global-set-key (kbd "C-x C-y") 'browse-kill-ring))
|
||||
|
||||
;; Undo/Redo
|
||||
(when (require 'undo-tree nil 'noerror)
|
||||
(global-set-key (kbd "M--") 'undo-tree-undo)
|
||||
(global-set-key (kbd "M-_") 'undo-tree-redo))
|
||||
|
||||
(when (require 'dash-at-point nil 'noerror)
|
||||
(global-set-key (kbd "C-c d") 'dash-at-point))
|
||||
|
||||
;; Mac OS X specific keybindings
|
||||
(when (eq system-type 'darwin)
|
||||
|
||||
;; Mac OS X Fullscreen (requires Emacs 24.4 or later)
|
||||
(global-set-key (kbd "s-<return>") 'toggle-frame-fullscreen)
|
||||
|
||||
;; Undo/Redo (via undo-tree)
|
||||
(when (require 'undo-tree nil 'noerror)
|
||||
(global-set-key (kbd "s-z") 'undo-tree-undo)
|
||||
(global-set-key (kbd "s-Z") 'undo-tree-redo))
|
||||
|
||||
;; Flyspell correct previous word
|
||||
(when (require 'flyspell nil 'noerror)
|
||||
(global-set-key (kbd "s-.") 'flyspell-correct-word-before-point))
|
||||
|
||||
;; Move to beginning/end of buffer
|
||||
(global-set-key (kbd "s-<up>") 'beginning-of-buffer)
|
||||
(global-set-key (kbd "s-<down>") 'end-of-buffer)
|
||||
|
||||
;; Move to beginning/end of line
|
||||
(global-set-key (kbd "s-<left>") 'beginning-of-line)
|
||||
(global-set-key (kbd "s-<right>") 'end-of-line))
|
||||
|
||||
;; IBuffer
|
||||
(when (require 'ibuffer nil 'noerror)
|
||||
(global-set-key (kbd "C-x C-b") 'ibuffer))
|
||||
|
||||
;; ECB
|
||||
;; (when (require 'ecb nil 'noerror)
|
||||
;; (global-set-key (kbd "C-c C-.") 'ecb-activate))
|
||||
|
||||
;; string-inflection
|
||||
(when (require 'string-inflection nil 'noerror)
|
||||
(global-set-key (kbd "C-c C-.") 'string-inflection-cycle))
|
||||
|
||||
;; Project Explorer
|
||||
(when (require 'project-explorer nil 'noerror)
|
||||
(global-set-key (kbd "C-x p") 'project-explorer-open))
|
||||
|
||||
;; Magit
|
||||
(when (require 'magit nil 'noerror)
|
||||
(global-set-key (kbd "C-x g") 'magit-status))
|
||||
|
||||
;; Avy mode
|
||||
(when (require 'avy nil 'noerror)
|
||||
(define-key global-map (kbd "C-c C-j") 'avy-goto-word-or-subword-1)
|
||||
(define-key global-map (kbd "C-c SPC") 'avy-goto-char))
|
||||
|
||||
;; Ace-window
|
||||
(when (require 'ace-window nil 'noerror)
|
||||
(define-key global-map (kbd "M-o") 'ace-window))
|
||||
|
||||
;; projectile related keybindings
|
||||
(when (require 'projectile nil 'noerror)
|
||||
(global-set-key (kbd "C-c C-b") 'projectile-ibuffer)
|
||||
(global-set-key (kbd "C-x C-t") 'projectile-find-file)
|
||||
(global-set-key (kbd "C-x t") 'projectile-find-test-file)
|
||||
(global-set-key (kbd "C-x C-v") 'projectile-switch-to-buffer)
|
||||
(global-set-key (kbd "C-c C-s") 'projectile-switch-project))
|
||||
|
||||
;; Textmate-mode related keybindings
|
||||
(when (require 'textmate nil 'noerror)
|
||||
(global-set-key (kbd "C-t") 'textmate-goto-symbol)
|
||||
;; (global-set-key (kbd "M-p") 'textmate-column-up)
|
||||
;; (global-set-key (kbd "M-n") 'textmate-column-down)
|
||||
(global-set-key (kbd "C-c [") 'textmate-shift-left)
|
||||
(global-set-key (kbd "C-c ]") 'textmate-shift-right))
|
||||
|
||||
;; move-text
|
||||
(when (require 'move-text nil 'noerror)
|
||||
;; Must be set after textmate is required.
|
||||
(define-key global-map (kbd "M-p") 'move-text-up)
|
||||
(define-key global-map (kbd "M-n") 'move-text-down))
|
||||
|
||||
;; smartparens
|
||||
;; (when (require 'smartparens nil 'noerror)
|
||||
;; ;; Must be set after textmate is required.
|
||||
;; (define-key sp-keymap (kbd "M-F") 'sp-forward-symbol)
|
||||
;; (define-key sp-keymap (kbd "M-B") 'sp-backward-symbol)
|
||||
;; (define-key sp-keymap (kbd "C-M-f") 'sp-forward-sexp)
|
||||
;; (define-key sp-keymap (kbd "C-M-b") 'sp-backward-sexp))
|
||||
|
||||
;; Set/increase/decrease transparency (via helpers.el)
|
||||
(global-set-key (kbd "C-M-|") 'transparency-set-value)
|
||||
(global-set-key (kbd "C-M-<") 'transparency-increase)
|
||||
(global-set-key (kbd "C-M->") 'transparency-decrease)
|
||||
|
||||
;; Window Resizing
|
||||
(define-key global-map (kbd "C-{") 'shrink-window-horizontally)
|
||||
(define-key global-map (kbd "C-}") 'enlarge-window-horizontally)
|
||||
(define-key global-map (kbd "C-^") 'enlarge-window)
|
||||
|
||||
;; Move buffers between windows
|
||||
(when (require 'buffer-move nil 'noerror)
|
||||
(global-set-key (kbd "M-K") 'buf-move-down)
|
||||
(global-set-key (kbd "M-I") 'buf-move-up)
|
||||
(global-set-key (kbd "M-J") 'buf-move-left)
|
||||
(global-set-key (kbd "M-L") 'buf-move-right))
|
||||
|
||||
;; Window Tiling (via helpers.el)
|
||||
(global-set-key (kbd "M-k") 'windmove-down)
|
||||
(global-set-key (kbd "M-i") 'windmove-up)
|
||||
(global-set-key (kbd "M-j") 'windmove-left)
|
||||
(global-set-key (kbd "M-l") 'windmove-right)
|
||||
|
||||
;; Org-mode
|
||||
(define-key global-map (kbd "C-c a") 'org-agenda)
|
||||
(define-key global-map (kbd "C-c l") 'org-store-link)
|
||||
|
||||
;; Remember mode
|
||||
;; (define-key global-map (kbd "C-c r") 'org-remember)
|
||||
;; (define-key global-map (kbd "C-M-r") 'org-remember)
|
||||
|
||||
;; Rename current file and buffer (via helpers.el)
|
||||
(global-set-key (kbd "C-c r") 'rename-file-and-buffer)
|
||||
|
||||
;; Allow hash to be entered on UK keyboards (via helpers.el)
|
||||
(global-set-key (kbd "M-3") 'insert-hash)
|
||||
|
||||
;; tiling.el related bindings
|
||||
(when (require 'tiling nil 'noerror)
|
||||
(define-key global-map (kbd "C-\\") 'tiling-cycle))
|
||||
|
||||
;; ElScreen related shortcuts
|
||||
(when (require 'elscreen nil 'noerror)
|
||||
(define-key elscreen-map (kbd "C-z") elscreen-map)
|
||||
|
||||
;; Goto screens.
|
||||
(global-set-key (kbd "s-}") 'elscreen-next)
|
||||
(global-set-key (kbd "s-{") 'elscreen-previous)
|
||||
|
||||
;; Set screen nickname
|
||||
(define-key elscreen-map (kbd ",") 'elscreen-screen-nickname)
|
||||
(define-key elscreen-map (kbd "C-,") 'elscreen-screen-nickname)
|
||||
|
||||
;; Toggle screens.
|
||||
(define-key elscreen-map (kbd "l") 'elscreen-toggle)
|
||||
(define-key elscreen-map (kbd "C-l") 'elscreen-toggle)
|
||||
|
||||
;; Display list of screens.
|
||||
(define-key elscreen-map (kbd ";") 'elscreen-display-screen-name-list)
|
||||
(define-key elscreen-map (kbd "C-;") 'elscreen-display-screen-name-list))
|
||||
|
||||
(when (require 'workgroups2 nil 'noerror)
|
||||
(setq wg-prefix-key (kbd "C-z"))
|
||||
)
|
||||
|
||||
(when (require 'perspective nil 'noerror)
|
||||
(define-key persp-mode-map (kbd "C-z") perspective-map)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z s") 'persp-switch)
|
||||
(define-key persp-mode-map (kbd "C-z C-s") 'persp-switch)
|
||||
(define-key persp-mode-map (kbd "C-z b") 'persp-switch)
|
||||
(define-key persp-mode-map (kbd "C-z C-b") 'persp-switch)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z c") 'persp-remove-buffer)
|
||||
(define-key persp-mode-map (kbd "C-z C-c") 'persp-remove-buffer)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z k") 'persp-kill)
|
||||
(define-key persp-mode-map (kbd "C-z C-k") 'persp-kill)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z r") 'persp-rename)
|
||||
(define-key persp-mode-map (kbd "C-z C-r") 'persp-rename)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z a") 'persp-add-buffer)
|
||||
(define-key persp-mode-map (kbd "C-z C-a") 'persp-add-buffer)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z i") 'persp-import)
|
||||
(define-key persp-mode-map (kbd "C-z C-i") 'persp-import)
|
||||
|
||||
(define-key persp-mode-map (kbd "C-z n") 'persp-next)
|
||||
(define-key persp-mode-map (kbd "C-z C-n") 'persp-next)
|
||||
(define-key persp-mode-map (kbd "C-z p") 'persp-prev)
|
||||
(define-key persp-mode-map (kbd "C-z C-p") 'persp-prev)
|
||||
)
|
||||
|
||||
;; Escreen customizations (via helpers.el).
|
||||
(when (require 'escreen nil 'noerror)
|
||||
|
||||
;; Set prefix key to C-z.
|
||||
(setq escreen-prefix-char (kbd "C-z"))
|
||||
(global-set-key escreen-prefix-char 'escreen-prefix)
|
||||
(define-key escreen-map escreen-prefix-char 'escreen-goto-last-screen)
|
||||
|
||||
;; Toggle screens.
|
||||
(define-key escreen-map (kbd "l") 'escreen-goto-last-screen)
|
||||
(define-key escreen-map (kbd "C-l") 'escreen-goto-last-screen)
|
||||
|
||||
;; List screens.
|
||||
(define-key escreen-map (kbd "a")
|
||||
'escreen-get-active-screen-numbers-with-emphasis)
|
||||
(define-key escreen-map (kbd "C-a")
|
||||
'escreen-get-active-screen-numbers-with-emphasis)
|
||||
(define-key escreen-map (kbd ";")
|
||||
'escreen-get-active-screen-numbers-with-emphasis)
|
||||
(define-key escreen-map (kbd "C-;")
|
||||
'escreen-get-active-screen-numbers-with-emphasis)
|
||||
|
||||
;; Goto screens.
|
||||
(global-set-key (kbd "s-}") 'escreen-goto-next-screen)
|
||||
(global-set-key (kbd "s-{") 'escreen-goto-prev-screen)
|
||||
|
||||
;; Ctrl versions of default commands.
|
||||
(define-key escreen-map (kbd "C-c") 'escreen-create-screen)
|
||||
(define-key escreen-map (kbd "C-g") 'escreen-goto-screen)
|
||||
(define-key escreen-map (kbd "C-k") 'escreen-kill-screen)
|
||||
(define-key escreen-map (kbd "C-n") 'escreen-goto-next-screen)
|
||||
(define-key escreen-map (kbd "C-p") 'escreen-goto-prev-screen)
|
||||
|
||||
;; Show list of screens when you switch/create/kill.
|
||||
(add-hook 'escreen-goto-screen-hook
|
||||
'escreen-get-active-screen-numbers-with-emphasis))
|
||||
@@ -1,33 +0,0 @@
|
||||
;;
|
||||
;; Load Mode Customizations
|
||||
;;
|
||||
|
||||
;; Programming languages
|
||||
(load-file (get-config-path "mode-customizations/ack-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/coffee-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/conf-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/css-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/dired-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/emacs-lisp-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/erlang-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/feature-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/git-commit-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/go-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/haml-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/html-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/js-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/lisp-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/makefile-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/markdown-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/php-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/puppet-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/python-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/rhtml-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/ruby-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/sass-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/sh-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/slim-mode.el"))
|
||||
(load-file (get-config-path "mode-customizations/yaml-mode.el"))
|
||||
|
||||
;; Misc modes
|
||||
(load-file (get-config-path "mode-customizations/magit-mode.el"))
|
||||
@@ -1,5 +0,0 @@
|
||||
(defun customizations-for-ack-mode ()
|
||||
(interactive)
|
||||
(define-key ack-mode-map (kbd "q") 'kill-this-buffer))
|
||||
|
||||
(add-hook 'ack-mode-hook 'customizations-for-ack-mode)
|
||||
@@ -1,20 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
|
||||
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
|
||||
|
||||
(defun customizations-for-coffee-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(whitespace-mode)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'coffee-mode-hook 'customizations-for-coffee-mode)
|
||||
@@ -1,8 +0,0 @@
|
||||
(defun customizations-for-conf-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode))
|
||||
|
||||
(add-hook 'conf-mode-hook 'customizations-for-conf-mode)
|
||||
@@ -1,14 +0,0 @@
|
||||
(defun customizations-for-css-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq css-indent-offset 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(define-key css-mode-map (kbd "RET") 'newline-and-indent))
|
||||
|
||||
(add-hook 'css-mode-hook 'customizations-for-css-mode)
|
||||
@@ -1,8 +0,0 @@
|
||||
(defun customizations-for-dired-mode ()
|
||||
(interactive)
|
||||
(linum-mode t)
|
||||
(define-key dired-mode-map (kbd "c") 'dired-create-directory)
|
||||
(when (require 'dired+ nil 'noerror)
|
||||
(toggle-diredp-find-file-reuse-dir 1)))
|
||||
|
||||
(add-hook 'dired-mode-hook 'customizations-for-dired-mode)
|
||||
@@ -1,10 +0,0 @@
|
||||
(defun customizations-for-emacs-lisp-mode ()
|
||||
(interactive)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'customizations-for-emacs-lisp-mode)
|
||||
@@ -1,22 +0,0 @@
|
||||
;; erlang-mode is part of the Erlang source, and I found
|
||||
;; no simple way to create a el-get package. So it's one
|
||||
;; more thing thats not installed through el-get.
|
||||
|
||||
(add-to-list 'load-path (get-config-path "mode-customizations/erlang"))
|
||||
(setq erlang-root-dir "/usr/local")
|
||||
(setq exec-path (cons "/usr/local/bin" exec-path))
|
||||
(require 'erlang-start)
|
||||
(require 'erlang-flymake)
|
||||
|
||||
(defun customizations-for-erlang-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'erlang-mode-hook 'customizations-for-erlang-mode)
|
||||
@@ -1,55 +0,0 @@
|
||||
User configuration notes
|
||||
========================
|
||||
|
||||
Below is a quick guide to necessary configurations for getting
|
||||
started with the Erlang mode for Emacs. Please refer to the
|
||||
Users guide and reference manual in the documentation for the
|
||||
Erlang/OTP application tools for more information.
|
||||
|
||||
|
||||
For UNIX users
|
||||
--------------
|
||||
|
||||
To set up the Erlang Emacs mode on UNIX systems, edit/create the file
|
||||
.emacs in the your home directory.
|
||||
|
||||
Below is a complete example of what should be added to a user's .emacs
|
||||
provided that OTP is installed in the directory /usr/local/otp:
|
||||
|
||||
(setq load-path (cons "/usr/local/otp/lib/tools-<ToolsVer>/emacs"
|
||||
load-path))
|
||||
(setq erlang-root-dir "/usr/local/otp")
|
||||
(setq exec-path (cons "/usr/local/otp/bin" exec-path))
|
||||
(require 'erlang-start)
|
||||
|
||||
|
||||
For Windows users
|
||||
-----------------
|
||||
|
||||
To set up the Erlang Emacs mode on Windows systems, edit/create the
|
||||
file .emacs, the location of the file depends on the configuration of
|
||||
the system. If the HOME environment variable is set, Emacs will look
|
||||
for the .emacs file in the directory indicated by the HOME
|
||||
variable. If HOME is not set, Emacs will look for the .emacs file in
|
||||
C:\.
|
||||
|
||||
Below is a complete example of what should be added to a user's .emacs
|
||||
provided that OTP is installed in the directory C:\Program
|
||||
Files\erl-<Ver>:
|
||||
|
||||
(setq load-path (cons "C:/Program Files/erl<Ver>/lib/tools-<ToolsVer>/emacs"
|
||||
load-path))
|
||||
(setq erlang-root-dir "C:/Program Files/erl<Ver>")
|
||||
(setq exec-path (cons "C:/Program Files/erl<Ver>/bin" exec-path))
|
||||
(require 'erlang-start)
|
||||
|
||||
|
||||
Miscellaneous addons
|
||||
--------------------
|
||||
|
||||
In order to check erlang source code on the fly, add the following
|
||||
line to your .emacs file (after erlang-start, see above). See
|
||||
erlang-flymake.el for more information on how to customize the syntax
|
||||
check.
|
||||
|
||||
(require 'erlang-flymake)
|
||||
@@ -1,448 +0,0 @@
|
||||
;;
|
||||
;; %CopyrightBegin%
|
||||
;;
|
||||
;; Copyright Ericsson AB 2009-2010. All Rights Reserved.
|
||||
;;
|
||||
;; The contents of this file are subject to the Erlang Public License,
|
||||
;; Version 1.1, (the "License"); you may not use this file except in
|
||||
;; compliance with the License. You should have received a copy of the
|
||||
;; Erlang Public License along with this software. If not, it can be
|
||||
;; retrieved online at http://www.erlang.org/.
|
||||
;;
|
||||
;; Software distributed under the License is distributed on an "AS IS"
|
||||
;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
;; the License for the specific language governing rights and limitations
|
||||
;; under the License.
|
||||
;;
|
||||
;; %CopyrightEnd%
|
||||
;;;
|
||||
;;; Purpose: Provide EUnit utilities.
|
||||
;;;
|
||||
;;; Author: Klas Johansson
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(defvar erlang-eunit-src-candidate-dirs '("../src" ".")
|
||||
"*Name of directories which to search for source files matching
|
||||
an EUnit test file. The first directory in the list will be used,
|
||||
if there is no match.")
|
||||
|
||||
(defvar erlang-eunit-test-candidate-dirs '("../test" ".")
|
||||
"*Name of directories which to search for EUnit test files matching
|
||||
a source file. The first directory in the list will be used,
|
||||
if there is no match.")
|
||||
|
||||
(defvar erlang-eunit-autosave nil
|
||||
"*Set to non-nil to automtically save unsaved buffers before running tests.
|
||||
This is useful, reducing the save-compile-load-test cycle to one keychord.")
|
||||
|
||||
(defvar erlang-eunit-recent-info '((mode . nil) (module . nil) (test . nil) (cover . nil))
|
||||
"Info about the most recent running of an EUnit test representation.")
|
||||
|
||||
;;;
|
||||
;;; Switch between src/EUnit test buffers
|
||||
;;;
|
||||
(defun erlang-eunit-toggle-src-and-test-file-other-window ()
|
||||
"Switch to the src file if the EUnit test file is the current
|
||||
buffer and vice versa"
|
||||
(interactive)
|
||||
(if (erlang-eunit-test-file-p buffer-file-name)
|
||||
(erlang-eunit-open-src-file-other-window buffer-file-name)
|
||||
(erlang-eunit-open-test-file-other-window buffer-file-name)))
|
||||
|
||||
;;;
|
||||
;;; Open the EUnit test file which corresponds to a src file
|
||||
;;;
|
||||
(defun erlang-eunit-open-test-file-other-window (src-file-path)
|
||||
"Open the EUnit test file which corresponds to a src file"
|
||||
(find-file-other-window (erlang-eunit-test-filename src-file-path)))
|
||||
|
||||
;;;
|
||||
;;; Open the src file which corresponds to the an EUnit test file
|
||||
;;;
|
||||
(defun erlang-eunit-open-src-file-other-window (test-file-path)
|
||||
"Open the src file which corresponds to the an EUnit test file"
|
||||
(find-file-other-window (erlang-eunit-src-filename test-file-path)))
|
||||
|
||||
;;; Return the name and path of the EUnit test file
|
||||
;;, (input may be either the source filename itself or the EUnit test filename)
|
||||
(defun erlang-eunit-test-filename (file-path)
|
||||
(if (erlang-eunit-test-file-p file-path)
|
||||
file-path
|
||||
(erlang-eunit-rewrite-filename file-path erlang-eunit-test-candidate-dirs)))
|
||||
|
||||
;;; Return the name and path of the source file
|
||||
;;, (input may be either the source filename itself or the EUnit test filename)
|
||||
(defun erlang-eunit-src-filename (file-path)
|
||||
(if (erlang-eunit-src-file-p file-path)
|
||||
file-path
|
||||
(erlang-eunit-rewrite-filename file-path erlang-eunit-src-candidate-dirs)))
|
||||
|
||||
;;; Rewrite a filename from the src or test filename to the other
|
||||
(defun erlang-eunit-rewrite-filename (orig-file-path candidate-dirs)
|
||||
(or (erlang-eunit-locate-buddy orig-file-path candidate-dirs)
|
||||
(erlang-eunit-buddy-file-path orig-file-path (car candidate-dirs))))
|
||||
|
||||
;;; Search for a file's buddy file (a source file's EUnit test file,
|
||||
;;; or an EUnit test file's source file) in a list of candidate
|
||||
;;; directories.
|
||||
(defun erlang-eunit-locate-buddy (orig-file-path candidate-dirs)
|
||||
(when candidate-dirs
|
||||
(let ((buddy-file-path (erlang-eunit-buddy-file-path
|
||||
orig-file-path
|
||||
(car candidate-dirs))))
|
||||
(if (file-readable-p buddy-file-path)
|
||||
buddy-file-path
|
||||
(erlang-eunit-locate-buddy orig-file-path (cdr candidate-dirs))))))
|
||||
|
||||
(defun erlang-eunit-buddy-file-path (orig-file-path buddy-dir-name)
|
||||
(let* ((orig-dir-name (file-name-directory orig-file-path))
|
||||
(buddy-dir-name (file-truename
|
||||
(filename-join orig-dir-name buddy-dir-name)))
|
||||
(buddy-base-name (erlang-eunit-buddy-basename orig-file-path)))
|
||||
(filename-join buddy-dir-name buddy-base-name)))
|
||||
|
||||
;;; Return the basename of the buddy file:
|
||||
;;; /tmp/foo/src/x.erl --> x_tests.erl
|
||||
;;; /tmp/foo/test/x_tests.erl --> x.erl
|
||||
(defun erlang-eunit-buddy-basename (file-path)
|
||||
(let ((src-module-name (erlang-eunit-source-module-name file-path)))
|
||||
(cond
|
||||
((erlang-eunit-src-file-p file-path)
|
||||
(concat src-module-name "_tests.erl"))
|
||||
((erlang-eunit-test-file-p file-path)
|
||||
(concat src-module-name ".erl")))))
|
||||
|
||||
;;; Checks whether a file is a source file or not
|
||||
(defun erlang-eunit-src-file-p (file-path)
|
||||
(not (erlang-eunit-test-file-p file-path)))
|
||||
|
||||
;;; Checks whether a file is a EUnit test file or not
|
||||
(defun erlang-eunit-test-file-p (file-path)
|
||||
(erlang-eunit-string-match-p "^\\(.+\\)_tests.erl$" file-path))
|
||||
|
||||
;;; Return the module name of the source file
|
||||
;;; /tmp/foo/src/x.erl --> x
|
||||
;;; /tmp/foo/test/x_tests.erl --> x
|
||||
(defun erlang-eunit-source-module-name (file-path)
|
||||
(interactive)
|
||||
(let ((module-name (erlang-eunit-module-name file-path)))
|
||||
(if (string-match "^\\(.+\\)_tests$" module-name)
|
||||
(substring module-name (match-beginning 1) (match-end 1))
|
||||
module-name)))
|
||||
|
||||
;;; Return the module name of the file
|
||||
;;; /tmp/foo/src/x.erl --> x
|
||||
;;; /tmp/foo/test/x_tests.erl --> x_tests
|
||||
(defun erlang-eunit-module-name (file-path)
|
||||
(interactive)
|
||||
(file-name-sans-extension (file-name-nondirectory file-path)))
|
||||
|
||||
;;; Older emacsen don't have string-match-p.
|
||||
(defun erlang-eunit-string-match-p (regexp string &optional start)
|
||||
(if (fboundp 'string-match-p) ;; appeared in emacs 23
|
||||
(string-match-p regexp string start)
|
||||
(save-match-data ;; fallback for earlier versions of emacs
|
||||
(string-match regexp string start))))
|
||||
|
||||
;;; Join filenames
|
||||
(defun filename-join (dir file)
|
||||
(if (or (= (elt file 0) ?/)
|
||||
(= (car (last (append dir nil))) ?/))
|
||||
(concat dir file)
|
||||
(concat dir "/" file)))
|
||||
|
||||
;;; Get info about the most recent running of EUnit
|
||||
(defun erlang-eunit-recent (key)
|
||||
(cdr (assq key erlang-eunit-recent-info)))
|
||||
|
||||
;;; Record info about the most recent running of EUnit
|
||||
;;; Known modes are 'module-mode and 'test-mode
|
||||
(defun erlang-eunit-record-recent (mode module test)
|
||||
(setcdr (assq 'mode erlang-eunit-recent-info) mode)
|
||||
(setcdr (assq 'module erlang-eunit-recent-info) module)
|
||||
(setcdr (assq 'test erlang-eunit-recent-info) test))
|
||||
|
||||
;;; Record whether the most recent running of EUnit included cover
|
||||
;;; compilation
|
||||
(defun erlang-eunit-record-recent-compile (under-cover)
|
||||
(setcdr (assq 'cover erlang-eunit-recent-info) under-cover))
|
||||
|
||||
;;; Determine options for EUnit.
|
||||
(defun erlang-eunit-opts ()
|
||||
(if current-prefix-arg ", [verbose]" ""))
|
||||
|
||||
;;; Determine current test function
|
||||
(defun erlang-eunit-current-test ()
|
||||
(save-excursion
|
||||
(erlang-end-of-function 1)
|
||||
(erlang-beginning-of-function 1)
|
||||
(erlang-name-of-function)))
|
||||
|
||||
(defun erlang-eunit-simple-test-p (test-name)
|
||||
(if (erlang-eunit-string-match-p "^\\(.+\\)_test$" test-name) t nil))
|
||||
|
||||
(defun erlang-eunit-test-generator-p (test-name)
|
||||
(if (erlang-eunit-string-match-p "^\\(.+\\)_test_$" test-name) t nil))
|
||||
|
||||
;;; Run one EUnit test
|
||||
(defun erlang-eunit-run-test (module-name test-name)
|
||||
(let ((command
|
||||
(cond ((erlang-eunit-simple-test-p test-name)
|
||||
(format "eunit:test({%s, %s}%s)."
|
||||
module-name test-name (erlang-eunit-opts)))
|
||||
((erlang-eunit-test-generator-p test-name)
|
||||
(format "eunit:test({generator, %s, %s}%s)."
|
||||
module-name test-name (erlang-eunit-opts)))
|
||||
(t (format "%% WARNING: '%s' is not a test function" test-name)))))
|
||||
(erlang-eunit-record-recent 'test-mode module-name test-name)
|
||||
(erlang-eunit-inferior-erlang-send-command command)))
|
||||
|
||||
;;; Run EUnit tests for the current module
|
||||
(defun erlang-eunit-run-module-tests (module-name)
|
||||
(let ((command (format "eunit:test(%s%s)." module-name (erlang-eunit-opts))))
|
||||
(erlang-eunit-record-recent 'module-mode module-name nil)
|
||||
(erlang-eunit-inferior-erlang-send-command command)))
|
||||
|
||||
(defun erlang-eunit-compile-and-run-recent ()
|
||||
"Compile the source and test files and repeat the most recent EUnit test run.
|
||||
|
||||
With prefix arg, compiles for debug and runs tests with the verbose flag set."
|
||||
(interactive)
|
||||
(case (erlang-eunit-recent 'mode)
|
||||
('test-mode
|
||||
(erlang-eunit-compile-and-test
|
||||
'erlang-eunit-run-test (list (erlang-eunit-recent 'module)
|
||||
(erlang-eunit-recent 'test))))
|
||||
('module-mode
|
||||
(erlang-eunit-compile-and-test
|
||||
'erlang-eunit-run-module-tests (list (erlang-eunit-recent 'module))
|
||||
(erlang-eunit-recent 'cover)))
|
||||
(t (error "EUnit has not yet been run. Please run a test first."))))
|
||||
|
||||
(defun erlang-eunit-cover-compile ()
|
||||
"Cover compile current module."
|
||||
(interactive)
|
||||
(let* ((erlang-compile-extra-opts
|
||||
(append (list 'debug_info) erlang-compile-extra-opts))
|
||||
(module-name
|
||||
(erlang-add-quotes-if-needed
|
||||
(erlang-eunit-module-name buffer-file-name)))
|
||||
(compile-command
|
||||
(format "cover:compile_beam(%s)." module-name)))
|
||||
(erlang-compile)
|
||||
(if (erlang-eunit-last-compilation-successful-p)
|
||||
(erlang-eunit-inferior-erlang-send-command compile-command))))
|
||||
|
||||
(defun erlang-eunit-analyze-coverage ()
|
||||
"Analyze the data collected by cover tool for the module in the
|
||||
current buffer.
|
||||
|
||||
Assumes that the module has been cover compiled prior to this
|
||||
call. This function will do two things: print the number of
|
||||
covered and uncovered functions in the erlang shell and display a
|
||||
new buffer called *<module name> coverage* which shows the source
|
||||
code along with the coverage analysis results."
|
||||
(interactive)
|
||||
(let* ((module-name (erlang-add-quotes-if-needed
|
||||
(erlang-eunit-module-name buffer-file-name)))
|
||||
(tmp-filename (make-temp-file "cover"))
|
||||
(analyze-command (format "cover:analyze_to_file(%s, \"%s\"). "
|
||||
module-name tmp-filename))
|
||||
(buf-name (format "*%s coverage*" module-name)))
|
||||
(erlang-eunit-inferior-erlang-send-command analyze-command)
|
||||
;; The purpose of the following snippet is to get the result of the
|
||||
;; analysis from a file into a new buffer (or an old, if one with
|
||||
;; the specified name already exists). Also we want the erlang-mode
|
||||
;; *and* view-mode to be enabled.
|
||||
(save-excursion
|
||||
(let ((buf (get-buffer-create (format "*%s coverage*" module-name))))
|
||||
(set-buffer buf)
|
||||
(setq buffer-read-only nil)
|
||||
(insert-file-contents tmp-filename nil nil nil t)
|
||||
(if (= (buffer-size) 0)
|
||||
(kill-buffer buf)
|
||||
;; FIXME: this would be a good place to enable (emacs-mode)
|
||||
;; to get some nice syntax highlighting in the
|
||||
;; coverage report, but it doesn't play well with
|
||||
;; flymake. Leave it off for now.
|
||||
(view-buffer buf))))
|
||||
(delete-file tmp-filename)))
|
||||
|
||||
(defun erlang-eunit-compile-and-run-current-test ()
|
||||
"Compile the source and test files and run the current EUnit test.
|
||||
|
||||
With prefix arg, compiles for debug and runs tests with the verbose flag set."
|
||||
(interactive)
|
||||
(let ((module-name (erlang-add-quotes-if-needed
|
||||
(erlang-eunit-module-name buffer-file-name)))
|
||||
(test-name (erlang-eunit-current-test)))
|
||||
(erlang-eunit-compile-and-test
|
||||
'erlang-eunit-run-test (list module-name test-name))))
|
||||
|
||||
(defun erlang-eunit-compile-and-run-module-tests ()
|
||||
"Compile the source and test files and run all EUnit tests in the module.
|
||||
|
||||
With prefix arg, compiles for debug and runs tests with the verbose flag set."
|
||||
(interactive)
|
||||
(let ((module-name (erlang-add-quotes-if-needed
|
||||
(erlang-eunit-source-module-name buffer-file-name))))
|
||||
(erlang-eunit-compile-and-test
|
||||
'erlang-eunit-run-module-tests (list module-name))))
|
||||
|
||||
;;; Compile source and EUnit test file and finally run EUnit tests for
|
||||
;;; the current module
|
||||
(defun erlang-eunit-compile-and-test (test-fun test-args &optional under-cover)
|
||||
"Compile the source and test files and run the EUnit test suite.
|
||||
|
||||
If under-cover is set to t, the module under test is compile for
|
||||
code coverage analysis. If under-cover is left out or not set,
|
||||
coverage analysis is disabled. The result of the code coverage
|
||||
is both printed to the erlang shell (the number of covered vs
|
||||
uncovered functions in a module) and written to a buffer called
|
||||
*<module> coverage* (which shows the source code for the module
|
||||
and the number of times each line is covered).
|
||||
With prefix arg, compiles for debug and runs tests with the verbose flag set."
|
||||
(erlang-eunit-record-recent-compile under-cover)
|
||||
(let ((src-filename (erlang-eunit-src-filename buffer-file-name))
|
||||
(test-filename (erlang-eunit-test-filename buffer-file-name)))
|
||||
|
||||
;; The purpose of out-maneuvering `save-some-buffers', as is done
|
||||
;; below, is to ask the question about saving buffers only once,
|
||||
;; instead of possibly several: one for each file to compile,
|
||||
;; for instance for both x.erl and x_tests.erl.
|
||||
(save-some-buffers erlang-eunit-autosave)
|
||||
(flet ((save-some-buffers (&optional any) nil))
|
||||
|
||||
;; Compilation of the source file is mandatory (the file must
|
||||
;; exist, otherwise the procedure is aborted). Compilation of the
|
||||
;; test file on the other hand, is optional, since eunit tests may
|
||||
;; be placed in the source file instead. Any compilation error
|
||||
;; will prevent the subsequent steps to be run (hence the `and')
|
||||
(and (erlang-eunit-compile-file src-filename under-cover)
|
||||
(if (file-readable-p test-filename)
|
||||
(erlang-eunit-compile-file test-filename)
|
||||
t)
|
||||
(apply test-fun test-args)
|
||||
(if under-cover
|
||||
(save-excursion
|
||||
(set-buffer (find-file-noselect src-filename))
|
||||
(erlang-eunit-analyze-coverage)))))))
|
||||
|
||||
(defun erlang-eunit-compile-and-run-module-tests-under-cover ()
|
||||
"Compile the source and test files and run the EUnit test suite and measure
|
||||
code coverage.
|
||||
|
||||
With prefix arg, compiles for debug and runs tests with the verbose flag set."
|
||||
(interactive)
|
||||
(let ((module-name (erlang-add-quotes-if-needed
|
||||
(erlang-eunit-source-module-name buffer-file-name))))
|
||||
(erlang-eunit-compile-and-test
|
||||
'erlang-eunit-run-module-tests (list module-name) t)))
|
||||
|
||||
(defun erlang-eunit-compile-file (file-path &optional under-cover)
|
||||
(if (file-readable-p file-path)
|
||||
(save-excursion
|
||||
(set-buffer (find-file-noselect file-path))
|
||||
;; In order to run a code coverage analysis on a
|
||||
;; module, we have two options:
|
||||
;;
|
||||
;; * either compile the module with cover:compile instead of the
|
||||
;; regular compiler
|
||||
;;
|
||||
;; * or first compile the module with the regular compiler (but
|
||||
;; *with* debug_info) and then compile it for coverage
|
||||
;; analysis using cover:compile_beam.
|
||||
;;
|
||||
;; We could accomplish the first by changing the
|
||||
;; erlang-compile-erlang-function to cover:compile, but there's
|
||||
;; a risk that that's used for other purposes. Therefore, a
|
||||
;; safer alternative (although with more steps) is to add
|
||||
;; debug_info to the list of compiler options and go for the
|
||||
;; second alternative.
|
||||
(if under-cover
|
||||
(erlang-eunit-cover-compile)
|
||||
(erlang-compile))
|
||||
(erlang-eunit-last-compilation-successful-p))
|
||||
(let ((msg (format "Could not read %s" file-path)))
|
||||
(erlang-eunit-inferior-erlang-send-command
|
||||
(format "%% WARNING: %s" msg))
|
||||
(error msg))))
|
||||
|
||||
(defun erlang-eunit-last-compilation-successful-p ()
|
||||
(save-excursion
|
||||
(set-buffer inferior-erlang-buffer)
|
||||
(goto-char compilation-parsing-end)
|
||||
(erlang-eunit-all-list-elems-fulfill-p
|
||||
(lambda (re) (let ((continue t)
|
||||
(result t))
|
||||
(while continue ; ignore warnings, stop at errors
|
||||
(if (re-search-forward re (point-max) t)
|
||||
(if (erlang-eunit-is-compilation-warning)
|
||||
t
|
||||
(setq result nil)
|
||||
(setq continue nil))
|
||||
(setq result t)
|
||||
(setq continue nil)))
|
||||
result))
|
||||
(mapcar (lambda (e) (car e)) erlang-error-regexp-alist))))
|
||||
|
||||
(defun erlang-eunit-is-compilation-warning ()
|
||||
(erlang-eunit-string-match-p
|
||||
"[0-9]+: Warning:"
|
||||
(buffer-substring (line-beginning-position) (line-end-position))))
|
||||
|
||||
(defun erlang-eunit-all-list-elems-fulfill-p (pred list)
|
||||
(let ((matches-p t))
|
||||
(while (and list matches-p)
|
||||
(if (not (funcall pred (car list)))
|
||||
(setq matches-p nil))
|
||||
(setq list (cdr list)))
|
||||
matches-p))
|
||||
|
||||
;;; Evaluate a command in an erlang buffer
|
||||
(defun erlang-eunit-inferior-erlang-send-command (command)
|
||||
"Evaluate a command in an erlang buffer."
|
||||
(interactive "P")
|
||||
(inferior-erlang-prepare-for-input)
|
||||
(inferior-erlang-send-command command)
|
||||
(sit-for 0) ;; redisplay
|
||||
(inferior-erlang-wait-prompt))
|
||||
|
||||
|
||||
;;;====================================================================
|
||||
;;; Key bindings
|
||||
;;;====================================================================
|
||||
|
||||
(defconst erlang-eunit-key-bindings
|
||||
'(("\C-c\C-et" erlang-eunit-toggle-src-and-test-file-other-window)
|
||||
("\C-c\C-ek" erlang-eunit-compile-and-run-module-tests)
|
||||
("\C-c\C-ej" erlang-eunit-compile-and-run-current-test)
|
||||
("\C-c\C-el" erlang-eunit-compile-and-run-recent)
|
||||
("\C-c\C-ec" erlang-eunit-compile-and-run-module-tests-under-cover)
|
||||
("\C-c\C-ev" erlang-eunit-cover-compile)
|
||||
("\C-c\C-ea" erlang-eunit-analyze-coverage)))
|
||||
|
||||
(defun erlang-eunit-add-key-bindings ()
|
||||
(dolist (binding erlang-eunit-key-bindings)
|
||||
(erlang-eunit-bind-key (car binding) (cadr binding))))
|
||||
|
||||
(defun erlang-eunit-bind-key (key function)
|
||||
(erlang-eunit-ensure-keymap-for-key key)
|
||||
(local-set-key key function))
|
||||
|
||||
(defun erlang-eunit-ensure-keymap-for-key (key-seq)
|
||||
(let ((prefix-keys (butlast (append key-seq nil)))
|
||||
(prefix-seq ""))
|
||||
(while prefix-keys
|
||||
(setq prefix-seq (concat prefix-seq (make-string 1 (car prefix-keys))))
|
||||
(setq prefix-keys (cdr prefix-keys))
|
||||
(if (not (keymapp (lookup-key (current-local-map) prefix-seq)))
|
||||
(local-set-key prefix-seq (make-sparse-keymap))))))
|
||||
|
||||
(add-hook 'erlang-mode-hook 'erlang-eunit-add-key-bindings)
|
||||
|
||||
|
||||
(provide 'erlang-eunit)
|
||||
;; erlang-eunit ends here
|
||||
@@ -1,102 +0,0 @@
|
||||
;; erlang-flymake.el
|
||||
;;
|
||||
;; Syntax check erlang source code on the fly (integrates with flymake).
|
||||
;;
|
||||
;; Start using flymake with erlang by putting the following somewhere
|
||||
;; in your .emacs file:
|
||||
;;
|
||||
;; (require 'erlang-flymake)
|
||||
;;
|
||||
;; Flymake is rather eager and does its syntax checks frequently by
|
||||
;; default and if you are bothered by this, you might want to put the
|
||||
;; following in your .emacs as well:
|
||||
;;
|
||||
;; (erlang-flymake-only-on-save)
|
||||
;;
|
||||
;; There are a couple of variables which control the compilation options:
|
||||
;; * erlang-flymake-get-code-path-dirs-function
|
||||
;; * erlang-flymake-get-include-dirs-function
|
||||
;; * erlang-flymake-extra-opts
|
||||
;;
|
||||
;; This code is inspired by http://www.emacswiki.org/emacs/FlymakeErlang.
|
||||
|
||||
(require 'flymake)
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(defvar erlang-flymake-command
|
||||
"erlc"
|
||||
"The command that will be used to perform the syntax check")
|
||||
|
||||
(defvar erlang-flymake-get-code-path-dirs-function
|
||||
'erlang-flymake-get-code-path-dirs
|
||||
"Return a list of ebin directories to add to the code path.")
|
||||
|
||||
(defvar erlang-flymake-get-include-dirs-function
|
||||
'erlang-flymake-get-include-dirs
|
||||
"Return a list of include directories to add to the compiler options.")
|
||||
|
||||
(defvar erlang-flymake-extra-opts
|
||||
(list "+warn_obsolete_guard"
|
||||
"+warn_unused_import"
|
||||
"+warn_shadow_vars"
|
||||
"+warn_export_vars"
|
||||
"+strong_validation"
|
||||
"+report")
|
||||
"A list of options that will be passed to the compiler")
|
||||
|
||||
(defun erlang-flymake-only-on-save ()
|
||||
"Trigger flymake only when the buffer is saved (disables syntax
|
||||
check on newline and when there are no changes)."
|
||||
(interactive)
|
||||
;; There doesn't seem to be a way of disabling this; set to the
|
||||
;; largest int available as a workaround (most-positive-fixnum
|
||||
;; equates to 8.5 years on my machine, so it ought to be enough ;-) )
|
||||
(setq flymake-no-changes-timeout most-positive-fixnum)
|
||||
(setq flymake-start-syntax-check-on-newline nil))
|
||||
|
||||
|
||||
(defun erlang-flymake-get-code-path-dirs ()
|
||||
(list (concat (erlang-flymake-get-app-dir) "ebin")))
|
||||
|
||||
(defun erlang-flymake-get-include-dirs ()
|
||||
(list (concat (erlang-flymake-get-app-dir) "include")))
|
||||
|
||||
(defun erlang-flymake-get-app-dir ()
|
||||
(let ((src-path (file-name-directory (buffer-file-name))))
|
||||
(file-name-directory (directory-file-name src-path))))
|
||||
|
||||
(defun erlang-flymake-init ()
|
||||
(let* ((temp-file
|
||||
(flet ((flymake-get-temp-dir () (erlang-flymake-temp-dir)))
|
||||
(flymake-init-create-temp-buffer-copy
|
||||
'flymake-create-temp-with-folder-structure)))
|
||||
(code-dir-opts
|
||||
(erlang-flymake-flatten
|
||||
(mapcar (lambda (dir) (list "-pa" dir))
|
||||
(funcall erlang-flymake-get-code-path-dirs-function))))
|
||||
(inc-dir-opts
|
||||
(erlang-flymake-flatten
|
||||
(mapcar (lambda (dir) (list "-I" dir))
|
||||
(funcall erlang-flymake-get-include-dirs-function))))
|
||||
(compile-opts
|
||||
(append inc-dir-opts
|
||||
code-dir-opts
|
||||
erlang-flymake-extra-opts)))
|
||||
(list erlang-flymake-command (append compile-opts (list temp-file)))))
|
||||
|
||||
(defun erlang-flymake-temp-dir ()
|
||||
;; Squeeze the user's name in there in order to make sure that files
|
||||
;; for two users who are working on the same computer (like a linux
|
||||
;; box) don't collide
|
||||
(format "%s/flymake-%s" temporary-file-directory user-login-name))
|
||||
|
||||
(defun erlang-flymake-flatten (list)
|
||||
(apply #'append list))
|
||||
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.erl\\'" erlang-flymake-init))
|
||||
(add-hook 'erlang-mode-hook 'flymake-mode)
|
||||
|
||||
(provide 'erlang-flymake)
|
||||
;; erlang-flymake ends here
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,121 +0,0 @@
|
||||
;; erlang-start.el --- Load this file to initialize the Erlang package.
|
||||
|
||||
;; Copyright (C) 1998 Ericsson Telecom AB
|
||||
|
||||
;; Author: Anders Lindgren
|
||||
;; Version: 2.3
|
||||
;; Keywords: erlang, languages, processes
|
||||
;; Created: 1996-09-18
|
||||
;; Date: 1998-03-16
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Introduction:
|
||||
;; ------------
|
||||
;;
|
||||
;; This package provides support for the programming language Erlang.
|
||||
;; The package provides an editing mode with lots of bells and
|
||||
;; whistles, compilation support, and it makes it possible for the
|
||||
;; user to start Erlang shells that run inside Emacs.
|
||||
;;
|
||||
;; See the Erlang distribution for full documentation of this package.
|
||||
|
||||
;; Installation:
|
||||
;; ------------
|
||||
;;
|
||||
;; Place this file in Emacs load path, byte-compile it, and add the
|
||||
;; following line to the appropriate init file:
|
||||
;;
|
||||
;; (require 'erlang-start)
|
||||
;;
|
||||
;; The full documentation contains much more extensive description of
|
||||
;; the installation procedure.
|
||||
|
||||
;; Reporting Bugs:
|
||||
;; --------------
|
||||
;;
|
||||
;; Please send bug reports to the following email address:
|
||||
;; support@erlang.ericsson.se
|
||||
;;
|
||||
;; Please state as exactly as possible:
|
||||
;; - Version number of Erlang Mode (see the menu), Emacs, Erlang,
|
||||
;; and of any other relevant software.
|
||||
;; - What the expected result was.
|
||||
;; - What you did, preferably in a repeatable step-by-step form.
|
||||
;; - A description of the unexpected result.
|
||||
;; - Relevant pieces of Erlang code causing the problem.
|
||||
;; - Personal Emacs customisations, if any.
|
||||
;;
|
||||
;; Should the Emacs generate an error, please set the emacs variable
|
||||
;; `debug-on-error' to `t'. Repeat the error and enclose the debug
|
||||
;; information in your bug-report.
|
||||
;;
|
||||
;; To set the variable you can use the following command:
|
||||
;; M-x set-variable RET debug-on-error RET t RET
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;
|
||||
;; Declare functions in "erlang.el".
|
||||
;;
|
||||
|
||||
(autoload 'erlang-mode "erlang" "Major mode for editing Erlang code." t)
|
||||
(autoload 'erlang-version "erlang"
|
||||
"Return the current version of Erlang mode." t)
|
||||
(autoload 'erlang-shell "erlang" "Start a new Erlang shell." t)
|
||||
(autoload 'run-erlang "erlang" "Start a new Erlang shell." t)
|
||||
|
||||
(autoload 'erlang-compile "erlang"
|
||||
"Compile Erlang module in current buffer." t)
|
||||
|
||||
(autoload 'erlang-man-module "erlang"
|
||||
"Find manual page for MODULE." t)
|
||||
(autoload 'erlang-man-function "erlang"
|
||||
"Find manual page for NAME, where NAME is module:function." t)
|
||||
|
||||
(autoload 'erlang-find-tag "erlang"
|
||||
"Like `find-tag'. Capable of retreiving Erlang modules.")
|
||||
(autoload 'erlang-find-tag-other-window "erlang"
|
||||
"Like `find-tag-other-window'. Capable of retreiving Erlang modules.")
|
||||
|
||||
|
||||
;;
|
||||
;; Associate files extensions ".erl" and ".hrl" with Erlang mode.
|
||||
;;
|
||||
|
||||
(let ((a '("\\.erl\\'" . erlang-mode))
|
||||
(b '("\\.hrl\\'" . erlang-mode)))
|
||||
(or (assoc (car a) auto-mode-alist)
|
||||
(setq auto-mode-alist (cons a auto-mode-alist)))
|
||||
(or (assoc (car b) auto-mode-alist)
|
||||
(setq auto-mode-alist (cons b auto-mode-alist))))
|
||||
|
||||
;;
|
||||
;; Associate files using interpreter "escript" with Erlang mode.
|
||||
;;
|
||||
|
||||
(add-to-list 'interpreter-mode-alist (cons "escript" 'erlang-mode))
|
||||
|
||||
;;
|
||||
;; Ignore files ending in ".jam", ".vee", and ".beam" when performing
|
||||
;; file completion.
|
||||
;;
|
||||
|
||||
(let ((erl-ext '(".jam" ".vee" ".beam")))
|
||||
(while erl-ext
|
||||
(let ((cie completion-ignored-extensions))
|
||||
(while (and cie (not (string-equal (car cie) (car erl-ext))))
|
||||
(setq cie (cdr cie)))
|
||||
(if (null cie)
|
||||
(setq completion-ignored-extensions
|
||||
(cons (car erl-ext) completion-ignored-extensions))))
|
||||
(setq erl-ext (cdr erl-ext))))
|
||||
|
||||
|
||||
;;
|
||||
;; The end.
|
||||
;;
|
||||
|
||||
(provide 'erlang-start)
|
||||
|
||||
;; erlang-start.el ends here.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,659 +0,0 @@
|
||||
%% -*- erlang -*-
|
||||
%%
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
|
||||
%%
|
||||
%% The contents of this file are subject to the Erlang Public License,
|
||||
%% Version 1.1, (the "License"); you may not use this file except in
|
||||
%% compliance with the License. You should have received a copy of the
|
||||
%% Erlang Public License along with this software. If not, it can be
|
||||
%% retrieved online at http://www.erlang.org/.
|
||||
%%
|
||||
%% Software distributed under the License is distributed on an "AS IS"
|
||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
%% the License for the specific language governing rights and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
%% %CopyrightEnd%
|
||||
|
||||
%%%-------------------------------------------------------------------
|
||||
%%% File : test.erl
|
||||
%%% Author : Dan Gudmundsson <dan.gudmundsson@ericsson.com>
|
||||
%%% Description : Test emacs mode indention and font-locking
|
||||
%%% this file is intentionally not indented.
|
||||
%%% Copy the file and indent it and you should end up with test.erl.indented
|
||||
%%% Created : 6 Oct 2009 by Dan Gudmundsson <dan.gudmundsson@ericsson.com>
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
%% Start off with syntax highlighting you have to verify this by looking here
|
||||
%% and see that the code looks alright
|
||||
|
||||
-module(test).
|
||||
-compile(export_all).
|
||||
|
||||
%% Module attributes should be highlighted
|
||||
|
||||
-export([t/1]).
|
||||
-record(record1, {a,
|
||||
b,
|
||||
c
|
||||
}).
|
||||
-record(record2, {
|
||||
a,
|
||||
b
|
||||
}).
|
||||
|
||||
-record(record3, {a = 8#42423 bor
|
||||
8#4234,
|
||||
b = 8#5432
|
||||
bor 2#1010101
|
||||
c = 123 +
|
||||
234,
|
||||
d}).
|
||||
|
||||
-record(record4, {
|
||||
a = 8#42423 bor
|
||||
8#4234,
|
||||
b = 8#5432
|
||||
bor 2#1010101
|
||||
c = 123 +
|
||||
234,
|
||||
d}).
|
||||
|
||||
|
||||
-define(MACRO_1, macro).
|
||||
-define(MACRO_2(_), macro).
|
||||
|
||||
-spec t(integer()) -> any().
|
||||
|
||||
-type ann() :: Var :: integer().
|
||||
-type ann2() :: Var ::
|
||||
'return'
|
||||
| 'return_white_spaces'
|
||||
| 'return_comments'
|
||||
| 'text' | ann().
|
||||
-type paren() ::
|
||||
(ann2()).
|
||||
-type t1() :: atom().
|
||||
-type t2() :: [t1()].
|
||||
-type t3(Atom) :: integer(Atom).
|
||||
-type t4() :: t3(foobar).
|
||||
-type t5() :: {t1(), t3(foo)}.
|
||||
-type t6() :: 1 | 2 | 3 |
|
||||
'foo' | 'bar'.
|
||||
-type t7() :: [].
|
||||
-type t71() :: [_].
|
||||
-type t8() :: {any(),none(),pid(),port(),
|
||||
reference(),float()}.
|
||||
-type t9() :: [1|2|3|foo|bar] |
|
||||
list(a | b | c) | t71().
|
||||
-type t10() :: {1|2|3|foo|t9()} | {}.
|
||||
-type t11() :: 1..2.
|
||||
-type t13() :: maybe_improper_list(integer(), t11()).
|
||||
-type t14() :: [erl_scan:foo() |
|
||||
%% Should be highlighted
|
||||
term() |
|
||||
bool() |
|
||||
byte() |
|
||||
char() |
|
||||
non_neg_integer() | nonempty_list() |
|
||||
pos_integer() |
|
||||
neg_integer() |
|
||||
number() |
|
||||
list() |
|
||||
nonempty_improper_list() | nonempty_maybe_improper_list() |
|
||||
maybe_improper_list() | string() | iolist() | byte() |
|
||||
module() |
|
||||
mfa() |
|
||||
node() |
|
||||
timeout() |
|
||||
no_return() |
|
||||
%% Should not be highlighted
|
||||
nonempty_() | nonlist() |
|
||||
erl_scan:bar(34, 92) | t13() | m:f(integer() | <<_:_*16>>)].
|
||||
|
||||
|
||||
-type t15() :: {binary(),<<>>,<<_:34>>,<<_:_*42>>,
|
||||
<<_:3,_:_*14>>,<<>>} | [<<>>|<<_:34>>|<<_:16>>|
|
||||
<<_:3,_:_*1472>>|<<_:19,_:_*14>>| <<_:34>>|
|
||||
<<_:34>>|<<_:34>>|<<_:34>>].
|
||||
-type t16() :: fun().
|
||||
-type t17() :: fun((...) -> paren()).
|
||||
-type t18() :: fun(() -> t17() | t16()).
|
||||
-type t19() :: fun((t18()) -> t16()) |
|
||||
fun((nonempty_maybe_improper_list('integer', any())|
|
||||
1|2|3|a|b|<<_:3,_:_*14>>|integer()) ->
|
||||
nonempty_maybe_improper_list('integer', any())|
|
||||
1|2|3|a|b|<<_:3,_:_*14>>|integer()).
|
||||
-type t20() :: [t19(), ...].
|
||||
-type t21() :: tuple().
|
||||
-type t21(A) :: A.
|
||||
-type t22() :: t21(integer()).
|
||||
-type t23() :: #rec1{}.
|
||||
-type t24() :: #rec2{a :: t23(), b :: [atom()]}.
|
||||
-type t25() :: #rec3{f123 :: [t24() |
|
||||
1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())]}.
|
||||
-type t99() ::
|
||||
{t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(),
|
||||
t15(),t20(),t21(), t22(),t25()}.
|
||||
-spec t1(FooBar :: t99()) -> t99();
|
||||
(t2()) -> t2();
|
||||
(t4()) -> t4() when is_subtype(t4(), t24);
|
||||
(t23()) -> t23() when is_subtype(t23(), atom()),
|
||||
is_subtype(t23(), t14());
|
||||
(t24()) -> t24() when is_subtype(t24(), atom()),
|
||||
is_subtype(t24(), t14()),
|
||||
is_subtype(t24(), t4()).
|
||||
|
||||
-spec over(I :: integer()) -> R1 :: foo:typen();
|
||||
(A :: atom()) -> R2 :: foo:atomen();
|
||||
(T :: tuple()) -> R3 :: bar:typen().
|
||||
|
||||
-spec mod:t2() -> any().
|
||||
|
||||
-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]}
|
||||
| {'del_member', name(), pid()},
|
||||
#state{}) -> {'noreply', #state{}}.
|
||||
|
||||
-spec handle_cast(Cast ::
|
||||
{'exchange', node(), [[name(),...]]}
|
||||
| {'del_member', name(), pid()},
|
||||
#state{}) -> {'noreply', #state{}}.
|
||||
|
||||
-spec all(fun((T) -> boolean()), List :: [T]) ->
|
||||
boolean() when is_subtype(T, term()). % (*)
|
||||
|
||||
-spec get_closest_pid(term()) ->
|
||||
Return :: pid()
|
||||
| {'error', {'no_process', term()}
|
||||
| {'no_such_group', term()}}.
|
||||
|
||||
-opaque attributes_data() ::
|
||||
[{'column', column()} | {'line', info_line()} |
|
||||
{'text', string()}] | {line(),column()}.
|
||||
-record(r,{
|
||||
f1 :: attributes_data(),
|
||||
f222 = foo:bar(34, #rec3{}, 234234234423,
|
||||
aassdsfsdfsdf, 2234242323) ::
|
||||
[t24() | 1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())],
|
||||
f333 :: [t24() | 1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())],
|
||||
f3 = x:y(),
|
||||
f4 = x:z() :: t99(),
|
||||
f17 :: 'undefined',
|
||||
f18 :: 1 | 2 | 'undefined',
|
||||
f19 = 3 :: integer()|undefined,
|
||||
f5 = 3 :: undefined|integer()}).
|
||||
|
||||
-record(state, {
|
||||
sequence_number = 1 :: integer()
|
||||
}).
|
||||
|
||||
|
||||
highlighting(X) % Function definitions should be highlighted
|
||||
when is_integer(X) -> % and so should `when' and `is_integer' be
|
||||
%% Highlighting
|
||||
%% Various characters (we keep an `atom' after to see that highlighting ends)
|
||||
$a,atom, % Characters should be marked
|
||||
"string",atom, % and strings
|
||||
'asdasd',atom, % quote should be atoms??
|
||||
'VaV',atom,
|
||||
'aVa',atom,
|
||||
'\'atom',atom,
|
||||
'atom\'',atom,
|
||||
'at\'om',atom,
|
||||
'#1',atom,
|
||||
|
||||
$", atom, % atom should be ok
|
||||
$', atom,
|
||||
|
||||
"string$", atom, "string$", atom, % currently buggy I know...
|
||||
"string\$", atom, % workaround for bug above
|
||||
|
||||
"char $in string", atom,
|
||||
|
||||
$[, ${, $\\, atom,
|
||||
?MACRO_1,
|
||||
?MACRO_2(foo),
|
||||
|
||||
%% Numerical constants
|
||||
16#DD, % AD Should not be highlighted
|
||||
32#dd, % AD Should not be highlighted
|
||||
32#ddAB, % AD Should not be highlighted
|
||||
32#101, % AD Should not be highlighted
|
||||
32#ABTR, % AD Should not be highlighted
|
||||
|
||||
%% Variables
|
||||
Variables = lists:foo(),
|
||||
_Variables = lists:foo(), % AD
|
||||
AppSpec = Xyz/2,
|
||||
Module42 = Xyz(foo, bar),
|
||||
Module:foo(),
|
||||
_Module:foo(), % AD
|
||||
FooÅÅ = lists:reverse([tl,hd,tl,hd]), % AD Should highlight FooÅÅ
|
||||
_FooÅÅ = 42, % AD Should highlight _FooÅÅ
|
||||
|
||||
%% Bifs
|
||||
erlang:registered(),
|
||||
registered(),
|
||||
hd(tl(tl(hd([a,b,c])))),
|
||||
erlang:anything(lists),
|
||||
%% Guards
|
||||
is_atom(foo), is_float(2.3), is_integer(32), is_number(4323.3),
|
||||
is_function(Fun), is_pid(self()),
|
||||
not_a_guard:is_list([]),
|
||||
%% Other Types
|
||||
|
||||
atom, % not (currently) hightlighted
|
||||
234234,
|
||||
234.43,
|
||||
|
||||
[list, are, not, higlighted],
|
||||
{nor, is, tuple},
|
||||
ok.
|
||||
|
||||
%%%
|
||||
%%% Indentation
|
||||
%%%
|
||||
|
||||
%%% Left
|
||||
|
||||
%% Indented
|
||||
|
||||
% Right
|
||||
|
||||
|
||||
indent_basics(X, Y, Z)
|
||||
when X > 42,
|
||||
Z < 13;
|
||||
Y =:= 4711 ->
|
||||
%% comments
|
||||
% right comments
|
||||
case lists:filter(fun(_, AlongName,
|
||||
B,
|
||||
C) ->
|
||||
true
|
||||
end,
|
||||
[a,v,b])
|
||||
of
|
||||
[] ->
|
||||
Y = 5 * 43,
|
||||
ok;
|
||||
[_|_] ->
|
||||
Y = 5 * 43,
|
||||
ok
|
||||
end,
|
||||
Y,
|
||||
%% List, tuples and binaries
|
||||
[a,
|
||||
b, c
|
||||
],
|
||||
[ a,
|
||||
b, c
|
||||
],
|
||||
|
||||
[
|
||||
a,
|
||||
b
|
||||
],
|
||||
{a,
|
||||
b,c
|
||||
},
|
||||
{ a,
|
||||
b,c
|
||||
},
|
||||
|
||||
{
|
||||
a,
|
||||
b
|
||||
},
|
||||
|
||||
<<1:8,
|
||||
2:8
|
||||
>>,
|
||||
<<
|
||||
1:8,
|
||||
2:8
|
||||
>>,
|
||||
<< 1:8,
|
||||
2:8
|
||||
>>,
|
||||
|
||||
(a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
( a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
|
||||
(
|
||||
a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
call(2#42423 bor
|
||||
#4234,
|
||||
2#5432,
|
||||
other_arg),
|
||||
ok;
|
||||
indent_basics(Xlongname,
|
||||
#struct{a=Foo,
|
||||
b=Bar},
|
||||
[X|
|
||||
Y]) ->
|
||||
testing_next_clause,
|
||||
ok;
|
||||
indent_basics( % AD added clause
|
||||
X, % not sure how this should look
|
||||
Y,
|
||||
Z)
|
||||
when
|
||||
X < 42, Z > 13;
|
||||
Y =:= 4711 ->
|
||||
foo;
|
||||
indent_basics(X, Y, Z) when % AD added clause
|
||||
X < 42, Z > 13; % testing when indentation
|
||||
Y =:= 4711 ->
|
||||
foo;
|
||||
indent_basics(X, Y, Z) % AD added clause
|
||||
when % testing when indentation
|
||||
X < 42, Z > 13; % unsure about this one
|
||||
Y =:= 4711 ->
|
||||
foo.
|
||||
|
||||
|
||||
|
||||
indent_nested() ->
|
||||
[
|
||||
{foo, 2, "string"},
|
||||
{bar, 3, "another string"}
|
||||
].
|
||||
|
||||
|
||||
indent_icr(Z) -> % icr = if case receive
|
||||
%% If
|
||||
if Z >= 0 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z =< 10 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z == 5 orelse
|
||||
Z == 7 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
true ->
|
||||
if_works
|
||||
end,
|
||||
%% Case
|
||||
case {Z, foo, bar} of
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_} when
|
||||
Z =:= 42 -> % AD line should be indented as a when
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_}
|
||||
when Z < 10 -> % AD when should be indented
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_}
|
||||
when % AD when should be indented
|
||||
Z < 10 % and the guards should follow when
|
||||
andalso % unsure about how though
|
||||
true ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
end,
|
||||
%% begin
|
||||
begin
|
||||
sune,
|
||||
X = 74234 + foo(8456) +
|
||||
345 div 43,
|
||||
ok
|
||||
end,
|
||||
|
||||
|
||||
%% receive
|
||||
receive
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
end,
|
||||
receive
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z % AD added clause
|
||||
when Z =:= 1 -> % This line should be indented by 2
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z when % AD added clause
|
||||
Z =:= 2 -> % This line should be indented by 2
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
after infinity ->
|
||||
foo(X),
|
||||
asd(X),
|
||||
5*43
|
||||
end,
|
||||
receive
|
||||
after 10 ->
|
||||
foo(X),
|
||||
asd(X),
|
||||
5*43
|
||||
end,
|
||||
ok.
|
||||
|
||||
indent_fun() ->
|
||||
%% Changed fun to one indention level
|
||||
Var = spawn(fun(X)
|
||||
when X == 2;
|
||||
X > 10 ->
|
||||
hello,
|
||||
case Hello() of
|
||||
true when is_atom(X) ->
|
||||
foo;
|
||||
false ->
|
||||
bar
|
||||
end;
|
||||
(Foo) when is_atom(Foo),
|
||||
is_integer(X) ->
|
||||
X = 6* 45,
|
||||
Y = true andalso
|
||||
kalle
|
||||
end),
|
||||
ok.
|
||||
|
||||
indent_try_catch() ->
|
||||
try
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2)
|
||||
catch
|
||||
exit:{badarg,R} ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R);
|
||||
error:R % AD added clause
|
||||
when R =:= 42 -> % when should be indented
|
||||
foo(R);
|
||||
error:R % AD added clause
|
||||
when % when should be indented
|
||||
R =:= 42 -> % but unsure about this (maybe 2 more)
|
||||
foo(R);
|
||||
error:R when % AD added clause
|
||||
R =:= foo -> % line should be 2 indented (works)
|
||||
foo(R);
|
||||
error:R ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R)
|
||||
after
|
||||
foo('after'),
|
||||
file:close(Xfile)
|
||||
end;
|
||||
indent_try_catch() ->
|
||||
try
|
||||
foo(bar)
|
||||
of
|
||||
X when true andalso
|
||||
kalle ->
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2);
|
||||
X % AD added clause
|
||||
when false andalso % when should be 2 indented
|
||||
bengt ->
|
||||
gurka();
|
||||
X when % AD added clause
|
||||
false andalso % line should be 2 indented
|
||||
not bengt ->
|
||||
gurka();
|
||||
X ->
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2)
|
||||
catch
|
||||
exit:{badarg,R} ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R);
|
||||
error:R ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R)
|
||||
after
|
||||
foo('after'),
|
||||
file:close(Xfile),
|
||||
bar(with_long_arg,
|
||||
with_second_arg)
|
||||
end;
|
||||
indent_try_catch() ->
|
||||
try foo()
|
||||
after
|
||||
foo(),
|
||||
bar(with_long_arg,
|
||||
with_second_arg)
|
||||
end.
|
||||
|
||||
indent_catch() ->
|
||||
D = B +
|
||||
float(43.1),
|
||||
|
||||
B = catch oskar(X),
|
||||
|
||||
A = catch (baz +
|
||||
bax),
|
||||
catch foo(),
|
||||
|
||||
C = catch B +
|
||||
float(43.1),
|
||||
|
||||
case catch foo(X) of
|
||||
A ->
|
||||
B
|
||||
end,
|
||||
|
||||
case
|
||||
catch foo(X)
|
||||
of
|
||||
A ->
|
||||
B
|
||||
end,
|
||||
|
||||
case
|
||||
foo(X)
|
||||
of
|
||||
A ->
|
||||
catch B,
|
||||
X
|
||||
end,
|
||||
|
||||
try sune of
|
||||
_ -> foo
|
||||
catch _:_ -> baf
|
||||
end,
|
||||
|
||||
try
|
||||
sune
|
||||
of
|
||||
_ ->
|
||||
X = 5,
|
||||
(catch foo(X)),
|
||||
X + 10
|
||||
catch _:_ -> baf
|
||||
end,
|
||||
|
||||
try
|
||||
(catch sune)
|
||||
of
|
||||
_ ->
|
||||
catch foo() %% BUGBUG can't handle catch inside try without parentheses
|
||||
catch _:_ ->
|
||||
baf
|
||||
end,
|
||||
|
||||
try
|
||||
(catch exit())
|
||||
catch
|
||||
_ ->
|
||||
catch baf()
|
||||
end,
|
||||
ok.
|
||||
|
||||
indent_binary() ->
|
||||
X = lists:foldr(fun(M) ->
|
||||
<<Ma/binary, " ">>
|
||||
end, [], A),
|
||||
A = <<X/binary, 0:8>>,
|
||||
B.
|
||||
|
||||
|
||||
indent_comprehensions() ->
|
||||
%% I don't have a good idea how we want to handle this
|
||||
%% but they are here to show how they are indented today.
|
||||
Result1 = [X ||
|
||||
#record{a=X} <- lists:seq(1, 10),
|
||||
true = (X rem 2)
|
||||
],
|
||||
Result2 = [X || <<X:32,_:32>> <= <<0:512>>,
|
||||
true = (X rem 2)
|
||||
],
|
||||
|
||||
Binary1 = << <<X:8>> ||
|
||||
#record{a=X} <- lists:seq(1, 10),
|
||||
true = (X rem 2)
|
||||
>>,
|
||||
|
||||
Binary2 = << <<X:8>> || <<X:32,_:32>> <= <<0:512>>,
|
||||
true = (X rem 2)
|
||||
>>,
|
||||
ok.
|
||||
|
||||
%% This causes an error in earlier erlang-mode versions.
|
||||
foo() ->
|
||||
[#foo{
|
||||
foo = foo}].
|
||||
@@ -1,659 +0,0 @@
|
||||
%% -*- erlang -*-
|
||||
%%
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
|
||||
%%
|
||||
%% The contents of this file are subject to the Erlang Public License,
|
||||
%% Version 1.1, (the "License"); you may not use this file except in
|
||||
%% compliance with the License. You should have received a copy of the
|
||||
%% Erlang Public License along with this software. If not, it can be
|
||||
%% retrieved online at http://www.erlang.org/.
|
||||
%%
|
||||
%% Software distributed under the License is distributed on an "AS IS"
|
||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
%% the License for the specific language governing rights and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
%% %CopyrightEnd%
|
||||
|
||||
%%%-------------------------------------------------------------------
|
||||
%%% File : test.erl
|
||||
%%% Author : Dan Gudmundsson <dan.gudmundsson@ericsson.com>
|
||||
%%% Description : Test emacs mode indention and font-locking
|
||||
%%% this file is intentionally not indented.
|
||||
%%% Copy the file and indent it and you should end up with test.erl.indented
|
||||
%%% Created : 6 Oct 2009 by Dan Gudmundsson <dan.gudmundsson@ericsson.com>
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
%% Start off with syntax highlighting you have to verify this by looking here
|
||||
%% and see that the code looks alright
|
||||
|
||||
-module(test).
|
||||
-compile(export_all).
|
||||
|
||||
%% Module attributes should be highlighted
|
||||
|
||||
-export([t/1]).
|
||||
-record(record1, {a,
|
||||
b,
|
||||
c
|
||||
}).
|
||||
-record(record2, {
|
||||
a,
|
||||
b
|
||||
}).
|
||||
|
||||
-record(record3, {a = 8#42423 bor
|
||||
8#4234,
|
||||
b = 8#5432
|
||||
bor 2#1010101
|
||||
c = 123 +
|
||||
234,
|
||||
d}).
|
||||
|
||||
-record(record4, {
|
||||
a = 8#42423 bor
|
||||
8#4234,
|
||||
b = 8#5432
|
||||
bor 2#1010101
|
||||
c = 123 +
|
||||
234,
|
||||
d}).
|
||||
|
||||
|
||||
-define(MACRO_1, macro).
|
||||
-define(MACRO_2(_), macro).
|
||||
|
||||
-spec t(integer()) -> any().
|
||||
|
||||
-type ann() :: Var :: integer().
|
||||
-type ann2() :: Var ::
|
||||
'return'
|
||||
| 'return_white_spaces'
|
||||
| 'return_comments'
|
||||
| 'text' | ann().
|
||||
-type paren() ::
|
||||
(ann2()).
|
||||
-type t1() :: atom().
|
||||
-type t2() :: [t1()].
|
||||
-type t3(Atom) :: integer(Atom).
|
||||
-type t4() :: t3(foobar).
|
||||
-type t5() :: {t1(), t3(foo)}.
|
||||
-type t6() :: 1 | 2 | 3 |
|
||||
'foo' | 'bar'.
|
||||
-type t7() :: [].
|
||||
-type t71() :: [_].
|
||||
-type t8() :: {any(),none(),pid(),port(),
|
||||
reference(),float()}.
|
||||
-type t9() :: [1|2|3|foo|bar] |
|
||||
list(a | b | c) | t71().
|
||||
-type t10() :: {1|2|3|foo|t9()} | {}.
|
||||
-type t11() :: 1..2.
|
||||
-type t13() :: maybe_improper_list(integer(), t11()).
|
||||
-type t14() :: [erl_scan:foo() |
|
||||
%% Should be highlighted
|
||||
term() |
|
||||
bool() |
|
||||
byte() |
|
||||
char() |
|
||||
non_neg_integer() | nonempty_list() |
|
||||
pos_integer() |
|
||||
neg_integer() |
|
||||
number() |
|
||||
list() |
|
||||
nonempty_improper_list() | nonempty_maybe_improper_list() |
|
||||
maybe_improper_list() | string() | iolist() | byte() |
|
||||
module() |
|
||||
mfa() |
|
||||
node() |
|
||||
timeout() |
|
||||
no_return() |
|
||||
%% Should not be highlighted
|
||||
nonempty_() | nonlist() |
|
||||
erl_scan:bar(34, 92) | t13() | m:f(integer() | <<_:_*16>>)].
|
||||
|
||||
|
||||
-type t15() :: {binary(),<<>>,<<_:34>>,<<_:_*42>>,
|
||||
<<_:3,_:_*14>>,<<>>} | [<<>>|<<_:34>>|<<_:16>>|
|
||||
<<_:3,_:_*1472>>|<<_:19,_:_*14>>| <<_:34>>|
|
||||
<<_:34>>|<<_:34>>|<<_:34>>].
|
||||
-type t16() :: fun().
|
||||
-type t17() :: fun((...) -> paren()).
|
||||
-type t18() :: fun(() -> t17() | t16()).
|
||||
-type t19() :: fun((t18()) -> t16()) |
|
||||
fun((nonempty_maybe_improper_list('integer', any())|
|
||||
1|2|3|a|b|<<_:3,_:_*14>>|integer()) ->
|
||||
nonempty_maybe_improper_list('integer', any())|
|
||||
1|2|3|a|b|<<_:3,_:_*14>>|integer()).
|
||||
-type t20() :: [t19(), ...].
|
||||
-type t21() :: tuple().
|
||||
-type t21(A) :: A.
|
||||
-type t22() :: t21(integer()).
|
||||
-type t23() :: #rec1{}.
|
||||
-type t24() :: #rec2{a :: t23(), b :: [atom()]}.
|
||||
-type t25() :: #rec3{f123 :: [t24() |
|
||||
1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())]}.
|
||||
-type t99() ::
|
||||
{t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(),
|
||||
t15(),t20(),t21(), t22(),t25()}.
|
||||
-spec t1(FooBar :: t99()) -> t99();
|
||||
(t2()) -> t2();
|
||||
(t4()) -> t4() when is_subtype(t4(), t24);
|
||||
(t23()) -> t23() when is_subtype(t23(), atom()),
|
||||
is_subtype(t23(), t14());
|
||||
(t24()) -> t24() when is_subtype(t24(), atom()),
|
||||
is_subtype(t24(), t14()),
|
||||
is_subtype(t24(), t4()).
|
||||
|
||||
-spec over(I :: integer()) -> R1 :: foo:typen();
|
||||
(A :: atom()) -> R2 :: foo:atomen();
|
||||
(T :: tuple()) -> R3 :: bar:typen().
|
||||
|
||||
-spec mod:t2() -> any().
|
||||
|
||||
-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]}
|
||||
| {'del_member', name(), pid()},
|
||||
#state{}) -> {'noreply', #state{}}.
|
||||
|
||||
-spec handle_cast(Cast ::
|
||||
{'exchange', node(), [[name(),...]]}
|
||||
| {'del_member', name(), pid()},
|
||||
#state{}) -> {'noreply', #state{}}.
|
||||
|
||||
-spec all(fun((T) -> boolean()), List :: [T]) ->
|
||||
boolean() when is_subtype(T, term()). % (*)
|
||||
|
||||
-spec get_closest_pid(term()) ->
|
||||
Return :: pid()
|
||||
| {'error', {'no_process', term()}
|
||||
| {'no_such_group', term()}}.
|
||||
|
||||
-opaque attributes_data() ::
|
||||
[{'column', column()} | {'line', info_line()} |
|
||||
{'text', string()}] | {line(),column()}.
|
||||
-record(r,{
|
||||
f1 :: attributes_data(),
|
||||
f222 = foo:bar(34, #rec3{}, 234234234423,
|
||||
aassdsfsdfsdf, 2234242323) ::
|
||||
[t24() | 1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())],
|
||||
f333 :: [t24() | 1|2|3|4|a|b|c|d|
|
||||
nonempty_maybe_improper_list(integer, any())],
|
||||
f3 = x:y(),
|
||||
f4 = x:z() :: t99(),
|
||||
f17 :: 'undefined',
|
||||
f18 :: 1 | 2 | 'undefined',
|
||||
f19 = 3 :: integer()|undefined,
|
||||
f5 = 3 :: undefined|integer()}).
|
||||
|
||||
-record(state, {
|
||||
sequence_number = 1 :: integer()
|
||||
}).
|
||||
|
||||
|
||||
highlighting(X) % Function definitions should be highlighted
|
||||
when is_integer(X) -> % and so should `when' and `is_integer' be
|
||||
%% Highlighting
|
||||
%% Various characters (we keep an `atom' after to see that highlighting ends)
|
||||
$a,atom, % Characters should be marked
|
||||
"string",atom, % and strings
|
||||
'asdasd',atom, % quote should be atoms??
|
||||
'VaV',atom,
|
||||
'aVa',atom,
|
||||
'\'atom',atom,
|
||||
'atom\'',atom,
|
||||
'at\'om',atom,
|
||||
'#1',atom,
|
||||
|
||||
$", atom, % atom should be ok
|
||||
$', atom,
|
||||
|
||||
"string$", atom, "string$", atom, % currently buggy I know...
|
||||
"string\$", atom, % workaround for bug above
|
||||
|
||||
"char $in string", atom,
|
||||
|
||||
$[, ${, $\\, atom,
|
||||
?MACRO_1,
|
||||
?MACRO_2(foo),
|
||||
|
||||
%% Numerical constants
|
||||
16#DD, % AD Should not be highlighted
|
||||
32#dd, % AD Should not be highlighted
|
||||
32#ddAB, % AD Should not be highlighted
|
||||
32#101, % AD Should not be highlighted
|
||||
32#ABTR, % AD Should not be highlighted
|
||||
|
||||
%% Variables
|
||||
Variables = lists:foo(),
|
||||
_Variables = lists:foo(), % AD
|
||||
AppSpec = Xyz/2,
|
||||
Module42 = Xyz(foo, bar),
|
||||
Module:foo(),
|
||||
_Module:foo(), % AD
|
||||
FooÅÅ = lists:reverse([tl,hd,tl,hd]), % AD Should highlight FooÅÅ
|
||||
_FooÅÅ = 42, % AD Should highlight _FooÅÅ
|
||||
|
||||
%% Bifs
|
||||
erlang:registered(),
|
||||
registered(),
|
||||
hd(tl(tl(hd([a,b,c])))),
|
||||
erlang:anything(lists),
|
||||
%% Guards
|
||||
is_atom(foo), is_float(2.3), is_integer(32), is_number(4323.3),
|
||||
is_function(Fun), is_pid(self()),
|
||||
not_a_guard:is_list([]),
|
||||
%% Other Types
|
||||
|
||||
atom, % not (currently) hightlighted
|
||||
234234,
|
||||
234.43,
|
||||
|
||||
[list, are, not, higlighted],
|
||||
{nor, is, tuple},
|
||||
ok.
|
||||
|
||||
%%%
|
||||
%%% Indentation
|
||||
%%%
|
||||
|
||||
%%% Left
|
||||
|
||||
%% Indented
|
||||
|
||||
% Right
|
||||
|
||||
|
||||
indent_basics(X, Y, Z)
|
||||
when X > 42,
|
||||
Z < 13;
|
||||
Y =:= 4711 ->
|
||||
%% comments
|
||||
% right comments
|
||||
case lists:filter(fun(_, AlongName,
|
||||
B,
|
||||
C) ->
|
||||
true
|
||||
end,
|
||||
[a,v,b])
|
||||
of
|
||||
[] ->
|
||||
Y = 5 * 43,
|
||||
ok;
|
||||
[_|_] ->
|
||||
Y = 5 * 43,
|
||||
ok
|
||||
end,
|
||||
Y,
|
||||
%% List, tuples and binaries
|
||||
[a,
|
||||
b, c
|
||||
],
|
||||
[ a,
|
||||
b, c
|
||||
],
|
||||
|
||||
[
|
||||
a,
|
||||
b
|
||||
],
|
||||
{a,
|
||||
b,c
|
||||
},
|
||||
{ a,
|
||||
b,c
|
||||
},
|
||||
|
||||
{
|
||||
a,
|
||||
b
|
||||
},
|
||||
|
||||
<<1:8,
|
||||
2:8
|
||||
>>,
|
||||
<<
|
||||
1:8,
|
||||
2:8
|
||||
>>,
|
||||
<< 1:8,
|
||||
2:8
|
||||
>>,
|
||||
|
||||
(a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
( a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
|
||||
(
|
||||
a,
|
||||
b,
|
||||
c
|
||||
),
|
||||
|
||||
call(2#42423 bor
|
||||
#4234,
|
||||
2#5432,
|
||||
other_arg),
|
||||
ok;
|
||||
indent_basics(Xlongname,
|
||||
#struct{a=Foo,
|
||||
b=Bar},
|
||||
[X|
|
||||
Y]) ->
|
||||
testing_next_clause,
|
||||
ok;
|
||||
indent_basics( % AD added clause
|
||||
X, % not sure how this should look
|
||||
Y,
|
||||
Z)
|
||||
when
|
||||
X < 42, Z > 13;
|
||||
Y =:= 4711 ->
|
||||
foo;
|
||||
indent_basics(X, Y, Z) when % AD added clause
|
||||
X < 42, Z > 13; % testing when indentation
|
||||
Y =:= 4711 ->
|
||||
foo;
|
||||
indent_basics(X, Y, Z) % AD added clause
|
||||
when % testing when indentation
|
||||
X < 42, Z > 13; % unsure about this one
|
||||
Y =:= 4711 ->
|
||||
foo.
|
||||
|
||||
|
||||
|
||||
indent_nested() ->
|
||||
[
|
||||
{foo, 2, "string"},
|
||||
{bar, 3, "another string"}
|
||||
].
|
||||
|
||||
|
||||
indent_icr(Z) -> % icr = if case receive
|
||||
%% If
|
||||
if Z >= 0 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z =< 10 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z == 5 orelse
|
||||
Z == 7 ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
true ->
|
||||
if_works
|
||||
end,
|
||||
%% Case
|
||||
case {Z, foo, bar} of
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_} when
|
||||
Z =:= 42 -> % AD line should be indented as a when
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_}
|
||||
when Z < 10 -> % AD when should be indented
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
{Z,_,_}
|
||||
when % AD when should be indented
|
||||
Z < 10 % and the guards should follow when
|
||||
andalso % unsure about how though
|
||||
true ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
end,
|
||||
%% begin
|
||||
begin
|
||||
sune,
|
||||
X = 74234 + foo(8456) +
|
||||
345 div 43,
|
||||
ok
|
||||
end,
|
||||
|
||||
|
||||
%% receive
|
||||
receive
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
end,
|
||||
receive
|
||||
{Z,_,_} ->
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z % AD added clause
|
||||
when Z =:= 1 -> % This line should be indented by 2
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z when % AD added clause
|
||||
Z =:= 2 -> % This line should be indented by 2
|
||||
X = 43 div 4,
|
||||
foo(X);
|
||||
Z ->
|
||||
X = 43 div 4,
|
||||
foo(X)
|
||||
after infinity ->
|
||||
foo(X),
|
||||
asd(X),
|
||||
5*43
|
||||
end,
|
||||
receive
|
||||
after 10 ->
|
||||
foo(X),
|
||||
asd(X),
|
||||
5*43
|
||||
end,
|
||||
ok.
|
||||
|
||||
indent_fun() ->
|
||||
%% Changed fun to one indention level
|
||||
Var = spawn(fun(X)
|
||||
when X == 2;
|
||||
X > 10 ->
|
||||
hello,
|
||||
case Hello() of
|
||||
true when is_atom(X) ->
|
||||
foo;
|
||||
false ->
|
||||
bar
|
||||
end;
|
||||
(Foo) when is_atom(Foo),
|
||||
is_integer(X) ->
|
||||
X = 6* 45,
|
||||
Y = true andalso
|
||||
kalle
|
||||
end),
|
||||
ok.
|
||||
|
||||
indent_try_catch() ->
|
||||
try
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2)
|
||||
catch
|
||||
exit:{badarg,R} ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R);
|
||||
error:R % AD added clause
|
||||
when R =:= 42 -> % when should be indented
|
||||
foo(R);
|
||||
error:R % AD added clause
|
||||
when % when should be indented
|
||||
R =:= 42 -> % but unsure about this (maybe 2 more)
|
||||
foo(R);
|
||||
error:R when % AD added clause
|
||||
R =:= foo -> % line should be 2 indented (works)
|
||||
foo(R);
|
||||
error:R ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R)
|
||||
after
|
||||
foo('after'),
|
||||
file:close(Xfile)
|
||||
end;
|
||||
indent_try_catch() ->
|
||||
try
|
||||
foo(bar)
|
||||
of
|
||||
X when true andalso
|
||||
kalle ->
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2);
|
||||
X % AD added clause
|
||||
when false andalso % when should be 2 indented
|
||||
bengt ->
|
||||
gurka();
|
||||
X when % AD added clause
|
||||
false andalso % line should be 2 indented
|
||||
not bengt ->
|
||||
gurka();
|
||||
X ->
|
||||
io:format(stdout, "Parsing file ~s, ",
|
||||
[St0#leex.xfile]),
|
||||
{ok,Line3,REAs,Actions,St3} =
|
||||
parse_rules(Xfile, Line2, Macs, St2)
|
||||
catch
|
||||
exit:{badarg,R} ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R);
|
||||
error:R ->
|
||||
foo(R),
|
||||
io:format(stdout,
|
||||
"ERROR reason ~p~n",
|
||||
R)
|
||||
after
|
||||
foo('after'),
|
||||
file:close(Xfile),
|
||||
bar(with_long_arg,
|
||||
with_second_arg)
|
||||
end;
|
||||
indent_try_catch() ->
|
||||
try foo()
|
||||
after
|
||||
foo(),
|
||||
bar(with_long_arg,
|
||||
with_second_arg)
|
||||
end.
|
||||
|
||||
indent_catch() ->
|
||||
D = B +
|
||||
float(43.1),
|
||||
|
||||
B = catch oskar(X),
|
||||
|
||||
A = catch (baz +
|
||||
bax),
|
||||
catch foo(),
|
||||
|
||||
C = catch B +
|
||||
float(43.1),
|
||||
|
||||
case catch foo(X) of
|
||||
A ->
|
||||
B
|
||||
end,
|
||||
|
||||
case
|
||||
catch foo(X)
|
||||
of
|
||||
A ->
|
||||
B
|
||||
end,
|
||||
|
||||
case
|
||||
foo(X)
|
||||
of
|
||||
A ->
|
||||
catch B,
|
||||
X
|
||||
end,
|
||||
|
||||
try sune of
|
||||
_ -> foo
|
||||
catch _:_ -> baf
|
||||
end,
|
||||
|
||||
try
|
||||
sune
|
||||
of
|
||||
_ ->
|
||||
X = 5,
|
||||
(catch foo(X)),
|
||||
X + 10
|
||||
catch _:_ -> baf
|
||||
end,
|
||||
|
||||
try
|
||||
(catch sune)
|
||||
of
|
||||
_ ->
|
||||
catch foo() %% BUGBUG can't handle catch inside try without parentheses
|
||||
catch _:_ ->
|
||||
baf
|
||||
end,
|
||||
|
||||
try
|
||||
(catch exit())
|
||||
catch
|
||||
_ ->
|
||||
catch baf()
|
||||
end,
|
||||
ok.
|
||||
|
||||
indent_binary() ->
|
||||
X = lists:foldr(fun(M) ->
|
||||
<<Ma/binary, " ">>
|
||||
end, [], A),
|
||||
A = <<X/binary, 0:8>>,
|
||||
B.
|
||||
|
||||
|
||||
indent_comprehensions() ->
|
||||
%% I don't have a good idea how we want to handle this
|
||||
%% but they are here to show how they are indented today.
|
||||
Result1 = [X ||
|
||||
#record{a=X} <- lists:seq(1, 10),
|
||||
true = (X rem 2)
|
||||
],
|
||||
Result2 = [X || <<X:32,_:32>> <= <<0:512>>,
|
||||
true = (X rem 2)
|
||||
],
|
||||
|
||||
Binary1 = << <<X:8>> ||
|
||||
#record{a=X} <- lists:seq(1, 10),
|
||||
true = (X rem 2)
|
||||
>>,
|
||||
|
||||
Binary2 = << <<X:8>> || <<X:32,_:32>> <= <<0:512>>,
|
||||
true = (X rem 2)
|
||||
>>,
|
||||
ok.
|
||||
|
||||
%% This causes an error in earlier erlang-mode versions.
|
||||
foo() ->
|
||||
[#foo{
|
||||
foo = foo}].
|
||||
@@ -1,13 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.feature" . feature-mode))
|
||||
|
||||
(defun customizations-for-feature-mode ()
|
||||
(interactive)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(flyspell-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'feature-mode-hook 'customizations-for-feature-mode)
|
||||
@@ -1,10 +0,0 @@
|
||||
;; Write commit messages in style
|
||||
(defun customizations-for-git-commit-mode ()
|
||||
(interactive)
|
||||
(flyspell-mode)
|
||||
(linum-mode t)
|
||||
(auto-fill-mode)
|
||||
(subword-mode)
|
||||
(fci-mode))
|
||||
|
||||
(add-hook 'git-commit-mode-hook 'customizations-for-git-commit-mode)
|
||||
@@ -1,18 +0,0 @@
|
||||
(defun customizations-for-go-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(whitespace-mode)
|
||||
(subword-mode)
|
||||
(setq tab-width 4)
|
||||
(define-key go-mode-map (kbd "RET") 'newline-and-indent)
|
||||
)
|
||||
|
||||
(add-hook 'go-mode-hook 'customizations-for-go-mode)
|
||||
|
||||
(setq gofmt-command "goimports")
|
||||
(add-hook 'before-save-hook #'gofmt-before-save)
|
||||
@@ -1,15 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.hamlc\\'" . haml-mode))
|
||||
|
||||
(defun customizations-for-haml-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'haml-mode-hook 'customizations-for-haml-mode)
|
||||
@@ -1,13 +0,0 @@
|
||||
;; (add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
|
||||
;; (add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
|
||||
|
||||
(defun customizations-for-html-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode))
|
||||
|
||||
(add-hook 'html-mode-hook 'customizations-for-html-mode)
|
||||
@@ -1,15 +0,0 @@
|
||||
(defun customizations-for-js-mode ()
|
||||
(interactive)
|
||||
(setq js-indent-level 2)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode))
|
||||
|
||||
(add-hook 'js-mode-hook 'customizations-for-js-mode)
|
||||
@@ -1,10 +0,0 @@
|
||||
(defun customizations-for-lisp-mode ()
|
||||
(interactive)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode))
|
||||
|
||||
(add-hook 'lisp-mode-hook 'customizations-for-lisp-mode)
|
||||
@@ -1,6 +0,0 @@
|
||||
;; Make Magit look a bit prettier with my theme
|
||||
(defun customizations-for-magit-mode ()
|
||||
(interactive)
|
||||
(linum-mode t))
|
||||
|
||||
(add-hook 'magit-mode-hook 'customizations-for-magit-mode)
|
||||
@@ -1,12 +0,0 @@
|
||||
(defun customizations-for-makefile-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq tab-width 4)
|
||||
(highlight-indentation-mode))
|
||||
|
||||
(add-hook 'makefile-mode-hook 'customizations-for-makefile-mode)
|
||||
@@ -1,17 +0,0 @@
|
||||
(setq auto-mode-alist (cons '("\\.md" . markdown-mode) auto-mode-alist))
|
||||
(setq auto-mode-alist (cons '("\\.mkd" . markdown-mode) auto-mode-alist))
|
||||
(setq auto-mode-alist (cons '("\\.mkdn" . markdown-mode) auto-mode-alist))
|
||||
(setq auto-mode-alist (cons '("\\.mdown" . markdown-mode) auto-mode-alist))
|
||||
(setq auto-mode-alist (cons '("\\.markdown" . markdown-mode) auto-mode-alist))
|
||||
|
||||
(defun customizations-for-markdown-mode ()
|
||||
(interactive)
|
||||
(setq whitespace-action nil)
|
||||
(fci-mode)
|
||||
(linum-mode t)
|
||||
(flyspell-mode)
|
||||
(auto-fill-mode)
|
||||
(subword-mode)
|
||||
(define-key markdown-mode-map (kbd "C-c p") 'markdown-preview))
|
||||
|
||||
(add-hook 'markdown-mode-hook 'customizations-for-markdown-mode)
|
||||
@@ -1,18 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode))
|
||||
|
||||
(defun customizations-for-php-mode ()
|
||||
(interactive)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq php-basic-offset 2)
|
||||
(setq tab-width 4)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'php-mode-hook 'customizations-for-php-mode)
|
||||
@@ -1,16 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.pp$" . puppet-mode))
|
||||
|
||||
(defun customizations-for-puppet-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode)
|
||||
(whitespace-mode)
|
||||
(subword-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'puppet-mode-hook 'customizations-for-puppet-mode)
|
||||
@@ -1,14 +0,0 @@
|
||||
(defun customizations-for-python-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq tab-width 4)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode)
|
||||
(define-key python-mode-map (kbd "RET") 'newline-and-indent))
|
||||
|
||||
(add-hook 'python-mode-hook 'customizations-for-python-mode)
|
||||
@@ -1,12 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.erb$" . rhtml-mode))
|
||||
|
||||
(defun customizations-for-rhtml-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode))
|
||||
|
||||
(add-hook 'rhtml-mode-hook 'customizations-for-rhtml-mode)
|
||||
@@ -1,94 +0,0 @@
|
||||
(autoload 'ruby-mode "ruby-mode" nil t)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.prawn\\'" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Vagrantfile" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Cheffile" . ruby-mode))
|
||||
(add-to-list 'auto-mode-alist '("Berksfile" . ruby-mode))
|
||||
|
||||
(defun customizations-for-ruby-mode ()
|
||||
(interactive)
|
||||
|
||||
(when (require 'ruby-compilation nil 'noerror)
|
||||
(define-key ruby-mode-map (kbd "s-r") 'ruby-compilation-this-buffer)
|
||||
(define-key ruby-mode-map (kbd "C-c C-r") 'ruby-compilation-this-buffer))
|
||||
|
||||
(when (require 'auto-complete nil 'noerror)
|
||||
(auto-complete-mode))
|
||||
|
||||
(when (require 'rsense nil 'noerror)
|
||||
(add-to-list 'ac-sources 'ac-source-rsense-method)
|
||||
(add-to-list 'ac-sources 'ac-source-rsense-constant)
|
||||
(define-key ruby-mode-map (kbd "C-c C-.") 'ac-complete-rsense))
|
||||
|
||||
(when (require 'projectile nil 'noerror)
|
||||
(define-key ruby-mode-map (kbd "C-x t") 'projectile-find-test-file)
|
||||
(define-key inf-ruby-minor-mode-map (kbd "C-c C-b") 'projectile-ibuffer)
|
||||
(define-key inf-ruby-minor-mode-map (kbd "C-c C-s")
|
||||
'projectile-switch-project))
|
||||
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(flyspell-prog-mode)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode)
|
||||
(hs-minor-mode 1)
|
||||
(flycheck-mode)
|
||||
(subword-mode)
|
||||
(setq ruby-deep-arglist nil)
|
||||
(setq ruby-deep-indent-paren nil)
|
||||
(setq c-tab-always-indent nil)
|
||||
(setq ruby-use-encoding-map nil)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent)
|
||||
(define-key ruby-mode-map (kbd "C-c C-h") 'toggle-hiding)
|
||||
(define-key ruby-mode-map (kbd "C-c C-l") 'goto-line)
|
||||
)
|
||||
|
||||
(add-hook 'ruby-mode-hook 'customizations-for-ruby-mode)
|
||||
|
||||
;; Set up hs-mode (HideShow) for Ruby
|
||||
(add-to-list 'hs-special-modes-alist
|
||||
`(ruby-mode
|
||||
,(rx (or "def" "class" "module" "do")) ; Block start
|
||||
,(rx (or "end")) ; Block end
|
||||
,(rx (or "#" "=begin")) ; Comment start
|
||||
ruby-forward-sexp nil))
|
||||
|
||||
;; Workaround for missing method in ruby-mode.el
|
||||
;; See: https://gist.github.com/1213051
|
||||
(defun ruby-insert-end ()
|
||||
"Insert \"end\" at point and reindent current line."
|
||||
(interactive)
|
||||
(insert "end")
|
||||
(ruby-indent-line t)
|
||||
(end-of-line))
|
||||
|
||||
;; Auto-complete when indenting
|
||||
(defadvice ruby-indent-command (around ac-before-ruby-indent activate)
|
||||
"Call `auto-complete' if text was recently entered"
|
||||
(if (ac-trigger-command-p last-command)
|
||||
(auto-complete)
|
||||
ad-do-it))
|
||||
|
||||
;; Yasnippet workaround for ruby-electric-mode
|
||||
;; See: http://code.google.com/p/yasnippet/issues/detail?id=71
|
||||
(defun yas/advise-indent-function (function-symbol)
|
||||
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
|
||||
,(format
|
||||
"Try to expand a snippet before point, then call `%s' as usual"
|
||||
function-symbol)
|
||||
(let ((yas/fallback-behavior nil))
|
||||
(unless (and (interactive-p)
|
||||
(yas/expand))
|
||||
ad-do-it)))))
|
||||
(yas/advise-indent-function 'ruby-indent-line)
|
||||
(yas/advise-indent-function 'ruby-indent-command)
|
||||
@@ -1,13 +0,0 @@
|
||||
(defun customizations-for-sass-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'sass-mode-hook 'customizations-for-sass-mode)
|
||||
@@ -1,24 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.bash\\'" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.zsh\\'" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.tcsh\\'" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.tmuxtheme\\'" . sh-mode))
|
||||
|
||||
(defun customizations-for-sh-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(hs-minor-mode 1)
|
||||
(auto-complete-mode)
|
||||
(whitespace-mode)
|
||||
(subword-mode)
|
||||
(setq sh-basic-offset 2)
|
||||
(setq sh-indentation 2)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(setq whitespace-action (quote (auto-cleanup)))
|
||||
(highlight-indentation-mode)
|
||||
(define-key sh-mode-map (kbd "RET") 'reindent-then-newline-and-indent))
|
||||
|
||||
(add-hook 'sh-mode-hook 'customizations-for-sh-mode)
|
||||
@@ -1,11 +0,0 @@
|
||||
(defun customizations-for-slim-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(setq tab-width 2)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode))
|
||||
|
||||
(add-hook 'slim-mode-hook 'customizations-for-slim-mode)
|
||||
@@ -1,18 +0,0 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.yml\\.example$" . yaml-mode))
|
||||
|
||||
(defun customizations-for-yaml-mode ()
|
||||
(interactive)
|
||||
(flyspell-prog-mode)
|
||||
(flycheck-mode)
|
||||
(linum-mode t)
|
||||
(fci-mode)
|
||||
(auto-complete-mode)
|
||||
(subword-mode)
|
||||
(setq highlight-indentation-offset 2)
|
||||
(highlight-indentation-mode)
|
||||
(highlight-indentation-current-column-mode)
|
||||
(define-key yaml-mode-map (kbd "RET") 'newline-and-indent))
|
||||
|
||||
(add-hook 'yaml-mode-hook 'customizations-for-yaml-mode)
|
||||
280
packages.el
280
packages.el
@@ -1,280 +0,0 @@
|
||||
;;
|
||||
;; Load package managers
|
||||
;;
|
||||
|
||||
;; Load Package
|
||||
(require 'cl)
|
||||
(require 'package)
|
||||
|
||||
;; Add MELPA.
|
||||
(add-to-list 'package-archives
|
||||
'("tromey" . "http://tromey.com/elpa/") t)
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "http://melpa.milkbox.net/packages/") t)
|
||||
|
||||
(package-initialize)
|
||||
|
||||
;; Load el-get
|
||||
(add-to-list 'load-path (get-config-path "el-get/el-get"))
|
||||
(require 'el-get)
|
||||
|
||||
|
||||
;;
|
||||
;; Define packages to install
|
||||
;;
|
||||
|
||||
;; Packages to install from MELPA
|
||||
(defvar my-melpa-packages
|
||||
'(
|
||||
ace-window
|
||||
;; ack-and-a-half
|
||||
auto-complete
|
||||
avy
|
||||
browse-kill-ring
|
||||
buffer-move
|
||||
coffee-mode
|
||||
dash-at-point
|
||||
diminish
|
||||
dired+
|
||||
ecb
|
||||
exec-path-from-shell
|
||||
expand-region
|
||||
feature-mode
|
||||
fill-column-indicator
|
||||
flycheck
|
||||
flymake-css
|
||||
flymake-cursor
|
||||
flymake-php
|
||||
fringe-helper
|
||||
full-ack
|
||||
git-gutter
|
||||
git-gutter-fringe
|
||||
git-timemachine
|
||||
gitconfig-mode
|
||||
github-browse-file
|
||||
go-autocomplete
|
||||
go-mode
|
||||
;; go-projectile
|
||||
go-snippets
|
||||
grizzl
|
||||
haml-mode
|
||||
helm
|
||||
helm-ack
|
||||
helm-ag
|
||||
helm-github-stars
|
||||
helm-open-github
|
||||
helm-projectile
|
||||
;; helm-swooop ;; causes error: "Package `helm-swooop-' is unavailable"
|
||||
highlight-indentation
|
||||
ido-vertical-mode
|
||||
inf-ruby
|
||||
jade-mode
|
||||
less-css-mode
|
||||
magit
|
||||
markdown-mode
|
||||
minimap
|
||||
move-text
|
||||
multiple-cursors
|
||||
neotree
|
||||
nvm
|
||||
phi-search
|
||||
php-mode
|
||||
project-explorer
|
||||
projectile
|
||||
pt
|
||||
puppet-mode
|
||||
rainbow-mode
|
||||
rbenv
|
||||
restclient
|
||||
rhtml-mode
|
||||
rubocop
|
||||
ruby-compilation
|
||||
ruby-interpolation
|
||||
sass-mode
|
||||
scss-mode
|
||||
smartparens
|
||||
smex
|
||||
smooth-scrolling
|
||||
string-inflection
|
||||
stylus-mode
|
||||
textmate
|
||||
twilight-anti-bright-theme
|
||||
twilight-bright-theme
|
||||
undo-tree
|
||||
;; workgroups2
|
||||
writegood-mode
|
||||
writeroom-mode
|
||||
yaml-mode
|
||||
yasnippet
|
||||
zencoding-mode
|
||||
)
|
||||
"A list of packages to install from MELPA at launch.")
|
||||
|
||||
;; Packages to install from el-get
|
||||
(defvar my-el-get-packages
|
||||
'(
|
||||
tomorrow-night-paradise-theme
|
||||
)
|
||||
"A list of packages to install from el-get at launch.")
|
||||
|
||||
;; Custom packages to install with el-get
|
||||
(setq el-get-sources
|
||||
'(
|
||||
;; (:name eproject
|
||||
;; :type git
|
||||
;; :url "https://github.com/jrockway/eproject.git"
|
||||
;; :post-init (progn
|
||||
;; (require 'eproject)
|
||||
;; (require 'eproject-extras)))
|
||||
(:name escreen
|
||||
:description "Emacs window session manager"
|
||||
:type github
|
||||
:pkgname "renard/escreen-el"
|
||||
:post-init (progn
|
||||
(autoload 'escreen-install "escreen" nil t)))
|
||||
(:name hackertype
|
||||
:type git
|
||||
:url "https://github.com/bitemyapp/hacker-type-emacs.git"
|
||||
:load "hackertype.el")
|
||||
(:name linum+
|
||||
:type http
|
||||
:url "http://dea.googlecode.com/svn/trunk/my-lisps/linum+.el")
|
||||
(:name ruby-mode
|
||||
:type http
|
||||
:url "https://raw.github.com/ruby/ruby/trunk/misc/ruby-mode.el")
|
||||
;; (:name rsense
|
||||
;; :description "Intelligent Ruby code-completion"
|
||||
;; :website "http://cx4a.org/software/rsense/"
|
||||
;; :type git
|
||||
;; :url "https://github.com/m2ym/rsense.git"
|
||||
;; :build ("ant" "chmod +x bin/rsense")
|
||||
;; :post-init (progn
|
||||
;; (setq rsense-home (expand-file-name default-directory))
|
||||
;; (add-to-list 'load-path (concat rsense-home "/etc"))
|
||||
;; (require 'rsense)))
|
||||
;; (:name tiling
|
||||
;; :type emacswiki
|
||||
;; :features tiling)
|
||||
(:name tree-mode
|
||||
:type http
|
||||
:url "http://www.emacswiki.org/emacs/download/tree-mode.el")
|
||||
(:name windata
|
||||
:type http
|
||||
:url "http://www.emacswiki.org/emacs/download/windata.el")
|
||||
(:name dirtree
|
||||
:type github
|
||||
:pkgname "zk/emacs-dirtree"
|
||||
:load "dirtree.el")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
;;
|
||||
;; Initialize Packages function (called by init.el)
|
||||
;;
|
||||
|
||||
(defun initialize-my-packages ()
|
||||
;; Activate ECB if window-system
|
||||
(when (require 'ecb nil 'noerror)
|
||||
(setq stack-trace-on-error t) ;; hack to fix a load-error
|
||||
(if window-system (ecb-activate)))
|
||||
|
||||
(when (require 'exec-path-from-shell)
|
||||
(when (memq window-system '(mac ns))
|
||||
(exec-path-from-shell-initialize)))
|
||||
|
||||
;; Load Auto-Complete
|
||||
(when (require 'auto-complete nil 'noerror)
|
||||
(require 'auto-complete-config)
|
||||
(ac-config-default)
|
||||
(ac-flyspell-workaround)
|
||||
|
||||
;; load go-autocomplete
|
||||
(require 'go-autocomplete nil 'noerror))
|
||||
|
||||
;; Load browse-kill-ring
|
||||
(require 'browse-kill-ring)
|
||||
|
||||
;; Load and setup Escreen
|
||||
(when (require 'escreen nil 'noerror)
|
||||
(escreen-install))
|
||||
|
||||
;; magit setup
|
||||
(setq magit-last-seen-setup-instructions "1.4.0")
|
||||
|
||||
;; Load and setup Workgroups2
|
||||
(when (require 'workgroups2 nil 'noerror)
|
||||
(workgroups-mode 1))
|
||||
|
||||
;; smartparens
|
||||
(when (require 'smartparens nil 'noerror)
|
||||
(require 'smartparens-config)
|
||||
(smartparens-global-mode))
|
||||
|
||||
;; Load Undo-Tree
|
||||
(require 'undo-tree)
|
||||
|
||||
;; Load Linum+
|
||||
(require 'linum+)
|
||||
|
||||
;; Load full-ack
|
||||
(require 'full-ack)
|
||||
|
||||
;; load go-projectile
|
||||
(require 'go-projectile nil 'noerror)
|
||||
|
||||
;; Load yasnippet
|
||||
(when (require 'yasnippet nil 'noerror)
|
||||
(yas/global-mode t))
|
||||
|
||||
;; Load zencoding-mode in any markup modes
|
||||
(when (require 'zencoding-mode nil 'noerror)
|
||||
(add-hook 'sgml-mode-hook 'zencoding-mode)))
|
||||
|
||||
|
||||
;;
|
||||
;; Package helpers (borrowed from Emacs Prelude)
|
||||
;;
|
||||
|
||||
(defun my-melpa-packages-installed-p ()
|
||||
"Check if all packages in `my-melpa-packages' are installed."
|
||||
(every #'package-installed-p my-melpa-packages))
|
||||
|
||||
(defun require-my-melpa-package (package)
|
||||
"Install PACKAGE unless already installed."
|
||||
(unless (memq package my-melpa-packages)
|
||||
(add-to-list 'my-melpa-packages package))
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
(defun require-my-melpa-packages (packages)
|
||||
"Ensure PACKAGES are installed.
|
||||
Missing packages are installed automatically."
|
||||
(mapc #'require-my-melpa-package packages))
|
||||
|
||||
(defun install-my-melpa-packages ()
|
||||
"Install all packages listed in `my-melpa-packages'."
|
||||
(unless (my-melpa-packages-installed-p)
|
||||
;; check for new packages (package versions)
|
||||
(message "%s" "Refreshing its package database...")
|
||||
(package-refresh-contents)
|
||||
(message "%s" " done.")
|
||||
;; install the missing packages
|
||||
(require-my-melpa-packages my-melpa-packages)))
|
||||
|
||||
|
||||
;;
|
||||
;; Install packages
|
||||
;;
|
||||
|
||||
;; Required because of a package.el bug
|
||||
(setq url-http-attempt-keepalives nil)
|
||||
|
||||
;; Install Melpa packages
|
||||
(install-my-melpa-packages)
|
||||
|
||||
;; Install el-get packages
|
||||
(setq el-get-packages
|
||||
(append my-el-get-packages (mapcar 'el-get-source-name el-get-sources)))
|
||||
(el-get 'sync el-get-packages)
|
||||
@@ -1,11 +0,0 @@
|
||||
(when (require 'eproject nil 'noerror)
|
||||
(define-project-type ruby (generic)
|
||||
(or (look-for "Rakefile") (look-for "Gemfile") (look-for "config.ru")
|
||||
(look-for "\.gemspec$") (look-for "Capfile"))
|
||||
:irrelevant-files ("^[#]" ".git/" "vendor/" "coverage/" "doc/" "docs/"
|
||||
"\.DS_Store"))
|
||||
|
||||
(define-project-type node-js (generic)
|
||||
(or (look-for "package.json") (look-for "Cakefile"))
|
||||
:irrelevant-files ("^[#]" ".git/" "node_modules"))
|
||||
)
|
||||
33
remember.el
33
remember.el
@@ -1,33 +0,0 @@
|
||||
(require 'org-install)
|
||||
(require 'remember)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
|
||||
|
||||
;; Remember mode configuration.
|
||||
(setq remember-annotation-functions '(org-remember-annotation))
|
||||
(setq remember-handler-functions '(org-remember-handler))
|
||||
(add-hook 'remember-mode-hook 'org-remember-apply-template)
|
||||
|
||||
;; Org-mode configuration
|
||||
(custom-set-variables
|
||||
'(org-agenda-files (list "~/.org-files/todos.org"
|
||||
"~/.org-files/notes.org"
|
||||
"~/.org-files/events.org"))
|
||||
'(org-directory "~/.org-files/")
|
||||
'(org-default-notes-files "~/.org-files/notes.org")
|
||||
|
||||
'(org-log-done t)
|
||||
'(org-agenda-ndays 7)
|
||||
'(org-deadline-warning-days 14)
|
||||
'(org-agenda-show-all-dates t)
|
||||
'(org-agenda-skip-deadline-if-done t)
|
||||
'(org-agenda-skip-scheduled-if-done t)
|
||||
'(org-agenda-start-on-weekday nil)
|
||||
'(org-reverse-note-order t)
|
||||
'(org-fast-tag-selection-single-key (quote expert))
|
||||
'(org-remember-store-without-prompt t)
|
||||
|
||||
;; Remember templates.
|
||||
'(org-remember-templates
|
||||
'(("Todo" ?t "** TODO %?\n" "~/.org-files/todos.org" "Tasks")
|
||||
("Note" ?n "** %?\n" "~/.org-files/notes.org" "Notes"))))
|
||||
@@ -1,13 +0,0 @@
|
||||
;;
|
||||
;; Node.js setup
|
||||
;;
|
||||
|
||||
;; node.js
|
||||
(setq exec-path (cons "~/.nvm/v0.12.4/bin" exec-path))
|
||||
(setenv "PATH" (concat "~/.nvm/v0.12.4/bin:" (getenv "PATH")))
|
||||
|
||||
;; ;; nvm package - does not work >_<
|
||||
;; (when (require 'nvm nil 'noerror)
|
||||
;; (setq nvm-dir (expand-file-name "~/.nvm/versions/node"))
|
||||
;; (when (file-directory-p nvm-dir)
|
||||
;; (nvm-use "v0.10.24")))
|
||||
@@ -1,13 +0,0 @@
|
||||
;;
|
||||
;; Ruby setup
|
||||
;;
|
||||
|
||||
;; rbenv
|
||||
(setq exec-path (cons "~/.rbenv/bin" exec-path))
|
||||
(setenv "PATH" (concat "~/.rbenv/bin:" (getenv "PATH")))
|
||||
(setq exec-path (cons "~/.rbenv/shims" exec-path))
|
||||
(setenv "PATH" (concat "~/.rbenv/shims:" (getenv "PATH")))
|
||||
|
||||
;; rbenv package - does not work >_<
|
||||
;; (when (require 'rbenv nil 'noerror)
|
||||
;; (global-rbenv-mode))
|
||||
Reference in New Issue
Block a user