Skip to content

Instantly share code, notes, and snippets.

@SpiritLevel
Last active August 5, 2019 05:45
Show Gist options
  • Save SpiritLevel/80caa108d4b7d699520c to your computer and use it in GitHub Desktop.
Save SpiritLevel/80caa108d4b7d699520c to your computer and use it in GitHub Desktop.
SilverStripe mode for Emacs
;; Taken from https://gist.github.com/mmichelli/1062600
;; replace html-mode with web-mode in line 4 to get more web-mode like behaviour
(define-derived-mode silverstripe-mode html-mode "Silverstripe"
(font-lock-add-keywords
nil
'(
("\\(<% \\| %>\\)" 1 font-lock-keyword-face)
("\\(\\(if\\|else\\|control\\|cacheblock\\|Level\\|end_[a-zA-Z1-9_\.]*\\|include\\)+\\)\\>" 1 font-lock-function-name-face)
("\\(.\\(Title\\|NexPageLink\\|Link\\|RelativeLink\\|ChildrenOf\\|Page\\|Level\\|Menu\\|Section2\\|LoginForm\\|SilverStripeNavigator\\|PageComments\\|Now\\|LinkTo\\|AbsoluteLink\\|CurrentMember\\|PastVisitor\\|PastMember\\|XML_val\\|RAW_val\\|SQL_val\\|JS_val\\|ATT_val\\|First\\|Last\\|FirstLast\\|MiddleString\\|Middle\\|Even\\|Odd\\|EvenOdd\\|Pos\\|TotalItems\\|BaseHref\\|Debug\\|CurrentPage\\|Top\\)+\\)\\>" 1 font-lock-constant-face)
("\\(.\\(ID\\|ClassName\\|Created\\|LastEdited\\|URLSegment\\|Title\\|MenuTitle\\|Content\\|MetaTitle\\|MetaDescription\\|MetaKeywords\\|ShowInMenus\\|ShowInSearch\\|HomepageForDomain\\|ProvideComments\\|Sort\\|LegacyURL\\|HasBrokenFile\\|HasBrokenLink\\|Status\\|ReportClass\\|ParentID\\|Version\\|EmailTo\\|EmailOnSubmit\\|SubmitButtonText\\|OnCompleteMessage\\|Subscribe\\|AllNewsletters\\|Subject\\|ErrorCode\\|LinkedPageID\\|RedirectionType\\|ExternalURL\\|LinkToID\\|VersionID\\|CopyContentFromID\\|RecordClassName\\)+\\)\\>" 1 font-lock-constant-face)
("\\(.\\(Link\\|LinkOrCurrent\\|LinkOrSection\\|LinkingMode\\|ElementName\\|InSection\\|Comments\\|Breadcrumbs\\|NestedTitle\\|MetaTags\\|ContentSource\\|MultipleParents\\|TreeTitle\\|CMSTreeClasses\\|Now\\|LinkTo\\|AbsoluteLink\\|CurrentMember\\|PastVisitor\\|PastMember\\|XML_val\\|RAW_val\\|SQL_val\\|JS_val\\|ATT_val\\|First\\|Last\\|FirstLast\\|MiddleString\\|Middle\\|Even\\|Odd\\|EvenOdd\\|Pos\\|TotalItems\\|BaseHref\\|CurrentPage\\|Top\\)+\\)\\>" 1 font-lock-constant-face)
("\\($[a-zA-Z1-9_\.]*\\)" 1 font-lock-type-face))
)
(font-lock-mode 1)
)
(setq auto-mode-alist (cons '( "\\.ss\\'" . silverstripe-mode ) auto-mode-alist ))
(provide 'silverstripe-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment