/usr/share/emacs/site-lisp/liquidsoap-mode/liquidsoap-mode.el is in liquidsoap-mode 1.1.1-7.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | ;; liquidsoap-mode.el -- Liquidsoap major mode
;; Copyright (C) 2013 Samuel Mimram
(defvar liquidsoap-font-lock-keywords
'(
("#.*" . 'font-lock-comment-face)
("^\\(%ifdef .*\\|%ifencoder .*\\|%endif\\|%include\\)" . 'font-lock-preprocessor-face)
("\\<\\(fun\\|def\\|begin\\|end\\|if\\|then\\|else\\|elsif\\)\\>\\|->\\|;" . font-lock-keyword-face)
("\\<\\(and\\|or\\|not\\|mod\\|ref\\)\\>\\|:=" . font-lock-builtin-face)
("\\<\\(true\\|false\\)\\>" . font-lock-constant-face)
("\\<def[ \t]+\\([^ (]*\\)" 1 'font-lock-function-name-face)
)
)
(defvar liquidsoap-mode-syntax-table
(let ((st (make-syntax-table)))
;; Allow some extra characters in words
(modify-syntax-entry ?_ "w" st)
;; Comments
(modify-syntax-entry ?# "<" st)
(modify-syntax-entry ?\n ">" st)
st)
"Syntax table for Liquidsoap major mode.")
(defvar liquidsoap-tab-width 2)
;see http://www.emacswiki.org/emacs/ModeTutorial
(defun liquidsoap-indent-line ()
"Indent current Liquidsoap line"
(interactive)
(beginning-of-line)
; At begining, no indentation
(if (bobp) (indent-line-to 0)
; not-indented is a boolean saying we found a match looking backward
; cur-indent is the current indetation
(let ((not-indented t) cur-indent)
; De-indent after end
(if (looking-at "^[ \t]*\\(end\\|else\\|elsif\\|then\\|%endif\\)")
(progn
(save-excursion
(forward-line -1)
(setq cur-indent (- (current-indentation) liquidsoap-tab-width)))
(if (< cur-indent 0) (setq cur-indent 0)))
(save-excursion
(while not-indented
(forward-line -1)
; Indent as much as the last end
(if (looking-at "^[ \t]*\\(end\\|%endif\\)")
(progn
(setq cur-indent (current-indentation))
(setq not-indented nil))
; Increment if we find that we are in a block
(if (looking-at "^[ \t]*\\(def\\|if\\|then\\|elsif\\|%ifdef\\|.*=$\\)")
(progn
(setq cur-indent (+ (current-indentation) liquidsoap-tab-width))
(setq not-indented nil))
; Same as previous line otherwise
(if (bobp) (setq not-indented nil))
)
)
)
)
)
; If we didn't see an indentation hint, then allow no indentation
(if cur-indent (indent-line-to cur-indent) (indent-line-to 0))
)
)
)
(define-derived-mode liquidsoap-mode fundamental-mode
"Liquidsoap" "Major mode for Liquidsoap files."
:syntax-table liquidsoap-mode-syntax-table
(set (make-local-variable 'comment-start) "#")
(set (make-local-variable 'comment-start-skip) "#+\\s-*")
(set (make-local-variable 'indent-line-function) 'liquidsoap-indent-line)
(set (make-local-variable 'font-lock-defaults) '(liquidsoap-font-lock-keywords))
(setq mode-name "Liquidsoap")
)
(provide 'liquidsoap-mode)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.liq\\'" . liquidsoap-mode))
|