Load Custom Files

This commit is contained in:
2025-09-11 17:04:41 -04:00
parent 4313ddd4e8
commit f18bcfd3aa
4 changed files with 191 additions and 2 deletions

79
lisp/nmodl.el Normal file
View File

@@ -0,0 +1,79 @@
(defvar nmodl-mode-hook nil)
(defvar wpdl-mode-map
(let ((map (make-keymap)))
; (define-key map "\C-j" 'newline-and-indent)
map)
"Keymap for NMODL major mode")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.mod\\'" . nmodl-mode))
(setq nmodl-keywords
'(
"NEURON"
"UNITS"
"PARAMETER"
"ASSIGNED"
"STATE"
"INITIAL"
"BREAKPOINT"
"DERIVATIVE"
"PROCEDURE"
))
(setq nmodl-neuron-keywords
'(
"TITLE"
"SUFFIX"
"POINT_PROCESS"
"RANGE"
"GLOBAL"
"POINTER"
"BBCOREPOINTER"
"USEION"
"NONSPECIFIC_CURRENT"
"SOLVE"
"METHOD"
))
(defvar nmodl-font-lock-keywords
`(
,(regexp-opt nmodl-keywords t) . 'font-lock-keyword-face
)
"Minimal highlighting expressions for NMODL mode")
(setq nmodl-font-lock-keywords
`(
(,(regexp-opt nmodl-keywords t) . 'font-lock-keyword-face)
(,(regexp-opt nmodl-neuron-keywords t) . 'font-lock-constant-face)
("^[[:space:]]*\\([[:alpha:]][[:alnum:]_]*\\)" . 'font-lock-variable-name-face)
))
(setq nmodl-syntax-rules
(syntax-propertize-rules
("TITLE\\([^\n]\\)[^\n]*\\(\n\\)" (1 "|") (2 "|"))
("\\<\\(COMMENT\\)\\>" (1 "<"))
("\\<ENDCOMMEN\\(T\\)\\>" (1 ">"))
("^[^:\n]*\\(:\\)[^\n]*\\(\n\\)" (1 "!") (2 "!"))
("\\({\\)" (1 "("))
("\\(}\\)" (1 ")"))
))
(defun nmodl-indent ()
(indent-relative-first-indent-point)
)
(defun nmodl-mode ()
"Major mode for editing Workflow Process Description Language files"
(interactive)
(kill-all-local-variables)
(setq-local font-lock-defaults '(nmodl-font-lock-keywords))
(setq-local syntax-propertize-function nmodl-syntax-rules)
(setq-local c-syntactic-indentation t)
(setq-local indent-line-function 'nmodl-indent)
;; (use-local-map wpdl-mode-map)
(setq major-mode 'nmodl-mode)
(setq mode-name "NMODL")
(run-hooks 'nmodl-mode-hook))