Skip to content

Instantly share code, notes, and snippets.

@am0c
Created September 29, 2012 05:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save am0c/3803249 to your computer and use it in GitHub Desktop.
Save am0c/3803249 to your computer and use it in GitHub Desktop.
emacs config for Mojolicious::Lite file
;
; mmm-mode config for Mojolicious::Lite perl file.
; mmm-mode lib is from here: https://github.com/purcell/mmm-mode
; font locks of [c]perl-mode and mmm-mode conflict each other.
;
(add-to-list 'load-path "~/.emacs.d/packages/mmm-mode")
(require 'mmm-auto)
(require 'mmm-compat)
(require 'mmm-vars)
(setq mmm-global-mode 'maybe)
(global-set-key "\M-p" 'mmm-parse-buffer)
;(mmm-set-major-mode-preference 'cperl-mode 'perl-mojo)
(defun mmm-perl-mojo-get-mode (delimiter)
(let ((filename (substring delimiter 3 nil)))
(or (assoc-default filename auto-mode-alist #'string-match)
'fundamental-mode
(signal 'mmm-no-matching-submode nil))))
(mmm-add-group 'perl-mojo '((perl-mojo-blocks
:match-submode mmm-perl-mojo-get-mode
:front "^@@ \\(.+\\)$"
:front-offset (end-of-line 1)
:back "\\(^@@\\|\\'\\)"
:back-offset (beginning-of-line -1)
:save-matches t
:delimiter-mode nil
:end-not-begin nil
:face mmm-code-submode-face
)))
(mmm-add-mode-ext-class 'perl-mode "\\.pl$" 'perl-mojo)
(setq mmm-submode-mode-line-format "~M[~m]")
(setq mmm-submode-decoration-level 2)
@alex0112
Copy link

alex0112 commented Apr 8, 2014

To implement this does one simply save it as a file (mojo.el) and then reference that file in the .emacs file? ((provide 'wpdl-mode) (require '/home/foo/mojo.el)) Is that correct? Or am I mistaken?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment