Skip to content

Commit e9f37e2

Browse files
Add modulefiles-mode for Emacs users
It is based on tcl-mode and add colorization for Modules commands
1 parent a5c83b0 commit e9f37e2

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

share/emacs/modulefiles-mode.el

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
;;; modulefiles-mode.el --- Major mode for Modules modulefiles editing -*- lexical-binding: t; -*-
2+
3+
;; Author: Laurent Besson <[email protected]>
4+
;; Maintainer: Laurent Besson <[email protected]>
5+
;; Created: June 12, 2025
6+
;; Version: 1.0
7+
;; Package-Requires: ((emacs "24")
8+
;; Keywords: Modules, modulefiles
9+
;; URL: https://modules.readthedocs.io/en/latest/index.html
10+
11+
;; This file is not part of GNU Emacs.
12+
13+
;; This program is free software; you can redistribute it and/or modify
14+
;; it under the terms of the GNU General Public License as published by
15+
;; the Free Software Foundation, either version 3 of the License, or
16+
;; (at your option) any later version.
17+
18+
;; This program is distributed in the hope that it will be useful,
19+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
;; GNU General Public License for more details.
22+
23+
;; You should have received a copy of the GNU General Public License
24+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
26+
;; Comments:
27+
28+
;; modulefiles-mode is a major mode for highlighting modufiles syntax
29+
;; it derives from tcl-mode as modulefiles is based on this language
30+
;; It adds colorizing for main modulefiles commands
31+
32+
;; Installation
33+
;; Copy this file into your Emacs package search directory
34+
;; and add the folliwing lines to your .emacs startup file:
35+
;;
36+
;; (add-to-list 'magic-mode-alist '("#%Module" . modulefiles-mode))
37+
;; (autoload 'modulefiles-mode "modulefiles-mode"
38+
;; "Major mode for editing Modulefiles files" t)
39+
40+
;; Modulefiles mode definition:
41+
42+
(define-derived-mode modulefiles-mode tcl-mode "Modulefiles"
43+
"Major mode for highlighting Modulefiles file type."
44+
(font-lock-add-keywords 'modulefiles-mode
45+
'(
46+
("\\<\\(add-property\\|always-load\\|append-path\\|complete\\|conflict\\|depends-on\\|family\\|getenv\\|getvariant\\|hide-modulefile\\|hide-version\\|is-avail\\|is-loaded\\|is-saved\\|is-used\\|lsb-release\\|module-whatis\\|module-alias\\|module-forbid\\|module-help\\|module-hide\\|module-info\\|module-tag\\|module-version\\|module-virtual\\|module-warn\\|modulepath-label\\|module\\|prepend-path\\|prereq-all\\|prereq-any\\|pushenv\\|prereq\\|remove-path\\reportError\\|reportWarning\\|require-fullname\\|set-alias\\|set-function\\|setenv\\|source-sh\\|uncomplete\\|unset-alias\\|uncomplete\\|unset-alias\\|unset-function\\|unetenv\\|variant\\|versioncmp\\|x-resource\\)\\>" . font-lock-keyword-face)
47+
)
48+
)
49+
)
50+
51+
(provide 'modulefiles-mode)

0 commit comments

Comments
 (0)