├── settings ├── golang.el ├── elm.el ├── scala.el ├── vc.el ├── tramp.el ├── haml.el ├── html.el ├── css.el ├── latex.el ├── uniquify.el ├── java.el ├── dired.el ├── windows.el ├── helm.el ├── midnight.el ├── occur.el ├── cc.el ├── ess.el ├── org.el ├── copilot.el ├── csharp.el ├── csv.el ├── rspec.el ├── shell.el ├── ruby.el ├── largefile.el ├── markdown.el ├── compilation.el ├── python.el ├── matlab.el ├── grep.el ├── web.el ├── yasnippets.el ├── ido.el ├── evil.el └── magit.el ├── platform.el ├── .gitmodules ├── help.txt ├── themes.el ├── settings.el ├── snippets └── text-mode │ └── ruby-mode │ ├── ccy │ └── ccr ├── platform ├── ubuntu.el ├── windows.el └── mac.el ├── .gitignore ├── lisp ├── autosave.el └── csharp-mode.el ├── packages.el ├── functions.el ├── locals.el ├── themes ├── zen-and-art-theme.el ├── colors.txt └── john-zen-theme.el ├── vars.el ├── init.el └── alias.el /settings/golang.el: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings/elm.el: -------------------------------------------------------------------------------- 1 | ;; (require 'elm-mode) 2 | -------------------------------------------------------------------------------- /settings/scala.el: -------------------------------------------------------------------------------- 1 | (require 'scala-mode) 2 | -------------------------------------------------------------------------------- /settings/vc.el: -------------------------------------------------------------------------------- 1 | (setq vc-handled-backends '(git)) 2 | -------------------------------------------------------------------------------- /platform.el: -------------------------------------------------------------------------------- 1 | (load-file "~/.emacs.d/platform/mac.el") 2 | -------------------------------------------------------------------------------- /settings/tramp.el: -------------------------------------------------------------------------------- 1 | ;; place tramp settings 2 | (require 'tramp) 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "evil"] 2 | path = evil 3 | url = https://github.com/emacs-evil/evil 4 | -------------------------------------------------------------------------------- /help.txt: -------------------------------------------------------------------------------- 1 | regexp for to align text after a colon 2 | 3 | \(\s-*:\)\(\s-*\) 4 | align group 2 5 | -------------------------------------------------------------------------------- /settings/haml.el: -------------------------------------------------------------------------------- 1 | (require 'haml-mode) 2 | (setq auto-mode-alist (cons '("\\.hamlc$" . haml-mode) auto-mode-alist)) 3 | -------------------------------------------------------------------------------- /themes.el: -------------------------------------------------------------------------------- 1 | (add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") 2 | 3 | (load-theme 'john-zen t) 4 | ;; (load-theme 'zen-and-art t) 5 | -------------------------------------------------------------------------------- /settings/html.el: -------------------------------------------------------------------------------- 1 | (add-hook 'html-mode-hook 2 | (lambda () 3 | (define-key html-mode-map "\C-ch" 'sgml-close-tag))) 4 | -------------------------------------------------------------------------------- /settings.el: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Load my custom settings for modes 3 | ;; 4 | (mapc 'load (directory-files "~/.emacs.d/settings" t "^[A-Za-z]*\\.el")) 5 | (setq-default tab-width 2) 6 | -------------------------------------------------------------------------------- /settings/css.el: -------------------------------------------------------------------------------- 1 | (require 'css-mode) 2 | 3 | (setq css-indent-offset 2) 4 | (setq scss-compile-at-save nil) 5 | 6 | (add-to-list 'auto-mode-alist '("\\.less" . scss-mode)) 7 | -------------------------------------------------------------------------------- /settings/latex.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; Latex 3 | ;;======================================================================== 4 | -------------------------------------------------------------------------------- /settings/uniquify.el: -------------------------------------------------------------------------------- 1 | (require 'uniquify) 2 | (setq uniquify-buffer-name-style 'forward 3 | uniquify-ignore-buffers-re "^\\*" 4 | load-prefer-newer t 5 | backup-by-copying t) 6 | -------------------------------------------------------------------------------- /settings/java.el: -------------------------------------------------------------------------------- 1 | ;; flex mode for CS143 class 2 | (setq auto-mode-alist (cons '("\\.lex$" . java-mode) auto-mode-alist)) 3 | (setq auto-mode-alist (cons '("\\.flex$" . c++-mode) auto-mode-alist)) 4 | -------------------------------------------------------------------------------- /snippets/text-mode/ruby-mode/ccy: -------------------------------------------------------------------------------- 1 | #name : comment yardoc 2 | #binding: C-c y 3 | #group : comments 4 | # -- 5 | # 6 | # ${1:method description} 7 | #`(insert_yardoc_comments_for_arguments)` 8 | # 9 | # @return $0 -------------------------------------------------------------------------------- /settings/dired.el: -------------------------------------------------------------------------------- 1 | (put 'dired-find-alternate-file 'disabled nil) 2 | 3 | (add-hook 'dired-mode-hook 4 | (lambda () 5 | (define-key dired-mode-map (kbd "Q") 'dired-do-query-replace-regexp))) 6 | -------------------------------------------------------------------------------- /settings/windows.el: -------------------------------------------------------------------------------- 1 | ;; (require 'windows) 2 | ;; (win:startup-with-window) 3 | ;; (autoload 'save-current-configuration "revive" "Save status" t) 4 | ;; (autoload 'resume "revive" "Resume Emacs" t) 5 | ;; (autoload 'wipe "revive" "Wipe Emacs" t) 6 | -------------------------------------------------------------------------------- /snippets/text-mode/ruby-mode/ccr: -------------------------------------------------------------------------------- 1 | #name : pretty comment 2 | #binding: C-c r 3 | #group : comments 4 | # -- 5 | 6 | # 7 | # $1 8 | # 9 | # === Parameters: 10 | `(insert_rdoc_comments_for_arguments)`# 11 | # === Returns: 12 | # $0:: 13 | # -------------------------------------------------------------------------------- /platform/ubuntu.el: -------------------------------------------------------------------------------- 1 | (message "loading the ubuntu specific settings") 2 | 3 | (setq shell-file-name "bash") 4 | (setenv "SHELL" shell-file-name) 5 | (setq exec-path (cons "/usr/local/bin" exec-path)) 6 | (setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH"))) 7 | -------------------------------------------------------------------------------- /settings/helm.el: -------------------------------------------------------------------------------- 1 | (helm-mode 1) 2 | 3 | (define-key helm-find-files-map "\t" 'helm-execute-persistent-action) 4 | 5 | (defun helm-grep-repo (arg) 6 | (interactive "P") 7 | (require 'helm-files) 8 | (helm-grep-git-1 9 | (vc-root-dir) 10 | arg)) 11 | -------------------------------------------------------------------------------- /settings/midnight.el: -------------------------------------------------------------------------------- 1 | (require 'midnight) 2 | (setq 3 | midnight-mode t 4 | clean-buffer-list-delay-general 1 5 | clean-buffer-list-kill-never-regexps (quote 6 | ("^ \\*Minibuf-.*\\*$" "\\*magit:.*\\*$" "\\*slime-repl.*\\*$")) 7 | ) 8 | -------------------------------------------------------------------------------- /settings/occur.el: -------------------------------------------------------------------------------- 1 | (add-hook 'occur-mode-hook 2 | #'(lambda () 3 | (define-key occur-mode-map "n" 'occur-next) 4 | (define-key occur-mode-map "p" 'occur-prev) 5 | (define-key occur-mode-map "j" 'occur-next) 6 | (define-key occur-mode-map "k" 'occur-prev))) 7 | -------------------------------------------------------------------------------- /settings/cc.el: -------------------------------------------------------------------------------- 1 | ;; Setting some C/C++ mod stuff 2 | (add-hook 'c-mode-hook 3 | (lambda () 4 | (global-set-key "\C-cr" 'compile))) 5 | (add-hook 'c++-mode-hook 6 | (lambda () 7 | (global-set-key "\C-cr" 'compile))) 8 | 9 | (setq c-default-style "bsd" c-basic-offset 2) 10 | -------------------------------------------------------------------------------- /settings/ess.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; R 3 | ;;======================================================================== 4 | 5 | ;;(require 'ess) 6 | ;;(require 'ess-site) 7 | 8 | ;;(setq ess-eval-visibly-p nil) 9 | 10 | ;;(define-key ess-mode-map "C-_" 'ess-cycle-assign) 11 | -------------------------------------------------------------------------------- /settings/org.el: -------------------------------------------------------------------------------- 1 | (add-hook 'org-mode-hook 2 | #'(lambda () 3 | (define-key org-mode-map "\C-\M-j" 'org-insert-heading) 4 | (define-key org-mode-map "\M-j" 'org-insert-heading) 5 | (define-key org-mode-map "\C-cl" 'org-metaright) 6 | (define-key org-mode-map "\C-cj" 'org-metaleft))) 7 | -------------------------------------------------------------------------------- /settings/copilot.el: -------------------------------------------------------------------------------- 1 | ;; See https://github.com/zerolfx/copilot.el 2 | ;; 3 | ;; (add-to-list 'load-path "/path/to/copilot.el") 4 | ;; (require 'copilot) 5 | 6 | 7 | ;; (add-hook 'prog-mode-hook 'copilot-mode) 8 | ;; (with-eval-after-load 'copilot 9 | ;; (evil-define-key 'insert copilot-mode-map 10 | ;; (kbd "") #'my/copilot-tab)) 11 | -------------------------------------------------------------------------------- /settings/csharp.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; c sharp 3 | ;;======================================================================== 4 | (require 'csharp-mode) 5 | 6 | (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t) 7 | (setq auto-mode-alist 8 | (append '(("\\.cs$" . csharp-mode)) auto-mode-alist)) 9 | -------------------------------------------------------------------------------- /settings/csv.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; CSV 3 | ;;======================================================================== 4 | ;; (require 'csv-mode) 5 | 6 | ;; (add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode)) 7 | ;; (autoload 'csv-mode "csv-mode" 8 | ;; "Major mode for editing comma-separated value files." t) 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | sessions 2 | emacs_backups 3 | emacs_autosaves 4 | auto-save-list 5 | server 6 | games 7 | README 8 | *.elc 9 | **/*.elc 10 | tramp 11 | /el-get/el-get/recipes/* 12 | plugins/nxhtml/* 13 | url/* 14 | elpa 15 | elpa/builtin-packages 16 | elpa/archive-contents 17 | elpa/**/*.el 18 | el-get 19 | history 20 | transient 21 | ido.last 22 | /.emacs.desktop 23 | /.emacs.desktop.lock 24 | /lisp/haml-mode/ 25 | .DS_Store -------------------------------------------------------------------------------- /settings/rspec.el: -------------------------------------------------------------------------------- 1 | (require 'rspec-mode) 2 | 3 | (add-hook 'rspec-compilation-mode-hook 4 | (lambda () 5 | (define-key rspec-compilation-mode-map "p" 'compilation-previous-error) 6 | (define-key rspec-compilation-mode-map "n" 'compilation-next-error))) 7 | 8 | (setq rspec-use-rake-flag nil 9 | rspec-use-bundler-when-possible t 10 | rspec-use-rvm nil 11 | rspec-bundle-p t) 12 | -------------------------------------------------------------------------------- /settings/shell.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; shell-mode 3 | ;;======================================================================== 4 | ;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) 5 | 6 | ;; (setq ansi-term-color-vector 7 | ;; [unspecified "gray3" "light coral" "pale green" "khaki" 8 | ;; "RoyalBlue2" "MediumPurple1" "sky blue" "gray98"]) 9 | -------------------------------------------------------------------------------- /settings/ruby.el: -------------------------------------------------------------------------------- 1 | (setq auto-mode-alist (cons '("\\.ru$" . ruby-mode) auto-mode-alist)) 2 | (setq auto-mode-alist (cons '("\\.rake$" . ruby-mode) auto-mode-alist)) 3 | (setq auto-mode-alist (cons '("\\.gemspec$" . ruby-mode) auto-mode-alist)) 4 | (setq auto-mode-alist (cons '("\\.jbuilder$" . ruby-mode) auto-mode-alist)) 5 | (setq auto-mode-alist (cons '("^Rakefile$" . ruby-mode) auto-mode-alist)) 6 | (setq ruby-deep-arglist nil 7 | ruby-deep-indent-paren nil) 8 | -------------------------------------------------------------------------------- /settings/largefile.el: -------------------------------------------------------------------------------- 1 | (defun my-find-file-check-make-large-file-read-only-hook () 2 | "If a file is over a given size, make the buffer read only." 3 | (when (> (buffer-size) (* 2 1024 1024)) 4 | (setq buffer-read-only t) 5 | (buffer-disable-undo) 6 | (fundamental-mode) 7 | ; (message "Buffer is set to read-only because it is large. Undo also disabled.") 8 | )) 9 | 10 | (add-hook 'find-file-hook 'my-find-file-check-make-large-file-read-only-hook) 11 | -------------------------------------------------------------------------------- /settings/markdown.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; Markdown 3 | ;;======================================================================== 4 | (require 'markdown-mode) 5 | 6 | (autoload 'markdown-mode "markdown-mode.el" 7 | "Major mode for editing Markdown files" t) 8 | (setq auto-mode-alist 9 | (cons '("\\.md" . markdown-mode) auto-mode-alist)) 10 | (setq auto-mode-alist 11 | (cons '("\\.markdown" . markdown-mode) auto-mode-alist)) 12 | -------------------------------------------------------------------------------- /settings/compilation.el: -------------------------------------------------------------------------------- 1 | (require 'ansi-color) 2 | 3 | (defun endless/colorize-compilation () 4 | "Colorize from `compilation-filter-start' to `point'." 5 | (let ((inhibit-read-only t)) 6 | (ansi-color-apply-on-region 7 | compilation-filter-start (point)))) 8 | 9 | (require 'compile) 10 | (add-hook 'compilation-filter-hook #'endless/colorize-compilation) 11 | 12 | (setq compilation-error-regexp-alist 13 | (delete 'maven compilation-error-regexp-alist)) 14 | (push 'jest-error compilation-error-regexp-alist) 15 | (push '(jest-error 16 | "^[ ]*at .* (\\([^:]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\))" 1 2) 17 | compilation-error-regexp-alist-alist) 18 | -------------------------------------------------------------------------------- /platform/windows.el: -------------------------------------------------------------------------------- 1 | (message "loading windows specific settings") 2 | 3 | ;; This assumes that Cygwin is installed in C:\cygwin (the 4 | ;; default) and that C:\cygwin\bin is not already in your 5 | ;; Windows Path (it generally should not be). 6 | ;; 7 | (setq exec-path (cons "C:/cygwin/bin" exec-path)) 8 | (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH"))) 9 | ;; 10 | ;; NT-emacs assumes a Windows command shell, which you change 11 | ;; here. 12 | ;; 13 | (setq shell-file-name "bash") 14 | (setenv "SHELL" shell-file-name) 15 | (setq explicit-shell-file-name shell-file-name) 16 | ;; 17 | ;; This removes unsightly ^M characters that would otherwise 18 | ;; appear in the output of java applications. 19 | ;; 20 | (add-hook 'comint-output-filter-functions 21 | 'comint-strip-ctrl-m) 22 | -------------------------------------------------------------------------------- /platform/mac.el: -------------------------------------------------------------------------------- 1 | (message "loading mac specific settings") 2 | 3 | (setq gc-cons-threshold 100000000) 4 | (setq read-process-output-max (* 1024 1024)) 5 | 6 | (exec-path-from-shell-initialize) 7 | (when (eq system-type 'darwin) (customize-set-variable 'native-comp-driver-options '("-Wl,-w"))) 8 | 9 | ;; 10 | ;; someone's blog on copy and pasting between mac and emacs 11 | ;; 12 | (defun copy-from-osx () 13 | (shell-command-to-string "pbpaste")) 14 | 15 | (defun paste-to-osx (text &optional push) 16 | (let ((process-connection-type nil)) 17 | (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) 18 | (process-send-string proc text) 19 | (process-send-eof proc)))) 20 | 21 | (setq interprogram-cut-function 'paste-to-osx) 22 | 23 | (setq interprogram-paste-function 'copy-from-osx) 24 | -------------------------------------------------------------------------------- /settings/python.el: -------------------------------------------------------------------------------- 1 | ;; (add-hook 'python-mode-hook 2 | ;; (function (lambda () 3 | ;; (setq indent-tabs-mode nil 4 | ;; tab-width 2)))) 5 | (require 'python) 6 | (setq python-indent-guess-indent-offset nil) 7 | (setq python-indent-offset 2) 8 | ;; (setq nose-use-verbose nil) 9 | 10 | ;; (require 'nose) 11 | 12 | ;; (add-to-list 'nose-project-names "script/test") 13 | ;; (add-to-list 'nose-project-names "script/docker-test") 14 | ;; (add-to-list 'nose-project-names "script/local/test") 15 | 16 | ;; (add-hook 'python-mode-hook 17 | ;; (lambda () 18 | ;; (local-set-key "\C-c,a" 'nosetests-all) 19 | ;; (local-set-key "\C-c,m" 'nosetests-module) 20 | ;; (local-set-key "\C-c,s" 'nosetests-one))) 21 | 22 | (setq auto-mode-alist (cons '("\\.pyx$" . python-mode) auto-mode-alist)) 23 | (setq auto-mode-alist (cons '("\\.pxd$" . python-mode) auto-mode-alist)) 24 | -------------------------------------------------------------------------------- /settings/matlab.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; MATLAB 3 | ;;======================================================================== 4 | (autoload 'matlab-mode "~/.emacs.d/lisp/matlab.el" "Enter Matlab mode." t) 5 | (autoload 'matlab-shell "~/.emacs.d/lisp/matlab.el" "Interactive Matlab mode." t) 6 | 7 | ;; matlab mode for matlab 8 | (setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist)) 9 | 10 | (defun my-matlab-mode-hook () 11 | (setq matlab-function-indent t); if you want function bodies indented 12 | (setq fill-column 76); where auto-fill should wrap 13 | (font-lock-mode 1) 14 | (turn-on-auto-fill) 15 | (if (not running-xemacs) 16 | (matlab-mode-hilit))) 17 | (setq matlab-mode-hook 'my-matlab-mode-hook) 18 | 19 | (defun my-matlab-shell-mode-hook () 20 | (setq matlab-function-indent t); if you want function bodies indented 21 | (setq fill-column 76); where auto-fill should wrap 22 | (font-lock-mode 1)) 23 | (setq matlab-shell-mode-hook 'my-matlab-shell-mode-hook) 24 | 25 | 26 | -------------------------------------------------------------------------------- /lisp/autosave.el: -------------------------------------------------------------------------------- 1 | ;;============================================================================== 2 | ;; Put autosave files (ie #foo#) in one place, *not* 3 | ;; scattered all over the file system! 4 | ;;============================================================================== 5 | 6 | (setq create-lockfiles nil) 7 | 8 | (defvar autosave-dir 9 | (concat "~/.emacs.d/emacs_autosaves/" (user-login-name) "/")) 10 | 11 | (make-directory autosave-dir t) 12 | 13 | (defun auto-save-file-name-p (filename) 14 | (string-match "^#.*#$" (file-name-nondirectory filename))) 15 | 16 | (defun make-auto-save-file-name () 17 | (concat autosave-dir 18 | (if buffer-file-name 19 | (concat "#" (file-name-nondirectory buffer-file-name) "#") 20 | (expand-file-name 21 | (concat "#%" (buffer-name) "#"))))) 22 | 23 | ;; Put backup files (ie foo~) in one place too. (The backup-directory-alist 24 | ;; list contains regexp=>directory mappings; filenames matching a regexp are 25 | ;; backed up in the corresponding directory. Emacs will mkdir it if necessary.) 26 | (defvar backup-dir (concat "~/.emacs.d/emacs_backups/" (user-login-name) "/")) 27 | (setq backup-directory-alist (list (cons "." backup-dir))) 28 | ;;====== end auto save code ===== 29 | 30 | (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p t) 31 | -------------------------------------------------------------------------------- /settings/grep.el: -------------------------------------------------------------------------------- 1 | (setq grep-find-use-xargs t) ;; uses xargs in grep-find 2 | ;; (setq grep-find-use-xargs nil) 3 | (setq grep-find-command "find . \\( -path \\*/.gems -o -path \\*/venv.backup -o -path \\*/venv -o -path \\*/generated -o -path \\*/vendor -o -path \\*/SCCS -o -path \\*/RCS -o -path \\*/CVS -o -path \\*/MCVS -o -path \\*/.svn -o -path \\*/.git -o -path \\*/.hg -o -path \\*/.bzr -o -path \\*/_MTN -o -path \\*/_darcs -o -path \\*/\\{arch\\} \\) -prune -o \\( -name .\\#\\* -o -name \\*.o -o -name \\*\\~ -o -name \\*.bin -o -name \\*.lbin -o -name \\*.so -o -name \\*.a -o -name \\*.ln -o -name \\*.blg -o -name \\*.bbl -o -name \\*.elc -o -name \\*.lof -o -name \\*.glo -o -name \\*.idx -o -name \\*.lot -o -name \\*.fmt -o -name \\*.tfm -o -name \\*.class -o -name \\*.fas -o -name \\*.lib -o -name \\*.mem -o -name \\*.x86f -o -name \\*.sparcf -o -name \\*.fasl -o -name \\*.ufsl -o -name \\*.fsl -o -name \\*.dxl -o -name \\*.pfsl -o -name \\*.dfsl -o -name \\*.p64fsl -o -name \\*.d64fsl -o -name \\*.dx64fsl -o -name \\*.lo -o -name \\*.la -o -name \\*.gmo -o -name \\*.mo -o -name \\*.toc -o -name \\*.aux -o -name \\*.cp -o -name \\*.fn -o -name \\*.ky -o -name \\*.pg -o -name \\*.tp -o -name \\*.vr -o -name \\*.cps -o -name \\*.fns -o -name \\*.kys -o -name \\*.pgs -o -name \\*.tps -o -name \\*.vrs -o -name \\*.pyc -o -name \\*.pyo -o -name \\*.cache -o -name \\*.tar.gz -o -name \\*.map -o -name \\*.min.css \\) -prune -o -type f -print0 | xargs -0 grep -nH -e " 4 | grep-find-template "find . -type f -print0 | xargs -0 grep -nH -e " 5 | ) 6 | 7 | (add-hook 'grep-mode-hook 8 | #'(lambda () 9 | (define-key grep-mode-map "j" 'next-error-no-select) 10 | (define-key grep-mode-map "k" 'previous-error-no-select))) 11 | -------------------------------------------------------------------------------- /packages.el: -------------------------------------------------------------------------------- 1 | (require 'package) 2 | (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) 3 | 4 | (unless package-archive-contents (package-refresh-contents)) 5 | 6 | (setq url-http-attempt-keepalives nil) 7 | 8 | (use-package async :ensure t) 9 | 10 | ;; navigation 11 | (use-package browse-at-remote :ensure t) 12 | (use-package helm :ensure t) 13 | (use-package helm-ls-git :ensure t) 14 | (use-package helm-tree-sitter :ensure t) 15 | (use-package magit :ensure t) 16 | 17 | ;; system 18 | (use-package exec-path-from-shell :ensure t) 19 | 20 | ;; editing 21 | (use-package expand-region :ensure t) 22 | (use-package evil :ensure t) 23 | (use-package evil-leader :ensure t) 24 | (use-package evil-surround :ensure t) 25 | (use-package evil-numbers :ensure t) 26 | (use-package evil-textobj-tree-sitter :ensure t) 27 | (use-package paredit :ensure t) 28 | (use-package smart-tab :ensure t) 29 | 30 | ;; IDE-like support packages 31 | (use-package tide 32 | :ensure t 33 | :after (company flycheck)) 34 | 35 | (use-package flycheck :ensure t) 36 | (use-package dap-mode :ensure t) 37 | (use-package company 38 | :ensure t 39 | :hook (after-init . global-company-mode) 40 | :custom 41 | (company-idle-delay 0)) 42 | 43 | ;; major modes 44 | (use-package elixir-mode :ensure t) 45 | (use-package go-mode :ensure t) 46 | (use-package csv-mode :ensure t) 47 | (use-package json :ensure t) 48 | (use-package lua-mode :ensure t) 49 | (use-package markdown-mode :ensure t) 50 | (use-package php-mode :ensure t) 51 | (use-package python :ensure t) 52 | (use-package ruby-mode :ensure t) 53 | (use-package rspec-mode :ensure t) 54 | (use-package sass-mode :ensure t) 55 | (use-package scala-mode :ensure t) 56 | (use-package scss-mode :ensure t) 57 | (use-package web-mode :ensure t) 58 | (use-package yaml-mode :ensure t) 59 | 60 | ;; minor modes 61 | (use-package diminish :ensure t) 62 | (use-package dash :ensure t) 63 | 64 | ;; misc 65 | (use-package scratch :ensure t) 66 | 67 | ;; themes 68 | (use-package zenburn-theme :ensure t) 69 | 70 | ;; emacs speaks statistics 71 | (use-package ess :ensure t) 72 | 73 | (require 'scratch) 74 | -------------------------------------------------------------------------------- /functions.el: -------------------------------------------------------------------------------- 1 | (defun john-svn-ediff () 2 | "using ediff for version diff" 3 | (interactive) 4 | (ediff-revision . (buffer-file-name))) 5 | 6 | (defun save-window-layout () (interactive) (window-configuration-to-register ?z)) 7 | (defun load-window-layout () (interactive) (jump-to-register ?z)) 8 | 9 | (defun other-frame-1 () "does previous frame" 10 | (interactive) 11 | (other-frame -1)) 12 | (defun other-window-1 () 13 | "does previous window" 14 | (interactive) 15 | (other-window -1)) 16 | (defun asdfd () 17 | "sets my font to the thing I like on stanfords unix machines\nwhich is why it has such a ridiculous name" 18 | (interactive) 19 | (set-frame-font "-bitstream-Bitstream Vera Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1")) 20 | 21 | (defun delete-until-pattern () 22 | "deletes until the given pattern" 23 | (interactive) 24 | (let ((regexp (read-from-minibuffer "Enter Pattern to delete until: "))) 25 | (let ((beg (point)) 26 | (end (progn (search-forward-regexp regexp) 27 | (search-backward-regexp regexp)))) 28 | (delete-region beg end)))) 29 | 30 | ;; 31 | ;; taken from tassilo's blog 32 | ;; 33 | (defun zap-to-string (arg str) 34 | "Same as `zap-to-char' except that it zaps to the given string 35 | instead of a char." 36 | (interactive "p\nsZap to string: ") 37 | (kill-region (point) (progn 38 | (search-forward str nil nil arg) 39 | (point)))) 40 | 41 | (defun zap-to-regexp (arg regexp) 42 | "Same as `zap-to-char' except that it zaps to the given regexp 43 | instead of a char." 44 | (interactive "p\nsZap to regexp: ") 45 | (kill-region (point) (progn 46 | (re-search-forward regexp nil nil arg) 47 | (point)))) 48 | 49 | ;; 50 | ;; windows specific 51 | ;; 52 | 53 | (defun increment-number-at-point () 54 | (interactive) 55 | (skip-chars-backward "0123456789") 56 | (or (looking-at "[0123456789]+") 57 | (error "No number at point")) 58 | (replace-match (number-to-string (1+ (string-to-number (match-string 0)))))) 59 | -------------------------------------------------------------------------------- /locals.el: -------------------------------------------------------------------------------- 1 | (require 'tramp) 2 | 3 | 4 | ;; Example .dirs-locals.el configuration 5 | 6 | ;; ((nil . ((compile-command . "cd ~/src/swproxy && script/local/yarn run test ") 7 | ;; (indent-tabs-mode . nil))) 8 | ;; (c-mode . ((indent-tabs-mode . nil))) 9 | ;; (web-mode . ((indent-tabs-mode . nil))) 10 | ;; (magit-mode 11 | ;; . ((eval . (magit-disable-section-inserter 'magit-insert-tags-header))))) 12 | ;; 13 | ;; ((nil . ((eval . (set (make-local-variable 'dirs-locals-root-project-path) 14 | ;; (locate-dominating-file default-directory ".dir-locals.el"))) 15 | ;; (eval . (set (make-local-variable 'swproxy-server-test-command) 16 | ;; (concat "cd " dirs-locals-root-project-path " && script/local/yarn run test "))) 17 | ;; (eval . (set (make-local-variable 'abacus-worker-test-command) 18 | ;; (concat "cd " dirs-locals-root-project-path "statwing-abacus-worker && script/local/test -w ./ -c ./setup.cfg "))) 19 | ;; (eval . (set (make-local-variable 'statwing-etl-test-command) 20 | ;; (concat "cd " dirs-locals-root-project-path " && docker exec -it statwing-etl-devrunner script/test"))) 21 | ;; (indent-tabs-mode . nil))) 22 | ;; (c-mode . ((indent-tabs-mode . nil))) 23 | ;; (web-mode . ((indent-tabs-mode . nil))) 24 | ;; (magit-mode . ((eval . (magit-disable-section-inserter 'magit-insert-tags-header)))) 25 | ;; ("__fixtures__/pipelines" . 26 | ;; ((nil . ((compile-command . (concat 27 | ;; "cd " dirs-locals-root-project-path "statwing-abacus-worker && PIPELINE=" 28 | ;; (file-name-nondirectory (shell-quote-argument buffer-file-name)) 29 | ;; " SWPROXY_TESTS_UPDATE=false script/local/test -w ./ -c ./setup.cfg tests/abacus/analysis/tests.py:test_analysis_messages")))))) 30 | ;; ("src/server" . 31 | ;; ((nil . ((compile-command . swproxy-server-test-command))))) 32 | ;; ("test/server" . 33 | ;; ((nil . ((compile-command . swproxy-server-test-command))))) 34 | ;; ("statwing-etl" . 35 | ;; ((nil . ((compile-command . statwing-etl-test-command))))) 36 | ;; ("statwing-abacus-worker" . 37 | ;; ((nil . ((compile-command . abacus-worker-test-command)))))) 38 | -------------------------------------------------------------------------------- /themes/zen-and-art-theme.el: -------------------------------------------------------------------------------- 1 | (deftheme zen-and-art 2 | "zen-and-art color theme") 3 | 4 | (custom-theme-set-faces 5 | 'zen-and-art 6 | '(default ((t (:background "#191717" :foreground "#d2dec4")))) 7 | '(cursor ((t (:foreground "#a7a7a7")))) 8 | '(region ((t (:background "#999966")))) 9 | '(fringe ((t (:background "#252323")))) 10 | '(border-color ((t (:background "#000000")))) 11 | '(cursor-color ((t (:background "#A7A7A7")))) 12 | '(highlight-current-line-face ((t (:background "#252323")))) 13 | '(hl-line ((t (:background "#252323")))) 14 | '(font-lock-builtin-face ((t (:foreground "#86453A")))) 15 | '(font-lock-comment-face ((t (:italic t :foreground "#333B40")))) 16 | '(font-lock-comment-delimiter-face ((t (:foreground "#4C565D")))) 17 | '(font-lock-constant-face ((t (:foreground "#86453A")))) 18 | '(font-lock-function-name-face ((t (:foreground "#C6B032")))) 19 | '(font-lock-keyword-face ((t (:foreground "#AE5825")))) 20 | '(font-lock-preprocessor-face ((t (:foreground "#007575")))) 21 | '(font-lock-reference-face ((t (:foreground "#0055FF")))) 22 | '(font-lock-string-face ((t (:foreground "#5A7644")))) 23 | '(font-lock-doc-face ((t (:foreground "#DDFFD1")))) 24 | '(font-lock-type-face ((t (:italic t :foreground "#C6B032")))) 25 | '(font-lock-variable-name-face ((t (:foreground "#46657B")))) 26 | '(font-lock-warning-face ((t (:bold t :foreground "Pink")))) 27 | '(paren-face-match-light ((t (:background "#252323")))) 28 | '(highlight ((t (:background "darkolivegreen")))) 29 | '(italic ((t (:italic t)))) 30 | '(modeline ((t (:background "#3F3B3B" :foreground "white")))) 31 | '(modeline-buffer-id ((t (:background "#3F3B3B" :foreground "white")))) 32 | '(modeline-mousable ((t (:background "#a5baf1" :foreground "black")))) 33 | '(modeline-mousable-minor-mode ((t (:background "#a5baf1" 34 | :foreground "#000000")))) 35 | '(primary-selection ((t (:background "#3B3B3F")))) 36 | '(isearch ((t (:background "#555555")))) 37 | '(zmacs-region ((t (:background "#555577")))) 38 | '(secondary-selection ((t (:background "#545459")))) 39 | '(flymake-errline ((t (:background "LightSalmon" :foreground "#000000")))) 40 | '(flymake-warnline ((t (:background "LightSteelBlue" :foreground "#000000")))) 41 | '(underline ((t (:underline t)))) 42 | '(minibuffer-prompt ((t (:bold t :foreground "#ff6600"))))) 43 | 44 | ;;;###autoload 45 | (when load-file-name 46 | (add-to-list 'custom-theme-load-path 47 | (file-name-as-directory (file-name-directory load-file-name)))) 48 | 49 | (provide-theme 'zen-and-art) 50 | -------------------------------------------------------------------------------- /themes/colors.txt: -------------------------------------------------------------------------------- 1 | default foreground: 179 179 179 2 | default bold fg : 255 128 0 3 | default background: 0 0 0 4 | default bold bg : 85 85 85 5 | cursor text : 0 0 0 6 | cursor colour : 0 255 0 7 | black : 0 0 0 8 | black bold : 85 85 85 9 | red : 187 45 45 10 | red bold : 255 85 85 11 | green : 0 187 62 12 | green bold : 85 255 85 13 | yellow : 187 187 62 14 | yellow bold : 255 255 85 15 | blue : 99 137 216 16 | bold blue : 85 85 255 17 | magenta : 204 102 204 18 | magenta bold : 255 85 255 19 | cyan : 101 179 224 20 | cyan bold : 85 255 255 21 | white : 255 255 255 22 | white bold : 255 255 255 23 | 24 | colors used to make my emacs color theme 25 | black : 26 26 26 : #1a1a1a : grey10 26 | red : 255 48 48 : #ff3030 : firebrick1 27 | green : 0 238 118 : #00ee76 : SpringGreen3 28 | yellow : 238 220 130 : #eedc82 : LightGoldenrod2 29 | blue : 30 144 254 : #1e90fe : DodgerBlue1 30 | magenta : 209 95 238 : #d15fee : MediumOrchid2 31 | cyan : 0 229 238 : #00e5ee : turquoise2 32 | white : 229 229 229 : #e5e5e5 : grey90 33 | brightblack : 64 64 64 : #404040 : grey25 34 | brightred : 255 0 0 : #ff0000 : red1 35 | brightred : 255 85 85 : #ff0000 : red1 36 | brightgreen : 0 205 0 : #00cd00 : green3 37 | brightyellow : 205 205 0 : #cdcd00 : yellow3 38 | brightblue : 126 192 238 : #7ec0ee : SkyBlue2 39 | brightmagenta : 255 0 255 : #ff00ff : magenta1 40 | brightcyan : 0 205 205 : #00cdcd : cyan3 41 | brightwhite : 255 255 255 : #ffffff : grey100 42 | bold : 255 127 255 : #ff7f00 : DarkOrange1 43 | selection : 25 25 112 : #191970 : Midnight Blue 44 | 45 | (background-color . "#1c1c1c") 46 | (background-mode . dark) 47 | (border-color . "#1c1c1c") 48 | (cursor-color . "#00ff00") 49 | (foreground-color . "#d0d0d0") 50 | (mouse-color . "black") 51 | (fringe ((t (:background "#1c1c1c")))) 52 | (mode-line ((t (:foreground "#000000" :background "#ffffff")))) 53 | (region ((t (:background "#000000")))) 54 | (font-lock-builtin-face ((t (:foreground "#875f5f")))) 55 | (font-lock-comment-face ((t (:foreground "#ff3030")))) 56 | (font-lock-function-name-face ((t (:foreground "#d787ff")))) 57 | (font-lock-keyword-face ((t (:foreground "#ff7800")))) 58 | (font-lock-string-face ((t (:foreground "#8787ff")))) 59 | (font-lock-type-face ((t (:foreground"#00e5ee")))) 60 | (font-lock-constant-face ((t (:foreground "#ffff5f")))) 61 | (font-lock-variable-name-face ((t (:foreground "#5faf5f")))) 62 | (minibuffer-prompt ((t (:foreground "#af87d7" :bold t)))) 63 | (font-lock-warning-face ((t (:foreground "red" :bold t)))) 64 | -------------------------------------------------------------------------------- /vars.el: -------------------------------------------------------------------------------- 1 | ;;============================================================================== 2 | ;; Put autosave files (ie #foo#) in one place, *not* 3 | ;; scattered all over the file system! 4 | ;;============================================================================== 5 | (defvar autosave-dir 6 | (concat "~/.emacs.d/emacs_autosaves/" (user-login-name) "/")) 7 | (make-directory autosave-dir t) 8 | 9 | (defun auto-save-file-name-p (filename) 10 | (string-match "^#.*#$" (file-name-nondirectory filename))) 11 | 12 | (defun make-auto-save-file-name () 13 | (concat autosave-dir 14 | (if buffer-file-name 15 | (concat "#" (file-name-nondirectory buffer-file-name) "#") 16 | (expand-file-name 17 | (concat "#%" (buffer-name) "#"))))) 18 | 19 | ;; Put backup files (ie foo~) in one place too. (The backup-directory-alist 20 | ;; list contains regexp=>directory mappings; filenames matching a regexp are 21 | ;; backed up in the corresponding directory. Emacs will mkdir it if necessary.) 22 | (defvar backup-dir (concat "~/.emacs.d/emacs_backups/" (user-login-name) "/")) 23 | 24 | (menu-bar-mode 0) 25 | (setq tool-bar-mode nil) 26 | (setq scroll-bar-mode nil) 27 | 28 | (fset 'yes-or-no-p 'y-or-n-p) 29 | 30 | ;; (setq split-height-threshold 0) 31 | ;; (setq split-width-threshold nil) 32 | 33 | (setq backup-directory-alist (list (cons "." backup-dir)) 34 | blink-cursor-mode nil 35 | column-number-mode t 36 | comment-style 'indent 37 | font-lock-maximum-decoration t 38 | inhibit-startup-message t 39 | inhibit-startup-screen t 40 | initial-scratch-message nil 41 | mac-command-modifier 'meta 42 | mac-option-modifier 'super 43 | next-screen-context-lines 5 44 | save-place-limit 20 45 | scroll-conservatively 10000 46 | shift-select-mode nil 47 | show-paren-mode t 48 | show-paren-delay 0 49 | standard-indent 4 50 | tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)) 51 | text-mode-hook (quote (text-mode-hook-identify)) 52 | 53 | linum-format (lambda (line) 54 | (propertize (format 55 | (let ((w (length (number-to-string 56 | (count-lines (point-min) (point-max)))))) 57 | (concat "%" (number-to-string w) "d ")) 58 | line) 59 | 'face 'linum)) 60 | ) 61 | 62 | (setq-default truncate-lines t 63 | indent-tabs-mode nil) 64 | 65 | (add-hook 'before-save-hook 'delete-trailing-whitespace) 66 | 67 | ;; (remove-hook 'before-save-hook 'delete-trailing-whitespace) 68 | 69 | (show-paren-mode 1) 70 | (delete-selection-mode 1) 71 | (global-font-lock-mode 1) 72 | (global-auto-revert-mode t) 73 | (desktop-save-mode 1) 74 | -------------------------------------------------------------------------------- /settings/web.el: -------------------------------------------------------------------------------- 1 | (require 'tide) 2 | (require 'flycheck) 3 | (require 'web-mode) 4 | 5 | (setq js-indent-level 2 6 | web-mode-markup-indent-offset 2 7 | web-mode-attr-indent-offset 2 8 | web-mode-css-indent-offset 2 9 | web-mode-code-indent-offset 2 10 | web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))) 11 | 12 | (defun web-mode-ident-hook () 13 | "Hooks for Web mode." 14 | (setq web-mode-markup-indent-offset 2 15 | web-mode-attr-indent-offset 2 16 | web-mode-css-indent-offset 2 17 | web-mode-code-indent-offset 2)) 18 | 19 | (add-hook 'web-mode-hook 'web-mode-use-tabs) 20 | (add-hook 'web-mode-hook 'web-mode-ident-hook) 21 | 22 | ;; Typescript 23 | 24 | (defun setup-tide-mode () 25 | (interactive) 26 | (tide-setup) 27 | (flycheck-mode +1) 28 | (setq flycheck-check-syntax-automatically '(save mode-enabled)) 29 | (eldoc-mode +1) 30 | (tide-hl-identifier-mode +1) 31 | ;; company is an optional dependency. You have to 32 | ;; install it separately via package-install 33 | ;; `M-x package-install [ret] company` 34 | (company-mode +1)) 35 | 36 | ;; aligns annotation to the right hand side 37 | (setq company-tooltip-align-annotations t) 38 | 39 | ;;======================================================================== 40 | ;; auto-mode 41 | ;;======================================================================== 42 | (add-to-list 'auto-mode-alist '("\\.ts\\'" . web-mode)) 43 | (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) 44 | (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode)) 45 | (add-to-list 'auto-mode-alist '("\\.json$" . javascript-mode)) 46 | (add-to-list 'auto-mode-alist '("\\.js$" . web-mode)) 47 | (add-to-list 'auto-mode-alist '("\\.mjs$" . javascript-mode)) 48 | (add-to-list 'auto-mode-alist '("\\.mjs$" . web-mode)) 49 | (add-to-list 'auto-mode-alist '("\\.bundle.*\\.js$" . javascript-mode)) 50 | (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode)) 51 | (add-to-list 'auto-mode-alist '("\\.es6$" . web-mode)) 52 | (add-to-list 'auto-mode-alist '("\\.coffee\\." . coffee-mode)) 53 | (add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode)) 54 | (add-to-list 'auto-mode-alist '("\\.js\\.coffee$" . coffee-mode)) 55 | 56 | (add-hook 'web-mode-hook 57 | (lambda () 58 | (when (or (string-equal "ts" (file-name-extension buffer-file-name)) (string-equal "tsx" (file-name-extension buffer-file-name))) 59 | (setup-tide-mode)))) 60 | 61 | (setq tide-tsserver-executable "node_modules/typescript/bin/tsserver") 62 | (setq tide-format-options 63 | '(:indentSize 2 :tabSize 2 :insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil)) 64 | 65 | ;; ======================================================================= 66 | ;; generic web development stuff 67 | ;; ======================================================================= 68 | (add-to-list 'auto-mode-alist '("\\.ejs$" . html-mode)) 69 | (setq coffee-tab-width 2) 70 | (add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode)) 71 | -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | 2 | ;; Added by Package.el. This must come before configurations of 3 | ;; installed packages. Don't delete this line. If you don't want it, 4 | ;; just comment it out by adding a semicolon to the start of the line. 5 | ;; You may delete these explanatory comments. 6 | (package-initialize) 7 | 8 | (add-to-list 'load-path "~/.emacs.d/lisp") 9 | 10 | (load-file "~/.emacs.d/platform.el") 11 | (load-file "~/.emacs.d/vars.el") 12 | (load-file "~/.emacs.d/packages.el") 13 | (load-file "~/.emacs.d/settings.el") 14 | (load-file "~/.emacs.d/functions.el") 15 | (load-file "~/.emacs.d/themes.el") 16 | 17 | (load-file "~/.emacs.d/alias.el") 18 | (load-file "~/.emacs.d/locals.el") 19 | 20 | ;; for emailing with emacs! 21 | (setq mail-archive-file-name "~/.emacs.d/sentmail") 22 | (defconst user-mail-address "le.johnq@gmail.com") 23 | 24 | (set-register ?e '(file . "~/.emacs.d/init.el")) 25 | (set-register ?s '(file . "~/.emacs.d/settings")) 26 | (set-register ?a '(file . "~/.emacs.d/alias.el")) 27 | 28 | (put 'scroll-left 'disabled nil) 29 | 30 | (custom-set-variables 31 | ;; custom-set-variables was added by Custom. 32 | ;; If you edit it by hand, you could mess it up, so be careful. 33 | ;; Your init file should contain only one such instance. 34 | ;; If there is more than one, they won't work right. 35 | '(browse-at-remote-remote-type-domains 36 | '(("bitbucket.org" . "bitbucket") 37 | ("github.com" . "github") 38 | ("gitlab.com" . "gitlab") 39 | ("git.savannah.gnu.org" . "gnu") 40 | ("gist.github.com" . "gist") 41 | ("git.sr.ht" . "sourcehut"))) 42 | '(compilation-error-regexp-alist 43 | '(bash python-tracebacks-and-caml cmake cmake-info comma cucumber msft edg-1 edg-2 epc ftnchek iar ibm irix java jikes-file jikes-line clang-include gcc-include ruby-Test::Unit gnu lcc makepp mips-1 mips-2 msft omake oracle perl php rxp sparc-pascal-file sparc-pascal-line sparc-pascal-example sun sun-ada watcom 4bsd gcov-file gcov-header gcov-nomark gcov-called-line gcov-never-called perl--Pod::Checker perl--Test perl--Test2 perl--Test::Harness weblint guile-file guile-line)) 44 | '(global-undo-tree-mode nil) 45 | '(groovy-indent-offset 2) 46 | '(magit-display-buffer-function 'magit-display-buffer-same-window-except-diff-v1) 47 | '(magit-git-executable "/opt/homebrew/bin/git") 48 | '(package-selected-packages 49 | '(tide paredit company ess evil-textobj-tree-sitter helm-tree-sitter tree-sitter-langs tree-sitter dap-mode browse-at-remote csv-mode diminish eglot elixir-mode evil evil-leader evil-numbers evil-surround exec-path-from-shell expand-region flycheck go-mode haskell-mode helm-ls-git jest jsonrpc lua-mode magit magit-popup markdown-mode nose php-mode rspec-mode sass-mode scala-mode scratch scss-mode smart-tab web-mode yaml-mode zenburn-theme)) 50 | '(sh-basic-offset 2) 51 | '(warning-suppress-types '((comp) (comp)))) 52 | (custom-set-faces 53 | ;; custom-set-faces was added by Custom. 54 | ;; If you edit it by hand, you could mess it up, so be careful. 55 | ;; Your init file should contain only one such instance. 56 | ;; If there is more than one, they won't work right. 57 | ) 58 | -------------------------------------------------------------------------------- /settings/yasnippets.el: -------------------------------------------------------------------------------- 1 | ;;======================================================================== 2 | ;; yasnippets - this adds some auto completion commands for several 3 | ;; languages 4 | ;;======================================================================== 5 | ;; (require 'yasnippet) 6 | ;; (require 'yasnippet_extensions) 7 | ;; (setq yas/root-directory '("~/.emacs.d/snippets" "~/.emacs.d/el-get/yasnippet/snippets")) 8 | 9 | ;; (yas/initialize) 10 | ;; (mapc 'yas/load-directory yas/root-directory) 11 | 12 | ;; (setq 13 | ;; hippie-expand-try-functions-list (quote 14 | ;; (yas/hippie-try-expand 15 | ;; try-complete-file-name-partially 16 | ;; try-complete-file-name 17 | ;; try-expand-all-abbrevs 18 | ;; try-expand-list 19 | ;; try-expand-line 20 | ;; try-expand-dabbrev 21 | ;; try-expand-dabbrev-all-buffers 22 | ;; try-expand-dabbrev-from-kill 23 | ;; try-complete-lisp-symbol-partially 24 | ;; try-complete-lisp-symbol 25 | ;; ))) 26 | 27 | ;; (defun insert_yardoc_comments_for_arguments () 28 | ;; (save-excursion 29 | ;; (re-search-forward "def \\([a-zA-Z_0-9.?!]+\\)" nil t) 30 | ;; (match-data) 31 | ;; (let ((method-name (buffer-substring (match-beginning 1) (match-end 1))) 32 | ;; ;; this assumes that ruby methods are defined on a single line 33 | ;; (arguments-string (buffer-substring (match-end 1) (line-end-position)))) 34 | ;; (let ((args-list 35 | ;; (remove-if 36 | ;; (lambda (x) (string= x "")) 37 | ;; (mapcar 38 | ;; (lambda (arg) (car (split-string (replace-regexp-in-string "[ ()]" "" arg) "="))) 39 | ;; (split-string arguments-string ","))))) 40 | ;; (apply 'concat (mapcar (lambda (arg) (concat "\n# @param [${type}] " arg " ${description}")) args-list)) 41 | ;; ) 42 | ;; ) 43 | ;; ) 44 | ;; ) 45 | 46 | ;; (defun insert_rdoc_comments_for_arguments () 47 | ;; (save-excursion 48 | ;; (re-search-forward "def \\([a-zA-Z_0-9.?!]+\\)" nil t) 49 | ;; (match-data) 50 | ;; (let ((method-name (buffer-substring (match-beginning 1) (match-end 1))) 51 | ;; ;; this assumes that ruby methods are defined on a single line 52 | ;; (arguments-string (buffer-substring (match-end 1) (line-end-position)))) 53 | ;; (let ((args-list 54 | ;; (remove-if 55 | ;; (lambda (x) (string= x "")) 56 | ;; (mapcar 57 | ;; (lambda (arg) (car (split-string (replace-regexp-in-string "[ ()]" "" arg) "="))) 58 | ;; (split-string arguments-string ","))))) 59 | ;; (apply 'concat (mapcar (lambda (arg) (concat "# " arg "<>::\n# ${description}\n")) args-list)) 60 | ;; ) 61 | ;; ) 62 | ;; ) 63 | ;; ) 64 | -------------------------------------------------------------------------------- /settings/ido.el: -------------------------------------------------------------------------------- 1 | (ido-mode t) 2 | (setq ido-enable-flex-matching t) ;; enable fuzzy matching 3 | 4 | (setq ibuffer-saved-filter-groups (quote (("john" 5 | ("groupsage" (or (filename . "C2/groupsage") (filename . "groupsage"))) 6 | ("gluestick" (or (filename . "main/code/gluestick") (filename . "C2/gluestick"))) 7 | ("c2_vm" (filename . "main/code/c2")) 8 | ("clients" (filename . "main/code/clients")) 9 | ("microsoft" (filename . "main/jobs/Microsoft")) 10 | ("skunkworks" (filename . "main/code/skunkworks")) 11 | ("magit" (mode . magit-mode)) 12 | ("shell" (mode . shell-mode)) 13 | ("emacs" (filename . ".emacs.d")) 14 | ("builder" (or (filename . "main/code/builder") (filename ."C2/builder")))))) 15 | ibuffer-saved-filters (quote (("gnus" ((or (mode . message-mode) (mode . mail-mode) (mode . gnus-group-mode) (mode . gnus-summary-mode) (mode . gnus-article-mode)))) 16 | ("programming" ((or (mode . emacs-lisp-mode) (mode . cperl-mode) (mode . c-mode) (mode . java-mode) (mode . idl-mode) (mode . lisp-mode)))))) 17 | ) 18 | 19 | (defun ido-goto-symbol (&optional symbol-list) 20 | "Refresh imenu and jump to a place in the buffer using Ido." 21 | (interactive) 22 | (unless (featurep 'imenu) 23 | (require 'imenu nil t)) 24 | (cond 25 | ((not symbol-list) 26 | (let ((ido-mode ido-mode) 27 | (ido-enable-flex-matching 28 | (if (boundp 'ido-enable-flex-matching) 29 | ido-enable-flex-matching t)) 30 | name-and-pos symbol-names position) 31 | (unless ido-mode 32 | (ido-mode 1) 33 | (setq ido-enable-flex-matching t)) 34 | (while (progn 35 | (imenu--cleanup) 36 | (setq imenu--index-alist nil) 37 | (ido-goto-symbol (imenu--make-index-alist)) 38 | (setq selected-symbol 39 | (ido-completing-read "Symbol? " symbol-names)) 40 | (string= (car imenu--rescan-item) selected-symbol))) 41 | (unless (and (boundp 'mark-active) mark-active) 42 | (push-mark nil t nil)) 43 | (setq position (cdr (assoc selected-symbol name-and-pos))) 44 | (cond 45 | ((overlayp position) 46 | (goto-char (overlay-start position))) 47 | (t 48 | (goto-char position))))) 49 | ((listp symbol-list) 50 | (dolist (symbol symbol-list) 51 | (let (name position) 52 | (cond 53 | ((and (listp symbol) (imenu--subalist-p symbol)) 54 | (ido-goto-symbol symbol)) 55 | ((listp symbol) 56 | (setq name (car symbol)) 57 | (setq position (cdr symbol))) 58 | ((stringp symbol) 59 | (setq name symbol) 60 | (setq position 61 | (get-text-property 1 'org-imenu-marker symbol)))) 62 | (unless (or (null position) (null name) 63 | (string= (car imenu--rescan-item) name)) 64 | (add-to-list 'symbol-names name) 65 | (add-to-list 'name-and-pos (cons name position)))))))) 66 | 67 | ;; (setq ido-execute-command-cache nil) 68 | ;; (defun ido-execute-command () 69 | ;; (interactive) 70 | ;; (call-interactively 71 | ;; (intern 72 | ;; (ido-completing-read 73 | ;; "M-x " 74 | ;; (progn 75 | ;; (unless ido-execute-command-cache 76 | ;; (mapatoms (lambda (s) 77 | ;; (when (commandp s) 78 | ;; (setq ido-execute-command-cache 79 | ;; (cons (format "%S" s) ido-execute-command-cache)))))) 80 | ;; ido-execute-command-cache))))) 81 | 82 | ;; (add-hook 'ido-setup-hook 83 | ;; (lambda () 84 | ;; (setq ido-enable-flex-matching t) 85 | ;; (global-set-key "\M-x" 'ido-execute-command))) 86 | -------------------------------------------------------------------------------- /alias.el: -------------------------------------------------------------------------------- 1 | ;; -*- emacs-lisp -*- 2 | ;; 3 | ;; a file for my aliases 4 | 5 | (define-key global-map "\C-xo" 'next-multiframe-window) 6 | (define-key global-map "\C-xp" 'previous-multiframe-window) 7 | 8 | (define-key global-map "\C-cc" 'comment-region) 9 | (define-key global-map "\C-cv" 'uncomment-region) 10 | 11 | ;; (define-key global-map "\C-c\C-c" 'compile) 12 | ;; (define-key global-map [f7] 'compile) 13 | 14 | (define-key global-map "\C-cs" 'shell) 15 | (define-key global-map "\C-c;ss" 'bash-term) 16 | (define-key global-map (kbd "C-'") 'bash-term) 17 | (define-key global-map (kbd "C-x C-'") 'term) 18 | 19 | (define-key global-map "\M-/" 'smart-tab) 20 | 21 | (define-key global-map "\C-x\C-b" 'helm-buffers-list) 22 | (define-key global-map "\C-xnb" 'rename-buffer) 23 | 24 | (define-key global-map [(right)] 'windmove-right) 25 | (define-key global-map [(left)] 'windmove-left) 26 | (define-key global-map [(down)] 'windmove-down) 27 | (define-key global-map [(up)] 'windmove-up) 28 | 29 | (define-key global-map "\C-ci" 'ido-goto-symbol) ; or any key you see fit 30 | 31 | (define-key global-map (kbd "M-[ 5 c") 'forward-word) 32 | (define-key global-map (kbd "M-[ 5 D") 'backward-word) 33 | (define-key global-map "\M-[5c" 'forward-word) 34 | (define-key global-map "\M-[5d" 'backward-word) 35 | (define-key global-map [mouse-4] 'previous-line) 36 | (define-key global-map [mouse-5] 'next-line) 37 | 38 | ;;(define-key global-map "\C-j" 'newline-and-indent) ;; this is what it was 39 | ;;(define-key global-map "\C-l" 'recenter) ;; this is what it was 40 | ;; (define-key global-map "\M-p" 'backward-paragraph) 41 | ;; (define-key global-map "\M-n" 'forward-paragraph) 42 | 43 | 44 | ;; I really dislike this binding 45 | ;; (define-key global-map "\C-x\C-x" 'exchange-point-and-mark) 46 | ;; (define-key global-map "\C-x\C-p" 'mark-page) 47 | (define-key global-map "\C-x\C-p" nil) 48 | (define-key global-map "\C-m" 'newline-and-indent) 49 | 50 | (define-key global-map "\C-xwl" 'highlight-lines-matching-regexp) 51 | (define-key global-map "\C-xwh" 'highlight-regexp) 52 | (define-key global-map "\C-xwr" 'unhighlight-regexp) 53 | (define-key global-map (kbd "C-c C-a") 'align-regexp) 54 | 55 | (define-key global-map "\C-c\C-t" 'toggle-truncate-lines) 56 | 57 | (define-key global-map "\C-c\C-f" 'grep-find) 58 | (define-key global-map "\C-cf" 'grep-find) 59 | (define-key global-map "\C-x\C-f" 'helm-find-files) 60 | (define-key global-map "\C-xf" 'helm-browse-project) 61 | (define-key global-map "\M-%" 'query-replace-regexp) 62 | (define-key global-map "\C-s" 'isearch-forward-regexp) 63 | (define-key global-map "\C-r" 'isearch-backward-regexp) 64 | (define-key global-map "\M-g" 'goto-line) 65 | 66 | ;; zapping to string/regexp and the like 67 | (define-key global-map (kbd "M-Z") 'zap-to-string) 68 | (define-key global-map (kbd "M-z") 'zap-to-regexp) 69 | (define-key global-map (kbd "C-M-z") 'zap-to-char) 70 | 71 | (define-key global-map "\C-c\C-r" 'recursive-edit) 72 | 73 | (define-key global-map "\C-xwe" 'ediff) 74 | (define-key global-map "\C-xwd" 'diff) 75 | (define-key global-map "\C-xv=" 'vc-diff) 76 | (define-key global-map "\C-xve" 'john-svn-ediff) 77 | 78 | (define-key global-map "\C-c;sp" 'sql-postgres) 79 | (define-key global-map "\C-c;sb" 'sql-set-sqli-buffer) 80 | 81 | (define-key global-map [C-f12] 'save-window-layout) 82 | (define-key global-map [f12] 'load-window-layout) 83 | 84 | (define-key global-map "\C-c;js" 'javascript-mode) 85 | (define-key global-map "\C-c;jh" 'sgml-mode) 86 | 87 | (define-key global-map "\C-c;jj" 'nrepl-jack-in) 88 | 89 | (define-key global-map "\C-c;f" 'follow-mode) 90 | 91 | (define-key global-map "\C-c;d" 'desktop-change-dir) 92 | 93 | (define-key global-map [backtab] 'table-backward-cell) 94 | 95 | (define-key global-map "\C-xm" 'magit-status) 96 | (define-key global-map "\C-cM" 'magit-status) 97 | 98 | (define-key global-map "\C-xr\C-@" 'cua-set-rectangle-mark) 99 | 100 | (define-key global-map "\C-cw" 'whitespace-cleanup) 101 | 102 | ;;(define-key global-map "\C-xs" 'viper-save) 103 | ;; (define-key global-map "\C-c;v" 'toggle-viper-mode) 104 | ;; (define-key global-map "\C-x\C-s" 'viper-save) 105 | ;;(define-key global-map "\C-g" 'viper-keyboard-quit) 106 | -------------------------------------------------------------------------------- /settings/evil.el: -------------------------------------------------------------------------------- 1 | ;; make sure to remove the undo-tree dependency from evil after evil downloads 2 | ;; in evil-pkg remove undo-tree from define-package list in evil-pkg.el under .emacs.d/evil 3 | ;; 4 | ;; may need to change load-path for packages to be consistent 5 | ;; (add-to-list 'load-path "~/.emacs.d/evil") 6 | 7 | (require 'evil) 8 | (evil-mode 1) 9 | 10 | (require 'evil-leader) 11 | (global-evil-leader-mode) 12 | 13 | (require 'evil-surround) 14 | (global-evil-surround-mode nil) 15 | 16 | (setq evil-ex-search-vim-style-regexp t 17 | evil-want-fine-undo t 18 | evil-leader/in-all-states nil 19 | evil-mode-line-format nil 20 | evil-move-cursor-back t 21 | evil-search-module 'evil-search) 22 | 23 | (evil-leader/set-leader "") 24 | (setq-default evil-shift-width 2) 25 | 26 | (add-to-list 'evil-emacs-state-modes 'git-rebase-mode) 27 | (add-to-list 'evil-emacs-state-modes 'occur-mode) 28 | (add-to-list 'evil-emacs-state-modes 'shell-mode) 29 | (add-to-list 'evil-emacs-state-modes 'tar-mode) 30 | (add-to-list 'evil-emacs-state-modes 'customize-mode) 31 | 32 | (defun evil-keyboard-quit () 33 | (interactive) 34 | (if (eq evil-state 'insert) 35 | (progn 36 | (evil-normal-state) 37 | (keyboard-quit)) 38 | (keyboard-quit))) 39 | 40 | (defun evil-normal-state-and-save () 41 | (interactive) 42 | (if (eq evil-state 'insert) 43 | (progn 44 | (evil-normal-state) 45 | (save-buffer)) 46 | (save-buffer))) 47 | 48 | ;; key bindings 49 | ;; normal state 50 | (define-key evil-normal-state-map (kbd "C-u") 'universal-argument) 51 | (define-key evil-normal-state-map (kbd "u") 'undo) 52 | (define-key evil-normal-state-map (kbd "C-r") 'isearch-backward-regexp) 53 | (define-key evil-normal-state-map (kbd "C-y") 'evil-paste-before) 54 | (define-key evil-normal-state-map (kbd "C-n") 'next-line) 55 | (define-key evil-normal-state-map (kbd "C-p") 'previous-line) 56 | (define-key evil-normal-state-map (kbd "P") 'evil-paste-after) 57 | (define-key evil-normal-state-map (kbd "p") 'yank) 58 | (define-key evil-normal-state-map (kbd "C-c +") 'evil-numbers/inc-at-pt) 59 | (define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt) 60 | (define-key evil-normal-state-map (kbd "C-r") 'isearch-backward-regexp) 61 | 62 | ;; motion state 63 | (define-key evil-motion-state-map (kbd "C-u") 'universal-argument) 64 | (define-key evil-motion-state-map (kbd "C-d") 'delete-char) 65 | (define-key evil-motion-state-map (kbd "C-e") 'evil-end-of-line) 66 | 67 | ;; insert-state 68 | (define-key evil-insert-state-map (kbd "C-a") 'move-beginning-of-line) 69 | (define-key evil-insert-state-map (kbd "C-d") 'delete-char) 70 | (define-key evil-insert-state-map (kbd "C-g") 'evil-keyboard-quit) 71 | (define-key evil-insert-state-map (kbd "C-k") 'kill-line) 72 | (define-key evil-insert-state-map (kbd "C-y") 'yank) 73 | (define-key evil-insert-state-map (kbd "C-e") 'move-end-of-line) 74 | (define-key evil-insert-state-map (kbd "C-x C-s") 'evil-normal-state-and-save) 75 | 76 | ;; evil leader 77 | (evil-leader/set-key 78 | "'" 'delete-pair 79 | "=" 'ediff-buffers 80 | "a" 'helm-grep-do-git-grep 81 | "A" 'helm-grep-repo 82 | "b" 'ido-switch-buffer 83 | "B" 'ido-switch-buffer-other-window 84 | "c" 'compile 85 | "d" 'dired-jump 86 | "D" 'desktop-change-dir 87 | "e" 'er/expand-region 88 | "E" 'shell 89 | "f" 'helm-browse-project 90 | "F" 'ido-find-file-other-window 91 | "g" 'magit-status 92 | "k" 'kill-this-buffer 93 | "K" 'kill-buffer-and-window 94 | "o" 'browse-at-remote 95 | "Q" 'find-dired 96 | "s" 'rspec-verify-single 97 | "t" 'ido-goto-symbol 98 | "v" 'rspec-verify 99 | "w" 'evil-write) 100 | 101 | (defun evil-undefine () 102 | (interactive) 103 | (let (evil-mode-map-alist) 104 | (call-interactively (key-binding (this-command-keys))))) 105 | 106 | (define-key evil-motion-state-map [left] 'evil-undefine) 107 | (define-key evil-motion-state-map [right] 'evil-undefine) 108 | (define-key evil-motion-state-map [up] 'evil-undefine) 109 | (define-key evil-motion-state-map [down] 'evil-undefine) 110 | 111 | ;; compilation mode 112 | (add-hook 'compilation-mode-hook #'(lambda () 113 | (local-unset-key "h") 114 | (local-unset-key "0"))) 115 | 116 | ;; org mode 117 | (evil-declare-key 'normal org-mode-map 118 | "za" 'org-cycle 119 | "zA" 'org-shifttab 120 | "zc" 'hide-subtree 121 | "zC" 'org-hide-block-all 122 | "zm" 'hide-body 123 | "zo" 'show-subtree 124 | "zO" 'show-all 125 | "zr" 'show-all 126 | (kbd "RET") 'org-open-at-point 127 | (kbd "M-j") 'org-shiftleft 128 | (kbd "M-k") 'org-shiftright 129 | (kbd "M-H") 'org-metaleft 130 | (kbd "M-J") 'org-metadown 131 | (kbd "M-K") 'org-metaup 132 | (kbd "M-L") 'org-metaright) 133 | -------------------------------------------------------------------------------- /settings/magit.el: -------------------------------------------------------------------------------- 1 | (require 'magit) 2 | 3 | (setq magit-push-always-verify nil 4 | git-commit-summary-max-length 80) 5 | 6 | (setq magit-visit-ref-behavior '(checkout-any focus-on-ref)) 7 | 8 | (defun magit-merge-no-ff (revision) 9 | "Merge REVISION into the current 'HEAD'; leave changes uncommitted. 10 | With a prefix-arg, the merge will be squashed. 11 | \('git merge --no-commit [--squash|--no-ff] REVISION')." 12 | (interactive 13 | (list (magit-read-rev "Merge (Manually)" (magit-default-rev)))) 14 | (if revision 15 | (apply 'magit-run-git 16 | "merge" 17 | (magit-rev-to-git revision) 18 | '("--no-ff")))) 19 | 20 | (defun magit-prune-origin (&optional arg) 21 | (interactive) 22 | (magit-run-git-async "remote" "prune" "origin")) 23 | 24 | (defun magit-remote-update (&optional arg) 25 | (interactive) 26 | (magit-run-git-async "remote" "update")) 27 | 28 | (defun magit-clean-local-branches (&optional arg) 29 | (interactive) 30 | (shell-command "git branch | grep -v develop | grep -v master | xargs git branch -d")) 31 | 32 | (defun magit-merge-develop (&optional arg) 33 | (interactive) 34 | (magit-run-git "merge" "origin/develop")) 35 | 36 | (defun magit-merge-master (&optional arg) 37 | (interactive) 38 | (magit-run-git "merge" "--no-edit" "--ff-only" (concat "origin/" (magit-get-current-branch)))) 39 | 40 | (defun magit-push-quickly-set-upstream (&optional args) 41 | "Push the current branch to some remote. 42 | When the Git variable `magit.pushRemote' is set, then push to 43 | that remote. If that variable is undefined or the remote does 44 | not exist, then push to \"origin\". If that also doesn't exist 45 | then raise an error. The local branch is pushed to the remote 46 | branch with the same name." 47 | (interactive (list (magit-push-arguments))) 48 | (-if-let (branch (magit-get-current-branch)) 49 | (-if-let (remote (or (magit-remote-p (magit-get "magit.pushRemote")) 50 | (magit-remote-p "origin"))) 51 | (magit-run-git-async "push" "--set-upstream" "-v" args remote branch) 52 | (user-error "Cannot determine remote to push to")) 53 | (user-error "No branch is checked out"))) 54 | 55 | 56 | (setq magit-mode-map 57 | (let ((map (make-keymap))) 58 | (suppress-keymap map t) 59 | (cond ((featurep 'jkl) 60 | (define-key map [return] 'magit-visit-thing) 61 | (define-key map [C-return] 'magit-dired-jump) 62 | (define-key map [tab] 'magit-section-toggle) 63 | (define-key map [C-tab] 'magit-section-cycle) 64 | (define-key map [M-tab] 'magit-section-cycle-diffs) 65 | (define-key map [S-tab] 'magit-section-cycle-global) 66 | (define-key map (kbd "M-o") 'magit-section-up) 67 | (define-key map (kbd "i") 'magit-section-backward) 68 | (define-key map (kbd "k") 'magit-section-forward) 69 | (define-key map (kbd "M-i") 'magit-section-backward-sibling) 70 | (define-key map (kbd "M-k") 'magit-section-forward-sibling) 71 | (define-key map (kbd "p") 'magit-push) 72 | (define-key map (kbd ",") 'magit-delete-thing) 73 | (define-key map (kbd ";") 'magit-file-untrack) 74 | (define-key map (kbd "C-c C-i") 'magit-gitignore)) 75 | (t 76 | (define-key map [C-return] 'magit-visit-thing) 77 | (define-key map (kbd "C-m") 'magit-visit-thing) 78 | (define-key map (kbd "C-M-i") 'magit-dired-jump) 79 | (define-key map (kbd "C-i") 'magit-section-toggle) 80 | (define-key map [C-tab] 'magit-section-cycle) 81 | (define-key map [M-tab] 'magit-section-cycle-diffs) 82 | ;; [backtab] is the most portable binding for Shift+Tab. 83 | (define-key map [backtab] 'magit-section-cycle-global) 84 | (define-key map (kbd "^") 'magit-section-up) 85 | (define-key map (kbd "p") 'magit-section-backward) 86 | (define-key map (kbd "n") 'magit-section-forward) 87 | (define-key map (kbd "M-p") 'magit-section-backward-sibling) 88 | (define-key map (kbd "M-n") 'magit-section-forward-sibling) 89 | ;; (define-key map (kbd "P") 'magit-push) 90 | (define-key map (kbd "k") 'magit-delete-thing) 91 | (define-key map (kbd "K") 'magit-file-untrack) 92 | (define-key map (kbd "i") 'magit-gitignore) 93 | (define-key map (kbd "I") 'magit-gitignore))) 94 | (define-key map (kbd "SPC") 'magit-diff-show-or-scroll-up) 95 | (define-key map (kbd "DEL") 'magit-diff-show-or-scroll-down) 96 | (define-key map "+" 'magit-diff-more-context) 97 | (define-key map "-" 'magit-diff-less-context) 98 | (define-key map "0" 'magit-diff-default-context) 99 | (define-key map "1" 'magit-section-show-level-1) 100 | (define-key map "2" 'magit-section-show-level-2) 101 | (define-key map "3" 'magit-section-show-level-3) 102 | (define-key map "4" 'magit-section-show-level-4) 103 | (define-key map (kbd "M-1") 'magit-section-show-level-1-all) 104 | (define-key map (kbd "M-2") 'magit-section-show-level-2-all) 105 | (define-key map (kbd "M-3") 'magit-section-show-level-3-all) 106 | (define-key map (kbd "M-4") 'magit-section-show-level-4-all) 107 | (define-key map "$" 'magit-process-buffer) 108 | (define-key map "%" 'magit-worktree) 109 | (define-key map "a" 'magit-cherry-apply) 110 | (define-key map "A" 'magit-cherry-pick) 111 | ;; (define-key map "b" 'magit-branch) 112 | ;; (define-key map "B" 'magit-bisect) 113 | (define-key map "c" 'magit-commit) 114 | (define-key map "C" 'magit-clone) 115 | (define-key map "d" 'magit-diff) 116 | (define-key map "D" 'magit-diff-refresh) 117 | (define-key map "e" 'magit-ediff-dwim) 118 | (define-key map "E" 'magit-ediff) 119 | (define-key map "f" 'magit-fetch) 120 | ;; (define-key map "F" 'magit-pull) 121 | (define-key map "g" 'magit-refresh) 122 | (define-key map "G" 'magit-refresh-all) 123 | ;; (define-key map "h" 'magit-dispatch) 124 | (define-key map "?" 'magit-dispatch) 125 | ;; (define-key map "l" 'magit-log) 126 | (define-key map "L" 'magit-log) 127 | (define-key map "m" 'magit-merge) 128 | ;; (define-key map "M" 'magit-remote) 129 | (define-key map "o" 'magit-submodule) 130 | (define-key map "O" 'magit-subtree) 131 | (define-key map "q" 'magit-mode-bury-buffer) 132 | (define-key map "r" 'magit-rebase) 133 | (define-key map "R" 'magit-file-rename) 134 | (define-key map "t" 'magit-tag) 135 | (define-key map "T" 'magit-notes) 136 | (define-key map "s" 'magit-stage-file) 137 | (define-key map "S" 'magit-stage-modified) 138 | (define-key map "u" 'magit-unstage-file) 139 | (define-key map "U" 'magit-unstage-all) 140 | (define-key map "v" 'magit-revert-no-commit) 141 | ;; (define-key map "V" 'magit-revert) 142 | (define-key map "w" 'magit-am) 143 | (define-key map "W" 'magit-patch) 144 | (define-key map "x" 'magit-reset-quickly) 145 | (define-key map "X" 'magit-reset) 146 | (define-key map "y" 'magit-show-refs) 147 | ;; (define-key map "Y" 'magit-cherry) 148 | (define-key map "z" 'magit-stash) 149 | (define-key map "Z" 'magit-stash) 150 | (define-key map ":" 'magit-git-command) 151 | (define-key map "!" 'magit-run) 152 | (define-key map (kbd "C-c C-c") 'magit-dispatch) 153 | (define-key map (kbd "C-c C-e") 'magit-edit-thing) 154 | (define-key map (kbd "C-c C-o") 'magit-browse-thing) 155 | (define-key map (kbd "C-c C-w") 'magit-browse-thing) 156 | (define-key map (kbd "C-x a") 'magit-add-change-log-entry) 157 | (define-key map (kbd "C-x 4 a") 'magit-add-change-log-entry-other-window) 158 | (define-key map (kbd "C-w") 'magit-copy-section-value) 159 | (define-key map (kbd "M-w") 'magit-copy-buffer-revision) 160 | (define-key map [remap previous-line] 'magit-previous-line) 161 | (define-key map [remap next-line] 'magit-next-line) 162 | (define-key map [remap evil-previous-line] 'evil-previous-visual-line) 163 | (define-key map [remap evil-next-line] 'evil-next-visual-line) 164 | ;; my additions 165 | (define-key map (kbd "V") 'magit-show-refs) 166 | (define-key map (kbd "J") 'magit-prune-origin) 167 | (define-key map (kbd "Y") 'magit-push) 168 | (define-key map (kbd "H") 'magit-merge-develop) 169 | (define-key map (kbd "Q") 'magit-merge-master) 170 | (define-key map (kbd "N") 'magit-clean-local-branches) 171 | ;; my changes 172 | ;; (define-key map (kbd "!") 'magit-shell-command) 173 | ;; (define-key map (kbd "t") 'magit-tag) 174 | ;; (define-key map "r" 'magit-rebase) 175 | ;; (define-key map "R" 'magit-rebase) 176 | (define-key map (kbd "P") 'magit-push-quickly-set-upstream) 177 | (define-key map (kbd "f") 'magit-fetch) 178 | (define-key map (kbd "b") 'magit-checkout) 179 | (define-key map (kbd "B") 'magit-branch-and-checkout) 180 | (define-key map (kbd "F") 'magit-fetch-all) 181 | (define-key map (kbd "l") 'magit-log-current) 182 | map)) 183 | 184 | (setq magit-status-mode-map 185 | (let ((map (make-sparse-keymap))) 186 | (set-keymap-parent map magit-mode-map) 187 | ;; my changes 188 | (define-key map (kbd "b") 'magit-checkout) 189 | (define-key map (kbd "B") 'magit-branch-and-checkout) 190 | ;; (define-key map (kbd "m") 'magit-merge-no-ff) 191 | (define-key map (kbd "M") 'magit-merge) 192 | ;; (define-key map (kbd "z") 'magit-stash) 193 | ;; (define-key map "r" 'magit-rebase) 194 | map)) 195 | 196 | (setq magit-display-buffer-function 197 | 'magit-display-buffer-traditional) 198 | 199 | ;; magit performance tracking 200 | ;; (setq magit-refresh-status-buffer nil) 201 | (magit-toggle-verbose-refresh) 202 | -------------------------------------------------------------------------------- /themes/john-zen-theme.el: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Emacs-Lisp -*- 2 | ;;; my color theme for in a 256 color terminal environment 3 | 4 | ;;------------------------------------------------------------------------- 5 | ;; Color Theme for use in the terminal! (256 color terminal!) 6 | ;;------------------------------------------------------------------------- 7 | ;; 8 | ;; based off zen-and-art color theme 9 | 10 | 11 | (deftheme john-zen "The john zen theme") 12 | 13 | (let ((class '((class color) (min-colors 89))) 14 | (ujelly-fg "#ffffff") 15 | (ujelly-bg "unspecified-bg") 16 | (ujelly-blue-0 "#8fbfdc") 17 | (ujelly-green-0 "#99ad6a") 18 | (ujelly-green-1 "#447799") 19 | (ujelly-green-2 "#a8ff60") 20 | (ujelly-grey-0 "#888888") 21 | (ujelly-grey-1 "#7f7f7f") 22 | (ujelly-grey-2 "#151515") 23 | (ujelly-orange-0 "#ffb964") 24 | (ujelly-purple-0 "#8197bf") 25 | (ujelly-purple-1 "#474e90") 26 | (ujelly-purple-2 "#cd00cd") 27 | (ujelly-red-0 "#cf6a4c") 28 | (ujelly-red-1 "#dd0093") 29 | (ujelly-red-2 "#de5577") 30 | (ujelly-yellow-0 "#fad07a") 31 | (ujelly-yellow-1 "#ffff00") 32 | (john-region "#191717") 33 | (john-fg "#d2dec4") 34 | (john-bg "#100e0e") 35 | (john-white "#ffffff") 36 | (john-black "#000000") 37 | (john-brightblack "#7f7f7f") 38 | (john-gray-3 "#121212") 39 | (john-gray-2 "#3a3a3a") 40 | (john-gray-1 "#585858") 41 | (john-gray-00 "#808080") 42 | (john-gray-0 "#e4e4e4") 43 | (john-magit-gray "grey30") 44 | (john-blue "blue") 45 | (john-brightblue "#00afff") 46 | (john-blue-0 "#0000ff") 47 | (john-brightgreen "#00ff00") 48 | (john-red-brown "#875f5f") 49 | (john-brown "#86453A") 50 | (john-orange "#ff7800") 51 | (john-red "red") 52 | (john-lightred "tomato") 53 | (john-greengreen "green") 54 | (john-green "#5faf5f") 55 | (john-green-1 "#5a7644") 56 | (john-green-0 "MediumAquamarine") 57 | (john-blurple "#46657B") 58 | (john-magenta "#d787ff") 59 | (john-orchid "#af87d7") 60 | (john-violet "Blueviolet") 61 | (john-violet-0 "#8787ff") 62 | (john-cyan "#ffff5f") ;; this is really some kind of yellow 63 | (john-yellow "#C6B032") 64 | (john-yellow-1 "#00e5ee")) 65 | 66 | (custom-theme-set-faces 67 | 'john-zen 68 | `(bold ((t (:bold t :foreground ,john-orange)))) 69 | `(bold-italic ((t (:bold t :underline t)))) 70 | `(border ((t (:foreground ,john-gray-0 :background ,john-gray-0)))) 71 | `(buffer-menu-buffer ((t (:background ,john-brightblack :foreground ,john-gray-0)))) 72 | `(button ((t (:foreground ,john-cyan :underline t)))) 73 | ;; `(change-log-acknowledgement ((t ()))) 74 | ;; `(change-log-conditionals ((t ()))) 75 | ;; `(change-log-date ((t ()))) 76 | ;; `(change-log-email ((t ()))) 77 | ;; `(change-log-file ((t ()))) 78 | ;; `(change-log-function ((t ()))) 79 | ;; `(change-log-list ((t ()))) 80 | ;; `(change-log-name ((t ()))) 81 | ;; `(comint-highlight-input ((t ()))) 82 | ;; `(comint-highlight-prompt ((t ()))) 83 | ;; `(compilation-column-number ((t ()))) 84 | `(compilation-error ((,class (:foreground ,ujelly-red-0)))) 85 | `(compilation-info ((,class (:foreground ,ujelly-yellow-0)))) 86 | `(compilation-line-number ((,class (:foreground ,ujelly-grey-0)))) 87 | ;; `(compilation-warning ((t ()))) 88 | ;; `(completions-annotations ((t ()))) 89 | ;; `(completions-common-part ((t ()))) 90 | ;; `(completions-first-difference ((t ()))) 91 | ;; `(css-property ((t ()))) 92 | ;; `(css-selector ((t ()))) 93 | ;; `(csv-separator-face ((t ()))) 94 | ;; `(cua-global-mark ((t ()))) 95 | ;; `(cua-rectangle ((t ()))) 96 | ;; `(cua-rectangle-noselect ((t ()))) 97 | `(cursor ((,class (:foreground ,john-greengreen)))) 98 | ;; `(custom-button ((t ()))) 99 | ;; `(custom-button-mouse ((t ()))) 100 | ;; `(custom-button-pressed ((t ()))) 101 | ;; `(custom-button-pressed-unraised ((t ()))) 102 | ;; `(custom-button-unraised ((t ()))) 103 | ;; `(custom-changed ((t ()))) 104 | ;; `(custom-comment ((t ()))) 105 | ;; `(custom-comment-tag ((t ()))) 106 | ;; `(custom-documentation ((t ()))) 107 | ;; `(custom-face-tag ((t ()))) 108 | ;; `(custom-group-tag ((t ()))) 109 | ;; `(custom-group-tag-1 ((t ()))) 110 | ;; `(custom-invalid ((t ()))) 111 | ;; `(custom-link ((t ()))) 112 | ;; `(custom-modified ((t ()))) 113 | ;; `(custom-rogue ((t ()))) 114 | ;; `(custom-saved ((t ()))) 115 | ;; `(custom-set ((t ()))) 116 | ;; `(custom-state ((t ()))) 117 | ;; `(custom-themed ((t ()))) 118 | ;; `(custom-variable-button ((t ()))) 119 | ;; `(custom-variable-tag ((t ()))) 120 | ;; `(custom-visibility ((t ()))) 121 | `(default ((t (:foreground ,john-fg :background ,john-bg)))) 122 | ;; `(diff-added ((t ()))) 123 | ;; `(diff-changed ((t ()))) 124 | ;; `(diff-context ((t ()))) 125 | `(diff-file-header ((t (:background ,john-bg :foreground ,john-fg)))) 126 | ;; `(diff-function ((t ()))) 127 | `(diff-header ((t (:background ,john-bg :foreground ,john-fg)))) 128 | ;; `(diff-hunk-header ((t ()))) 129 | ;; `(diff-index ((t ()))) 130 | ;; `(diff-indicator-added ((t ()))) 131 | ;; `(diff-indicator-changed ((t ()))) 132 | ;; `(diff-indicator-removed ((t ()))) 133 | ;; `(diff-nonexistent ((t ()))) 134 | ;; `(diff-refine-change ((t ()))) 135 | ;; `(diff-removed ((t ()))) 136 | ;; `(dired-directory ((t ()))) 137 | ;; `(dired-flagged ((t ()))) 138 | ;; `(dired-header ((t ()))) 139 | ;; `(dired-ignored ((t ()))) 140 | ;; `(dired-mark ((t ()))) 141 | ;; `(dired-marked ((t ()))) 142 | ;; `(dired-perm-write ((t ()))) 143 | ;; `(dired-symlink ((t ()))) 144 | ;; `(dired-warning ((t ()))) 145 | `(diredp-compressed-file-suffix ((t (:foreground ,john-green-0)))) 146 | `(diredp-date-time ((t (:foreground ,john-green-0)))) 147 | `(diredp-deletion ((t (:foreground ,john-green-0)))) 148 | `(diredp-deletion-file-name ((t (:foreground ,john-green-0)))) 149 | `(diredp-dir-heading ((t (:foreground ,john-green-0)))) 150 | `(diredp-dir-priv ((t (:foreground ,john-green-0)))) 151 | `(diredp-display-msg ((t (:foreground ,john-green-0)))) 152 | `(diredp-exec-priv ((t (:foreground ,john-green-0)))) 153 | `(diredp-executable-tag ((t (:foreground ,john-green-0)))) 154 | `(diredp-file-name ((t (:foreground ,john-blue)))) 155 | `(diredp-file-suffix ((t (:foreground ,john-green-0)))) 156 | `(diredp-flag-mark ((t (:background ,john-violet :foreground ,john-white)))) 157 | `(diredp-flag-mark-line ((t (:background ,john-bg :foreground ,john-violet)))) 158 | `(diredp-ignored-file-name ((t (:foreground ,john-green-0)))) 159 | `(diredp-link-priv ((t (:foreground ,john-green-0)))) 160 | `(diredp-no-priv ((t (:foreground ,john-green-0)))) 161 | `(diredp-number ((t (:foreground ,john-green-0)))) 162 | `(diredp-other-priv ((t (:foreground ,john-green-0)))) 163 | `(diredp-rare-priv ((t (:foreground ,john-green-0)))) 164 | `(diredp-read-priv ((t (:foreground ,john-green-0)))) 165 | `(diredp-symlink ((t (:foreground ,john-green-0)))) 166 | `(diredp-write-priv ((t (:foreground ,john-green-0)))) 167 | ;; `(doctest-output-face ((t ()))) 168 | ;; `(doctest-output-marker-face ((t ()))) 169 | ;; `(doctest-output-traceback-face ((t ()))) 170 | ;; `(doctest-prompt-face ((t ()))) 171 | ;; `(doctest-results-divider-face ((t ()))) 172 | ;; `(doctest-results-header-face ((t ()))) 173 | ;; `(doctest-results-loc-face ((t ()))) 174 | ;; `(doctest-results-selection-face ((t ()))) 175 | ;; `(doctest-selection-face ((t ()))) 176 | ;; `(ediff-current-diff-A ((t ()))) 177 | ;; `(ediff-current-diff-Ancestor ((t ()))) 178 | ;; `(ediff-current-diff-B ((t ()))) 179 | ;; `(ediff-current-diff-C ((t ()))) 180 | `(ediff-even-diff-A ((t (:background "#444444")))) 181 | ;; `(ediff-even-diff-Ancestor ((t ()))) 182 | `(ediff-even-diff-B ((t (:background "#444444")))) 183 | ;; `(ediff-even-diff-C ((t ()))) 184 | `(ediff-fine-diff-A ((t (:background "brightred" :foreground "black")))) 185 | ;; `(ediff-fine-diff-Ancestor ((t ()))) 186 | `(ediff-fine-diff-B ((t (:background "brightgreen" :foreground "black")))) 187 | ;; `(ediff-fine-diff-C ((t ()))) 188 | `(ediff-odd-diff-A ((t (:background "#444444")))) 189 | ;; `(ediff-odd-diff-Ancestor ((t ()))) 190 | `(ediff-odd-diff-B ((t (:background "#444444")))) 191 | ;; `(ediff-odd-diff-C ((t ()))) 192 | `(erc-notice-face ((,class (:foreground ,ujelly-yellow-0)))) 193 | `(erc-prompt-face ((,class (:foreground ,ujelly-fg)))) 194 | `(erc-timestamp-face ((,class (:foreground ,ujelly-purple-0)))) 195 | ;; `(escape-glyph ((t ()))) 196 | `(eshell-ls-directory ((,class (:weight normal :foreground ,ujelly-green-2)))) 197 | `(eshell-ls-executable ((,class (:foreground ,ujelly-red-0)))) 198 | `(eshell-ls-symlink ((,class (:foreground ,ujelly-purple-2)))) 199 | `(eshell-prompt ((,class (:foreground ,ujelly-red-0)))) 200 | ;; `(file-name-shadow ((t ()))) 201 | ;; `(fixed-pitch ((t ()))) 202 | ;; `(flymake-errline ((t ()))) 203 | ;; `(flymake-warnline ((t ()))) 204 | ;; `(flyspell-duplicate ((t ()))) 205 | ;; `(flyspell-incorrect ((t ()))) 206 | `(font-latex-math-face ((t (:foreground ,john-green)))) 207 | `(font-lock-builtin-face ((t (:foreground "#ff3f3f")))) 208 | `(font-lock-comment-delimiter-face ((t (:foreground ,john-blurple)))) 209 | `(font-lock-comment-face ((t (:foreground ,john-red)))) 210 | `(font-lock-constant-face ((t (:foreground ,john-gray-00)))) 211 | `(font-lock-doc-face ((t (:foreground ,john-blurple)))) 212 | `(font-lock-doc-string-face ((t (:foreground ,john-red)))) 213 | `(font-lock-function-name-face ((t (:foreground ,john-magenta)))) 214 | `(font-lock-keyword-face ((t (:foreground ,john-orange)))) 215 | ;; `(font-lock-negation-char-face ((t ()))) 216 | `(font-lock-preprocessor-face ((,class (:foreground ,john-red-brown)))) 217 | `(font-lock-reference-face ((t (:foreground ,john-yellow)))) 218 | ;; `(font-lock-regexp-grouping-backslash ((t ()))) 219 | ;; `(font-lock-regexp-grouping-construct ((t ()))) 220 | `(font-lock-string-face ((t (:foreground ,john-violet-0)))) 221 | `(font-lock-type-face ((t (:foreground ,john-yellow-1)))) 222 | `(font-lock-variable-name-face ((t (:foreground ,john-greengreen)))) 223 | `(font-lock-warning-face ((,class (:foreground ,ujelly-red-1)))) 224 | ;; `(fringe ((t ()))) 225 | `(header-line ((,class (:foreground ,john-orange :background ,john-black)))) 226 | ;; `(help-argument-name ((t ()))) 227 | ;; `(highlight ((t ()))) 228 | ;; `(highlight-changes ((t ()))) 229 | ;; `(highlight-changes-delete ((t ()))) 230 | `(highlight-current-line-face ((t (:background ,john-gray-3)))) 231 | ;; `(hl-line ((t ()))) 232 | `(ido-first-match ((,class (:foreground ,ujelly-yellow-0)))) 233 | ;; `(ido-incomplete-regexp ((t ()))) 234 | ;; `(ido-indicator ((t ()))) 235 | `(ido-only-match ((,class (:foreground ,ujelly-green-0)))) 236 | `(ido-subdir ((,class (:foreground ,ujelly-fg)))) 237 | ;; `(info-header-node ((t ()))) 238 | ;; `(info-header-xref ((t ()))) 239 | ;; `(info-menu-header ((t ()))) 240 | ;; `(info-menu-star ((t ()))) 241 | ;; `(info-node ((t ()))) 242 | ;; `(info-title-1 ((t ()))) 243 | ;; `(info-title-2 ((t ()))) 244 | ;; `(info-title-3 ((t ()))) 245 | ;; `(info-title-4 ((t ()))) 246 | ;; `(info-xref ((t ()))) 247 | ;; `(info-xref-visited ((t ()))) 248 | `(isearch ((t (:underline t :background ,john-gray-0 :foreground ,john-black)))) 249 | `(isearch-fail ((t (:underline t :background ,john-red :foreground ,john-black)))) 250 | `(italic ((t (:underline t)))) 251 | `(lazy-highlight ((t (:background ,john-gray-2)))) 252 | `(lazy-highlight ((,class (:foreground "unspecified")))) 253 | `(link ((t (:foreground ,john-cyan)))) 254 | ;; `(link-visited ((t ()))) 255 | `(linum ((t (:background ,john-white :foreground ,john-black)))) 256 | `(magit-branch ((,class (:foreground ,ujelly-red-2 :background ,john-bg :underline t)))) 257 | `(magit-diff-added ((t (:foreground ,john-greengreen :background ,john-bg)))) 258 | `(magit-diff-added-highlight ((t (:foreground ,john-greengreen :background "grey10")))) 259 | `(magit-diff-removed ((t (:foreground ,john-red :background ,john-bg)))) 260 | `(magit-diff-removed-highlight ((t (:foreground ,john-red :background "grey10")))) 261 | `(magit-diff-file-heading ((,class (:inherit nil)))) 262 | `(magit-diff-file-heading-highlight ((,class (:inherit magit-section-highlight)))) 263 | `(magit-diff-hunk-heading ((,class (:inherit nil :foreground ,ujelly-yellow-0)))) 264 | `(magit-diff-hunk-heading-highlight ((,class (:inherit nil :foreground ,ujelly-yellow-0 :background "grey10")))) 265 | `(magit-diff-context-highlight ((,class (:inherit nil :background "grey10")))) 266 | `(magit-diffstat-added ((,class (:foreground ,ujelly-green-0)))) 267 | `(magit-header ((t (:foreground ,john-orange)))) 268 | `(magit-item-highlight ((t (:background ,john-region)))) 269 | `(magit-log-graph ((t (:foreground ,john-magit-gray)))) 270 | ;; `(magit-log-head-label-bisect-bad ((t ()))) 271 | ;; `(magit-log-head-label-bisect-good ((t ()))) 272 | ;; `(magit-log-head-label-local ((t ()))) 273 | ;; `(magit-log-head-label-remote ((t ()))) 274 | ;; `(magit-log-head-label-tags ((t ()))) 275 | ;; `(magit-log-message ((t ()))) 276 | `(magit-log-sha1 ((t (:foreground ,john-lightred)))) 277 | ;; `(magit-log-tag-label ((t ()))) 278 | `(magit-section-heading ((,class (:foreground ,john-orange :background ,john-black :underline t)))) 279 | `(magit-section-highlight ((,class (:background "grey10")))) 280 | `(magit-whitespace-warning-face ((,class (:background ,ujelly-red-1)))) 281 | ;; `(markdown-blockquote-face ((t ()))) 282 | ;; `(markdown-bold-face ((t ()))) 283 | ;; `(markdown-comment-face ((t ()))) 284 | ;; `(markdown-header-face ((t ()))) 285 | ;; `(markdown-header-face-1 ((t ()))) 286 | ;; `(markdown-header-face-2 ((t ()))) 287 | ;; `(markdown-header-face-3 ((t ()))) 288 | ;; `(markdown-header-face-4 ((t ()))) 289 | ;; `(markdown-header-face-5 ((t ()))) 290 | ;; `(markdown-header-face-6 ((t ()))) 291 | ;; `(markdown-inline-code-face ((t ()))) 292 | ;; `(markdown-italic-face ((t ()))) 293 | ;; `(markdown-link-face ((t ()))) 294 | ;; `(markdown-link-title-face ((t ()))) 295 | ;; `(markdown-list-face ((t ()))) 296 | ;; `(markdown-math-face ((t ()))) 297 | ;; `(markdown-pre-face ((t ()))) 298 | ;; `(markdown-reference-face ((t ()))) 299 | ;; `(markdown-url-face ((t ()))) 300 | ;; `(match ((t ()))) 301 | ;; `(matlab-region-face ((t ()))) 302 | ;; `(matlab-simulink-keyword-face ((t ()))) 303 | ;; `(matlab-unterminated-string-face ((t ()))) 304 | ;; `(menu ((t ()))) 305 | ;; `(minibuffer-prompt ((t ()))) 306 | `(mode-line ((t (:background ,john-white :foreground ,john-black)))) 307 | ;; `(mode-line-buffer-id ((t ()))) 308 | ;; `(mode-line-emphasis ((t ()))) 309 | `(mode-line-highlight ((t (:background ,john-white :foreground ,john-gray-3)))) 310 | `(mode-line-inactive ((t (:background ,john-gray-1 :foreground ,john-white)))) 311 | ;; `(modeline-mousable ((t ()))) 312 | ;; `(modeline-mousable-minor-mode ((t ()))) 313 | ;; `(mouse ((t ()))) 314 | ;; `(mumamo-background-chunk-major ((t ()))) 315 | ;; `(mumamo-background-chunk-submode1 ((t ()))) 316 | ;; `(mumamo-background-chunk-submode2 ((t ()))) 317 | ;; `(mumamo-background-chunk-submode3 ((t ()))) 318 | ;; `(mumamo-background-chunk-submode4 ((t ()))) 319 | `(next-error ((t (:background ,john-gray-2 :foreground ,john-fg)))) 320 | ;; `(nobreak-space ((t ()))) 321 | `(org-checkbox ((,class (:foreground ,ujelly-orange-0)))) 322 | `(org-level-1 ((,class (:foreground ,ujelly-blue-0)))) 323 | `(org-level-2 ((,class (:foreground ,ujelly-yellow-0)))) 324 | `(org-level-3 ((,class (:foreground ,ujelly-purple-0)))) 325 | ;; `(outline-1 ((t ()))) 326 | ;; `(outline-2 ((t ()))) 327 | ;; `(outline-3 ((t ()))) 328 | ;; `(outline-4 ((t ()))) 329 | ;; `(outline-5 ((t ()))) 330 | ;; `(outline-6 ((t ()))) 331 | ;; `(outline-7 ((t ()))) 332 | ;; `(outline-8 ((t ()))) 333 | `(paren-face-match-light ((t (:background "#252323")))) 334 | ;; `(primary-selection ((t ()))) 335 | ;; `(py-XXX-tag-face ((t ()))) 336 | ;; `(py-builtins-face ((t ()))) 337 | ;; `(py-class-name-face ((t ()))) 338 | ;; `(py-decorators-face ((t ()))) 339 | ;; `(py-exception-name-face ((t ()))) 340 | ;; `(py-pseudo-keyword-face ((t ()))) 341 | ;; `(query-replace ((t ()))) 342 | `(region ((t (:background ,john-region)))) 343 | ;; `(scroll-bar ((t ()))) 344 | ;; `(secondary-selection ((t ()))) 345 | ;; `(shadow ((t ()))) 346 | ;; `(show-paren-match ((t ()))) 347 | ;; `(show-paren-mismatch ((t ()))) 348 | `(smerge-markers ((,class (:foreground ,ujelly-yellow-0)))) 349 | `(smerge-refined-change ((,class (:foreground ,ujelly-green-0)))) 350 | ;; `(tool-bar ((t ()))) 351 | ;; `(tooltip ((t ()))) 352 | `(trailing-whitespace ((,class (:background ,ujelly-red-1)))) 353 | `(underline ((t (:underline t)))) 354 | ;; `(variable-pitch ((t ()))) 355 | `(vertical-border ((t (:background ,john-gray-1 :foreground ,john-gray-0)))) 356 | ;; `(widget-button ((t ()))) 357 | ;; `(widget-button-pressed ((t ()))) 358 | ;; `(widget-documentation ((t ()))) 359 | ;; `(widget-field ((t ()))) 360 | ;; `(widget-inactive ((t ()))) 361 | ;; `(widget-single-line-field ((t ()))) 362 | ;; `(yas/field-debug-face ((t ()))) 363 | `(yas/field-highlight-face ((t (:background ,john-red :foreground ,john-gray-3)))) 364 | ;; `(zmacs-region ((t ()))) 365 | )) 366 | 367 | ;;; ###autoload 368 | (when load-file-name 369 | (add-to-list 'custom-theme-load-path 370 | (file-name-as-directory (file-name-directory load-file-name)))) 371 | 372 | (provide-theme 'john-zen) 373 | 374 | ;; (defun color-theme-john-super-theme () 375 | ;; "Irfn's zen with a bit of art and a bit of john." 376 | ;; (interactive) 377 | ;; (color-theme-install 378 | ;; (append 379 | ;; (list 'color-theme-john-super-theme 380 | ;; `((background-color . ,john-black) 381 | ;; (background-mode . dark) 382 | ;; (border-color . ,john-black) 383 | ;; (cursor-color . ,john-brightgreen) 384 | ;; (foreground-color . ,john-fg) 385 | ;; (list-matching-lines-face . bold) 386 | ;; (view-highlight-face . highlight)) 387 | ;; ) 388 | ;; ) 389 | ;; ) 390 | ;; ) 391 | -------------------------------------------------------------------------------- /lisp/csharp-mode.el: -------------------------------------------------------------------------------- 1 | ;;; csharp-mode.el --- C# mode derived mode 2 | 3 | ;; Author: Dylan R. E. Moonfire 4 | ;; Maintainer: Dylan R. E. Moonfire 5 | ;; Created: Feburary 2005 6 | ;; Modified: December 2009 7 | ;; Version: 0.7.1 - Dino Chiesa 8 | ;; Keywords: c# languages oop 9 | 10 | ;; This program is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation; either version 2 of the License, or 13 | ;; (at your option) any later version. 14 | ;; 15 | ;; This program is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | ;; 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program; see the file COPYING. If not, write to 22 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 | ;; Boston, MA 02111-1307, USA. 24 | 25 | ;;; Commentary: 26 | ;; 27 | ;; This is a separate mode to implement the C# constructs and 28 | ;; font-locking. It is based on the java-mode example from cc-mode. 29 | ;; 30 | ;; Note: The interface used in this file requires CC Mode 5.30 or 31 | ;; later. 32 | 33 | ;;; Bugs: 34 | ;; 35 | ;; Literal strings @"" do not fontify correctly. 36 | ;; 37 | ;; Method names are not fontified if you have an attribute before it. 38 | ;; 39 | ;; This code doesn't seem to work when you compile it, then 40 | ;; load/require in the emacs file. You will get an error (error 41 | ;; "`c-lang-defconst' must be used in a file") which happens because 42 | ;; cc-mode doesn't think it is in a buffer while loading directly 43 | ;; from the init. However, if you call it based on a file extension, 44 | ;; it works properly. Interestingly enough, this doesn't happen if 45 | ;; you don't byte-compile cc-mode. 46 | 47 | ;;; .emacs (don't put in (require 'csharp-mode)) 48 | ;; (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t) 49 | ;; (setq auto-mode-alist 50 | ;; (append '(("\\.cs$" . csharp-mode)) auto-mode-alist)) 51 | 52 | ;;; Versions: 53 | ;; 54 | ;; 0.1.0 - Initial release. 55 | ;; 0.2.0 - Fixed the identification on the "enum" keyword. 56 | ;; - Fixed the font-lock on the "base" keyword 57 | ;; 0.3.0 - Added a regex to fontify attributes. It isn't the 58 | ;; the best method, but it handles single-like attributes 59 | ;; well. 60 | ;; - Got "super" not to fontify as a keyword. 61 | ;; - Got extending classes and interfaces to fontify as something. 62 | ;; 0.4.0 - Removed the attribute matching because it broke more than 63 | ;; it fixed. 64 | ;; - Corrected a bug with namespace not being properly identified 65 | ;; and treating the class level as an inner object, which screwed 66 | ;; up formatting. 67 | ;; - Added "partial" to the keywords. 68 | ;; 0.5.0 - Found bugs with compiled cc-mode and loading from init files. 69 | ;; - Updated the eval-when-compile to code to let the mode be 70 | ;; compiled. 71 | ;; 0.6.0 - Added the c-filter-ops patch for 5.31.1 which made that 72 | ;; function in cc-langs.el unavailable. 73 | ;; - Added a csharp-lineup-region for indention #region and 74 | ;; #endregion block differently. 75 | ;; 0.7.0 - Added autoload so update-directory-autoloads words 76 | ;; (Thank you, Nikolaj Schumacher) 77 | ;; - Fontified the entire #region and #endregion lines. 78 | ;; - Initial work to get get, set, add, remove font-locked. 79 | ;; 0.7.1 - Added option to indent #if/endif with code 80 | ;; - Fixed c-opt-cpp-prefix defn (it must not include the BOL 81 | ;; char (^). 82 | ;; - proper fontification and indent of classes that inherit 83 | ;; (previously the colon was confusing the parser) 84 | ;; - reclassified namespace as a block beginner 85 | ;; - removed $ as a legal symbol char - not legal in C#. 86 | ;; - added struct to c-class-decl-kwds so indent is correct 87 | ;; within a struct. 88 | 89 | 90 | (message (concat "Loading " load-file-name)) 91 | 92 | 93 | ;; This is a copy of the function in cc-mode which is used to handle 94 | ;; the eval-when-compile which is needed during other times. 95 | (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate) 96 | ;; See cc-langs.el, a direct copy. 97 | (unless (listp (car-safe ops)) 98 | (setq ops (list ops))) 99 | (cond ((eq opgroup-filter t) 100 | (setq opgroup-filter (lambda (opgroup) t))) 101 | ((not (functionp opgroup-filter)) 102 | (setq opgroup-filter `(lambda (opgroup) 103 | (memq opgroup ',opgroup-filter))))) 104 | (cond ((eq op-filter t) 105 | (setq op-filter (lambda (op) t))) 106 | ((stringp op-filter) 107 | (setq op-filter `(lambda (op) 108 | (string-match ,op-filter op))))) 109 | (unless xlate 110 | (setq xlate 'identity)) 111 | (c-with-syntax-table (c-lang-const c-mode-syntax-table) 112 | (delete-duplicates 113 | (mapcan (lambda (opgroup) 114 | (when (if (symbolp (car opgroup)) 115 | (when (funcall opgroup-filter (car opgroup)) 116 | (setq opgroup (cdr opgroup)) 117 | t) 118 | t) 119 | (mapcan (lambda (op) 120 | (when (funcall op-filter op) 121 | (let ((res (funcall xlate op))) 122 | (if (listp res) res (list res))))) 123 | opgroup))) 124 | ops) 125 | :test 'equal))) 126 | 127 | ;; This inserts the bulk of the code. 128 | (require 'cc-mode) 129 | 130 | ;; These are only required at compile time to get the sources for the 131 | ;; language constants. (The cc-fonts require and the font-lock 132 | ;; related constants could additionally be put inside an 133 | ;; (eval-after-load "font-lock" ...) but then some trickery is 134 | ;; necessary to get them compiled.) 135 | (eval-when-compile 136 | (let ((load-path 137 | (if (and (boundp 'byte-compile-dest-file) 138 | (stringp byte-compile-dest-file)) 139 | (cons (file-name-directory byte-compile-dest-file) load-path) 140 | load-path))) 141 | (load "cc-mode" nil t) 142 | (load "cc-fonts" nil t) 143 | (load "cc-langs" nil t))) 144 | 145 | (eval-and-compile 146 | ;; Make our mode known to the language constant system. Use Java 147 | ;; mode as the fallback for the constants we don't change here. 148 | ;; This needs to be done also at compile time since the language 149 | ;; constants are evaluated then. 150 | (c-add-language 'csharp-mode 'java-mode)) 151 | 152 | ;; Indention: csharp-mode follows normal indention rules except for 153 | ;; when indenting the #region and #endregion blocks. This function 154 | ;; defines a custom indention to indent the #region blocks as normal 155 | ;; text. 156 | ;; 157 | ;; To use this indenting just put the following in your emacs file: 158 | ;; (c-set-offset 'cpp-macro 'csharp-lineup-region) 159 | (defun csharp-lineup-region (langelem) 160 | "Indent all #region and #endregion blocks inline with code while 161 | retaining normal column-zero indention for #if and the other 162 | processing blocks." 163 | (save-excursion 164 | (back-to-indentation) 165 | (if (re-search-forward "#\\(end\\)?region" (c-point 'eol) [0]) 0 [0]))) 166 | 167 | 168 | ;; Another option: indent both the if/endif and region/endregion 169 | ;; to lineup with whatever the current syntax state is. 170 | ;; 171 | ;; To use this indenting just put the following in your emacs file: 172 | ;; (c-set-offset 'cpp-macro 'csharp-lineup-if-and-region) 173 | (defun csharp-lineup-if-and-region (langelem) 174 | "Indent all #region/endregion blocks and #if/endif blocks inline with code while 175 | retaining normal column-zero indention for any other 176 | processing blocks." 177 | (save-excursion 178 | (back-to-indentation) 179 | (if (re-search-forward "#\\(end\\)?\\(if\\|region\\)" (c-point 'eol) [0]) 0 [0]))) 180 | 181 | 182 | 183 | (c-lang-defconst c-before-font-lock-function 184 | csharp nil) 185 | 186 | 187 | 188 | 189 | ;; TODO 190 | ;; Defines our constant for finding attributes. 191 | ;;(defconst csharp-attribute-regex "\\[\\([XmlType]+\\)(") 192 | ;;(defconst csharp-attribute-regex "\\[\\(.\\)") 193 | ;; This doesn't work because the string regex happens before this point 194 | ;; and getting the font-locking to work before and after is fairly difficult 195 | ;;(defconst csharp-attribute-regex 196 | ;; (concat 197 | ;; "\\[[a-zA-Z][ \ta-zA-Z0-9.]+" 198 | ;; "\\((.*\\)?" 199 | ;;)) 200 | 201 | ;; Java uses a series of regexes to change the font-lock for class 202 | ;; references. The problem comes in because Java uses Pascal (leading 203 | ;; space in names, SomeClass) for class and package names, but 204 | ;; Camel-casing (initial lowercase, upper case in words, 205 | ;; i.e. someVariable) for variables. The notation suggested by EMCA for C# is 206 | ;; to use Pascal notation for everything, except inner variables. So, 207 | ;; the Java regex and formatting produces very wrong results in C#. 208 | ;;(error (byte-compile-dest-file)) 209 | ;;(error (c-get-current-file)) 210 | (c-lang-defconst c-opt-after-id-concat-key 211 | csharp (if (c-lang-const c-opt-identifier-concat-key) 212 | (c-lang-const c-symbol-start))) 213 | 214 | (c-lang-defconst c-basic-matchers-before 215 | csharp `( 216 | ;;;; Font-lock the attributes by searching for the 217 | ;;;; appropriate regex and marking it as TODO. 218 | ;;,`(,(concat "\\(" csharp-attribute-regex "\\)") 219 | ;; 0 font-lock-function-name-face) 220 | 221 | ;; Put a warning face on the opener of unclosed strings that 222 | ;; can't span lines. Later font 223 | ;; lock packages have a `font-lock-syntactic-face-function' for 224 | ;; this, but it doesn't give the control we want since any 225 | ;; fontification done inside the function will be 226 | ;; unconditionally overridden. 227 | ,(c-make-font-lock-search-function 228 | ;; Match a char before the string starter to make 229 | ;; `c-skip-comments-and-strings' work correctly. 230 | (concat ".\\(" c-string-limit-regexp "\\)") 231 | '((c-font-lock-invalid-string))) 232 | 233 | ;; Fontify keyword constants. 234 | ,@(when (c-lang-const c-constant-kwds) 235 | (let ((re (c-make-keywords-re nil 236 | (c-lang-const c-constant-kwds)))) 237 | `((eval . (list ,(concat "\\<\\(" re "\\)\\>") 238 | 1 c-constant-face-name))))) 239 | 240 | ;; Fontify all keywords except the primitive types. 241 | ,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp)) 242 | 1 font-lock-keyword-face) 243 | 244 | ;; Fontify leading identifiers in fully qualified names like 245 | ;; "Foo.Bar". 246 | ,@(when (c-lang-const c-opt-identifier-concat-key) 247 | `((,(byte-compile 248 | `(lambda (limit) 249 | (while (re-search-forward 250 | ,(concat "\\(\\<" ; 1 251 | "\\(" (c-lang-const c-symbol-key) 252 | "\\)" ; 2 253 | "[ \t\n\r\f\v]*" 254 | (c-lang-const 255 | c-opt-identifier-concat-key) 256 | "[ \t\n\r\f\v]*" 257 | "\\)" 258 | "\\(" 259 | (c-lang-const 260 | c-opt-after-id-concat-key) 261 | "\\)") 262 | limit t) 263 | (unless (progn 264 | (goto-char (match-beginning 0)) 265 | (c-skip-comments-and-strings limit)) 266 | (or (get-text-property (match-beginning 2) 'face) 267 | (c-put-font-lock-face (match-beginning 2) 268 | (match-end 2) 269 | c-reference-face-name)) 270 | (goto-char (match-end 1))))))))) 271 | )) 272 | 273 | ;; C# does not allow a leading qualifier operator. It also doesn't 274 | ;; allow the ".*" construct of Java. So, we redo this regex without 275 | ;; the "\\|\\*" regex. 276 | (c-lang-defconst c-identifier-key 277 | csharp (concat "\\(" (c-lang-const c-symbol-key) "\\)" ; 1 278 | (concat "\\(" 279 | "[ \t\n\r\f\v]*" 280 | (c-lang-const c-opt-identifier-concat-key) 281 | "[ \t\n\r\f\v]*" 282 | (concat "\\(" 283 | "\\(" (c-lang-const c-symbol-key) "\\)" 284 | "\\)") 285 | "\\)*"))) 286 | 287 | ;; C# has a few rules that are slightly different than Java for 288 | ;; operators. This also removed the Java's "super" and replaces it 289 | ;; with the C#'s "base". 290 | (c-lang-defconst c-operators 291 | csharp `((prefix "base"))) 292 | 293 | 294 | ;; ======================================================= 295 | ;; setting values of constants defined in cc-langs.el 296 | 297 | ;; C# uses CPP-like prefixes to mark #define, #region/endregion, 298 | ;; #if/else/endif, and #pragma. This regexp matches the prefix, 299 | ;; not including the beginning-of-line (BOL), and not including 300 | ;; the term after the prefix (define, pragma, etc). This regexp says 301 | ;; whitespace, followed by the prefix, followed by maybe more whitespace. 302 | ;; I think. 303 | 304 | (c-lang-defconst c-opt-cpp-prefix 305 | csharp "\\s *#\\s *") 306 | 307 | 308 | ;; there are no message directives in C# 309 | (c-lang-defconst c-cpp-message-directives 310 | csharp nil) 311 | 312 | (c-lang-defconst c-cpp-expr-directives 313 | csharp '("if")) 314 | 315 | (c-lang-defconst c-opt-cpp-macro-define 316 | csharp "define") 317 | 318 | ;; $ is not a legal char in an identifier in C#. So we need to 319 | ;; create a csharp-specific definition of this constant. 320 | (c-lang-defconst c-symbol-chars 321 | csharp (concat c-alnum "_")) 322 | 323 | 324 | (c-lang-defconst c-colon-type-list-kwds 325 | csharp '("class")) 326 | 327 | (c-lang-defconst c-block-prefix-disallowed-chars 328 | 329 | ;; Allow ':' for inherit list starters. 330 | csharp (set-difference (c-lang-const c-block-prefix-disallowed-chars) 331 | '(?:))) 332 | 333 | 334 | ;; ======================================================= 335 | 336 | 337 | 338 | ;; C# uses the following assignment operators 339 | (c-lang-defconst c-assignment-operators 340 | csharp '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<=" "&=" "^=" "|=")) 341 | 342 | ;; This defines the primative types for C# 343 | (c-lang-defconst c-primitive-type-kwds 344 | ;; ECMA-344, S8 345 | csharp '("object" "string" "sbyte" "short" "int" "long" "byte" 346 | "ushort" "uint" "ulong" "float" "double" "bool" "char" 347 | "decimal" "void")) 348 | 349 | ;; The keywords that define that the following is a type, such as a 350 | ;; class definition. 351 | (c-lang-defconst c-type-prefix-kwds 352 | ;; ECMA-344, S? 353 | csharp '("class" "interface" "enum" "struct")) 354 | 355 | ;; Type modifier keywords. They appear anywhere in types, but modify 356 | ;; instead create one. 357 | (c-lang-defconst c-type-modifier-kwds 358 | ;; EMCA-344, S? 359 | csharp '("readonly" "const")) 360 | 361 | ;; Structures that are similiar to classes. 362 | (c-lang-defconst c-class-decl-kwds 363 | ;; EMCA-344, S? 364 | csharp '("class" "interface" "struct")) 365 | 366 | ;; The various modifiers used for class and method descriptions. 367 | (c-lang-defconst c-modifier-kwds 368 | csharp '("public" "partial" "private" "const" "abstract" 369 | "protected" "ref" "out" "static" "virtual" 370 | "override" "params" "internal")) 371 | 372 | ;; We don't use the protection level stuff because it breaks the 373 | ;; method indenting. Not sure why, though. 374 | (c-lang-defconst c-protection-kwds 375 | csharp nil) 376 | 377 | ;; Define the keywords that can have something following after them. 378 | (c-lang-defconst c-type-list-kwds 379 | csharp '("struct" "class" "interface" "is" "as" 380 | "delegate" "event" "set" "get" "add" "remove")) 381 | 382 | ;; This allows the classes after the : in the class declartion to be 383 | ;; fontified. 384 | (c-lang-defconst c-typeless-decl-kwds 385 | csharp '(":")) 386 | 387 | ;; Sets up the enum to handle the list properly 388 | (c-lang-defconst c-brace-list-decl-kwds 389 | csharp '("enum")) 390 | 391 | 392 | ;; (c-lang-defconst c-ref-list-kwds 393 | ;; csharp '("using" "namespace")) 394 | 395 | 396 | (c-lang-defconst c-other-block-decl-kwds 397 | csharp '("using" "namespace")) 398 | 399 | ;; Statement keywords followed directly by a substatement 400 | (c-lang-defconst c-block-stmt-1-kwds 401 | csharp '("do" "try" "finally")) 402 | 403 | 404 | ;; Statement keywords followed by a paren sexp and then by a substatement. 405 | (c-lang-defconst c-block-stmt-2-kwds 406 | csharp '("for" "if" "switch" "while" "catch" "foreach" 407 | "checked" "unchecked" "lock")) 408 | 409 | 410 | ;; Statements that break out of braces 411 | (c-lang-defconst c-simple-stmt-kwds 412 | csharp '("return" "continue" "break" "throw" "goto" )) 413 | 414 | ;; Statements that allow a label 415 | ;; TODO? 416 | (c-lang-defconst c-before-label-kwds 417 | csharp nil) 418 | 419 | ;; Constant keywords 420 | (c-lang-defconst c-constant-kwds 421 | csharp '("true" "false" "null")) 422 | 423 | ;; Keywords that start "primary expressions." 424 | (c-lang-defconst c-primary-expr-kwds 425 | csharp '("this" "base")) 426 | 427 | ;; We need to treat namespace as an outer block so class indenting 428 | ;; works properly. 429 | (c-lang-defconst c-other-block-decl-kwds 430 | csharp '("namespace")) 431 | 432 | ;; We need to include the "as" for the foreach 433 | (c-lang-defconst c-other-kwds 434 | csharp '("in" "sizeof" "typeof" "is" "as")) 435 | 436 | (c-lang-defconst c-overloadable-operators 437 | ;; EMCA-344, S14.2.1 438 | csharp '("+" "-" "*" "/" "%" "&" "|" "^" 439 | "<<" ">>" "==" "!=" ">" "<" ">=" "<=")) 440 | 441 | 442 | ;; This c-cpp-matchers stuff is used for fontification. 443 | ;; see cc-font.el 444 | ;; 445 | 446 | ;; No cpp in this language, but there are still directives to fontify: 447 | ;; "#pragma", #region/endregion, #if/else/endif. (The definitions for 448 | ;; the extra keywords above are enough to incorporate them into the 449 | ;; fontification regexps for types and keywords, so no additional 450 | ;; font-lock patterns are required for keywords.) 451 | 452 | (c-lang-defconst c-cpp-matchers 453 | csharp (cons 454 | ;; Use the eval form for `font-lock-keywords' to be able to use 455 | ;; the `c-preprocessor-face-name' variable that maps to a 456 | ;; suitable face depending on the (X)Emacs version. 457 | '(eval . (list "^\\s *\\(#pragma\\)\\>\\(.*\\)" 458 | (list 1 c-preprocessor-face-name) 459 | '(2 font-lock-string-face))) 460 | ;; There are some other things in `c-cpp-matchers' besides the 461 | ;; preprocessor support, so include it. 462 | (c-lang-const c-cpp-matchers))) 463 | 464 | (defcustom csharp-font-lock-extra-types nil 465 | "*List of extra types (aside from the type keywords) to recognize in C# mode. 466 | Each list item should be a regexp matching a single identifier.") 467 | 468 | (defconst csharp-font-lock-keywords-1 (c-lang-const c-matchers-1 csharp) 469 | "Minimal highlighting for C# mode.") 470 | 471 | (defconst csharp-font-lock-keywords-2 (c-lang-const c-matchers-2 csharp) 472 | "Fast normal highlighting for C# mode.") 473 | 474 | (defconst csharp-font-lock-keywords-3 (c-lang-const c-matchers-3 csharp) 475 | "Accurate normal highlighting for C# mode.") 476 | 477 | (defvar csharp-font-lock-keywords csharp-font-lock-keywords-3 478 | "Default expressions to highlight in C# mode.") 479 | 480 | (defvar csharp-mode-syntax-table nil 481 | "Syntax table used in csharp-mode buffers.") 482 | (or csharp-mode-syntax-table 483 | (setq csharp-mode-syntax-table 484 | (funcall (c-lang-const c-make-mode-syntax-table csharp)))) 485 | 486 | (defvar csharp-mode-abbrev-table nil 487 | "Abbreviation table used in csharp-mode buffers.") 488 | (c-define-abbrev-table 'csharp-mode-abbrev-table 489 | ;; Keywords that if they occur first on a line might alter the 490 | ;; syntactic context, and which therefore should trig reindentation 491 | ;; when they are completed. 492 | '(("else" "else" c-electric-continued-statement 0) 493 | ("while" "while" c-electric-continued-statement 0) 494 | ("catch" "catch" c-electric-continued-statement 0) 495 | ("finally" "finally" c-electric-continued-statement 0))) 496 | 497 | (defvar csharp-mode-map (let ((map (c-make-inherited-keymap))) 498 | ;; Add bindings which are only useful for C# 499 | map) 500 | "Keymap used in csharp-mode buffers.") 501 | 502 | ;;(easy-menu-define csharp-menu csharp-mode-map "C# Mode Commands" 503 | ;; ;; Can use `csharp' as the language for `c-mode-menu' 504 | ;; ;; since its definition covers any language. In 505 | ;; ;; this case the language is used to adapt to the 506 | ;; ;; nonexistence of a cpp pass and thus removing some 507 | ;; ;; irrelevant menu alternatives. 508 | ;; (cons "C#" (c-lang-const c-mode-menu csharp))) 509 | 510 | ;;; Autoload mode trigger 511 | ;;;###autoload 512 | (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode)) 513 | 514 | ;; Custom variables 515 | ;;;###autoload 516 | (defcustom csharp-mode-hook nil 517 | "*Hook called by `csharp-mode'." 518 | :type 'hook 519 | :group 'c) 520 | 521 | ;;; The entry point into the mode 522 | ;;;###autoload 523 | (defun csharp-mode () 524 | "Major mode for editing C# code. This mode is derived from CC Mode to 525 | support C#. 526 | 527 | The hook `c-mode-common-hook' is run with no args at mode 528 | initialization, then `csharp-mode-hook'. 529 | 530 | Key bindings: 531 | \\{csharp-mode-map}" 532 | (interactive) 533 | (kill-all-local-variables) 534 | (make-local-variable 'beginning-of-defun-function) 535 | (make-local-variable 'end-of-defun-function) 536 | (c-initialize-cc-mode t) 537 | (set-syntax-table csharp-mode-syntax-table) 538 | (setq major-mode 'csharp-mode 539 | mode-name "C#" 540 | local-abbrev-table csharp-mode-abbrev-table 541 | abbrev-mode t) 542 | (use-local-map c-mode-map) 543 | ;; `c-init-language-vars' is a macro that is expanded at compile 544 | ;; time to a large `setq' with all the language variables and their 545 | ;; customized values for our language. 546 | (c-init-language-vars csharp-mode) 547 | ;; `c-common-init' initializes most of the components of a CC Mode 548 | ;; buffer, including setup of the mode menu, font-lock, etc. 549 | ;; There's also a lower level routine `c-basic-common-init' that 550 | ;; only makes the necessary initialization to get the syntactic 551 | ;; analysis and similar things working. 552 | 553 | (c-common-init 'csharp-mode) 554 | ;;(easy-menu-add csharp-menu) 555 | (run-hooks 'c-mode-common-hook) 556 | (run-hooks 'csharp-mode-hook) 557 | (c-update-modeline) 558 | 559 | ;; allow fill-paragraph to work on xml code doc 560 | (make-local-variable 'paragraph-separate) 561 | (setq paragraph-separate "[ \t]*\\(//+\\|\\**\\)\\([ \t]+\\|[ \t]+<.+?>\\)$\\|^\f") 562 | 563 | ) 564 | 565 | 566 | (message (concat "Done loading " load-file-name)) 567 | 568 | 569 | 570 | 571 | (provide 'csharp-mode) 572 | 573 | ;;; csharp-mode.el ends here 574 | --------------------------------------------------------------------------------