Prepare nix-mode to be uploaded to marmalade
Signed-off-by: Ricky Elrod <ricky@elrod.me>
This commit is contained in:
parent
95501c4dee
commit
36662eb562
1 changed files with 14 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
;;; nix-mode.el --- Major mode for editing Nix expressions.
|
||||||
|
|
||||||
|
;; Author: Eelco Dolstra
|
||||||
|
;; URL: https://github.com/NixOS/nix/tree/master/misc/emacs
|
||||||
|
;; Version: 1.0
|
||||||
|
|
||||||
(defun nix-mode ()
|
(defun nix-mode ()
|
||||||
"Major mode for editing Nix expressions.
|
"Major mode for editing Nix expressions.
|
||||||
|
|
||||||
|
@ -21,9 +27,9 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||||
"
|
"
|
||||||
|
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
||||||
(kill-all-local-variables)
|
(kill-all-local-variables)
|
||||||
|
|
||||||
(setq major-mode 'nix-mode)
|
(setq major-mode 'nix-mode)
|
||||||
(setq mode-name "Nix")
|
(setq mode-name "Nix")
|
||||||
|
|
||||||
|
@ -53,9 +59,8 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||||
(setq paragraph-start "[ \t]*\\(#+[ \t]*\\)?$")
|
(setq paragraph-start "[ \t]*\\(#+[ \t]*\\)?$")
|
||||||
(make-local-variable 'paragraph-separate)
|
(make-local-variable 'paragraph-separate)
|
||||||
(setq paragraph-separate paragraph-start)
|
(setq paragraph-separate paragraph-start)
|
||||||
|
|
||||||
(run-hooks 'nix-mode-hook)
|
(run-hooks 'nix-mode-hook))
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(defvar nix-mode-map nil
|
(defvar nix-mode-map nil
|
||||||
|
@ -83,8 +88,7 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||||
("<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>"
|
("<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>"
|
||||||
. font-lock-constant-face)
|
. font-lock-constant-face)
|
||||||
("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"
|
("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"
|
||||||
. font-lock-constant-face)
|
. font-lock-constant-face)))
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(defvar nix-mode-syntax-table nil
|
(defvar nix-mode-syntax-table nil
|
||||||
|
@ -97,8 +101,7 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||||
(modify-syntax-entry ?/ ". 14" nix-mode-syntax-table)
|
(modify-syntax-entry ?/ ". 14" nix-mode-syntax-table)
|
||||||
(modify-syntax-entry ?* ". 23" nix-mode-syntax-table)
|
(modify-syntax-entry ?* ". 23" nix-mode-syntax-table)
|
||||||
(modify-syntax-entry ?# "< b" nix-mode-syntax-table)
|
(modify-syntax-entry ?# "< b" nix-mode-syntax-table)
|
||||||
(modify-syntax-entry ?\n "> b" nix-mode-syntax-table)
|
(modify-syntax-entry ?\n "> b" nix-mode-syntax-table)))
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(defun nix-indent-line ()
|
(defun nix-indent-line ()
|
||||||
|
@ -111,3 +114,5 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||||
(setq auto-mode-alist (cons '("\\.nix.in\\'" . nix-mode) auto-mode-alist))
|
(setq auto-mode-alist (cons '("\\.nix.in\\'" . nix-mode) auto-mode-alist))
|
||||||
|
|
||||||
(provide 'nix-mode)
|
(provide 'nix-mode)
|
||||||
|
|
||||||
|
;;; nix-mode.el ends here
|
||||||
|
|
Loading…
Reference in a new issue