Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 80fe02c2e6
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 52 lines (42 sloc) 1.661 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
(require 'cc-mode)
(require 'yasnippet)

(add-to-list 'c-style-alist
             '("edg"
               (indent-tabs-mode . nil)
               (c-basic-offset . 2)
               (c-comment-only-line-offset . (0 . 0))
               (c-hanging-braces-alist
                . ((substatement-open before after)
                   (arglist-cont-nonempty)))
               (c-offsets-alist
                . ((statement-block-intro . +)
                   (knr-argdecl-intro . 5)
                   (substatement-open . 0)
                   (substatement-label . 0)
                   (label . 0)
                   (case-label . +)
                   (statement-case-open . 0)
                   (statement-cont . +)
                   (arglist-intro . +)
                   (arglist-close . +)
                   (inline-open . 0)
                   (brace-list-open . 0)
                   (topmost-intro-cont
                    . (first c-lineup-topmost-intro-cont
                             c-lineup-gnu-DEFUN-intro-cont))))
               (c-special-indent-hook . c-gnu-impose-minimum)
               (c-block-comment-prefix . "")))

(define-minor-mode edg-mode
  "Minor mode for editing EDG code.")

(yas/define-snippets
 'cc-mode
 '(("if" "if ($0) {\n} /* if */" "if" edg-mode)

   ("ife" "if ($0) {\n} else {\n} /* if */" "ife" edg-mode)

   ("switch"
    "switch ($0) {\ncase :\nbreak;\ndefault:\nbreak;\n} /* switch */"
    "switch" edg-mode)

   ("for" "for ($0; ; ) {\n} /* for */" "for" edg-mode)

   ("while" "while ($0) {\n} /* while */" "while" edg-mode)

   ("defun" "void $1($0) {\n} /* $1 */" "defun" edg-mode)
   ))

(provide 'edg)
Something went wrong with that request. Please try again.