Skip to content

Instantly share code, notes, and snippets.

@prakashk
Created January 15, 2013 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prakashk/4542481 to your computer and use it in GitHub Desktop.
Save prakashk/4542481 to your computer and use it in GitHub Desktop.
(require 'generic-x)
;; pkc mode keywords
(setq pkc-keywords-list '("compute" "count" "dedupe" "embed" "file" "frequency" "function"
"join" "keep" "macro" "minus" "print" "project" "result" "select" "union" "use"))
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(mmm-add-classes
'((embedded-c++
:submode c++-mode
:face mmm-default-submode-face
:front "{{{"
:front-offset -1
:back "}}}"
:back-offset 1)))
(define-generic-mode
'pkc-mode ;; name of the mode to create
'("//" ("/*" . "*/")) ;; comments start with
pkc-keywords-list ;; some keywords
'(("^\\s-*macro\\s-+\\([A-Za-z0-9_]+\\)"
(1 font-lock-function-name-face))
("\\$\\([A-Za-z0-9_]+\\)"
(0 font-lock-variable-name-face)))
'("\\.pkc$") ;; files for which to activate this mode
;; other functions to call
'((lambda ()
(require 'mmm-vars)
(mmm-add-mode-ext-class 'pkc-mode nil 'embedded-c++)
(message "pkc-mode[mmm] is on")))
"A mode for pkc script files" ;; doc string for this mode
)
use "some-file.pkc"
embed {{{
// C++ code
int incr(int x)
{
return x + 1;
}
}}}
// some pkc code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment