emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode 23bdbdf21f 124/500: Add custom mmm-mode


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 23bdbdf21f 124/500: Add custom mmm-mode
Date: Sat, 29 Jan 2022 08:26:48 -0500 (EST)

branch: elpa/nix-mode
commit 23bdbdf21fa17c31204d063bec2edd6270c9fca8
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    Add custom mmm-mode
---
 nix-mode.el |  2 ++
 nix-sh.el   | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/nix-mode.el b/nix-mode.el
index c6f3b81db2..4a3bc0bd94 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -399,6 +399,8 @@
 
 (when (require 'company nil 'noerror) (require 'nix-company nil 'noerror))
 
+(when (require 'mmm-mode nil 'noerror) (require 'nix-sh nil 'noerror))
+
 ;;;###autoload
 (define-derived-mode nix-mode prog-mode "Nix"
   "Major mode for editing Nix expressions.
diff --git a/nix-sh.el b/nix-sh.el
new file mode 100644
index 0000000000..6953290b18
--- /dev/null
+++ b/nix-sh.el
@@ -0,0 +1,27 @@
+(require 'mmm-auto)
+
+(defun nix-sh-extra-phases (name)
+  (list (concat name "Phase") (concat "pre" (capitalize name))
+        (concat "post" (capitalize name))))
+
+(let* ((nix-sh-all-phases
+        (apply #'append
+               (mapcar 'nix-sh-extra-phases
+                       '("unpack" "patch" "configure" "build"
+                         "check" "install" "fixup"
+                         "dist"))))
+       (nix-sh-start-regexp
+        (concat (mmm-regexp-opt nix-sh-all-phases t) " = ''")))
+  (mmm-add-group 'nix-sh
+                 '((sh-command
+                    :submode sh-mode
+                    :face mmm-code-submode-face
+                    :front "buildPhase = ''"
+                    :back "''"
+                    )))
+  )
+
+(mmm-add-mode-ext-class 'nix-mode "\\.nix\\'" 'nix-sh)
+
+(provide 'nix-sh)
+;;; nix-mode-mmm.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]