mirror of
https://github.com/larstvei/dot-emacs.git
synced 2024-11-26 07:28:31 +00:00
use-package minizinc-mode
This commit is contained in:
parent
bf1adf019a
commit
33795cb203
21
init.org
21
init.org
@ -207,8 +207,7 @@
|
|||||||
|
|
||||||
(let* ((package--builtins nil)
|
(let* ((package--builtins nil)
|
||||||
(packages
|
(packages
|
||||||
'(minizinc-mode ; Major mode for MiniZinc code
|
'(multiple-cursors ; Multiple cursors for Emacs
|
||||||
multiple-cursors ; Multiple cursors for Emacs
|
|
||||||
nano-modeline ; N Λ N O modeline
|
nano-modeline ; N Λ N O modeline
|
||||||
nano-theme ; N Λ N O theme
|
nano-theme ; N Λ N O theme
|
||||||
nix-mode ; Major mode for editing .nix files
|
nix-mode ; Major mode for editing .nix files
|
||||||
@ -1587,17 +1586,27 @@
|
|||||||
|
|
||||||
** Minizinc
|
** Minizinc
|
||||||
|
|
||||||
|
Provide a default =compile-command=.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.mzn\\'" . minizinc-mode))
|
(defun minizinc-setup-compile-command ()
|
||||||
|
|
||||||
(defun minizinc-setup ()
|
|
||||||
(let ((command (concat "minizinc " (buffer-file-name) " "))
|
(let ((command (concat "minizinc " (buffer-file-name) " "))
|
||||||
(f (concat (file-name-base (buffer-file-name)) ".dzn")))
|
(f (concat (file-name-base (buffer-file-name)) ".dzn")))
|
||||||
(local-set-key (kbd "C-c C-c") 'recompile)
|
(local-set-key (kbd "C-c C-c") 'recompile)
|
||||||
(setq-local compile-command (concat command (if (file-exists-p f) f "")))))
|
(setq-local compile-command (concat command (if (file-exists-p f) f "")))))
|
||||||
|
|
||||||
(add-hook 'minizinc-mode-hook 'minizinc-setup)
|
#+end_src
|
||||||
|
|
||||||
|
Use =minizinc-mode=, and hook up the =minizinc-setup-compile-command= above.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
;; Major mode for MiniZinc code
|
||||||
|
(use-package minizinc-mode
|
||||||
|
:defer t
|
||||||
|
:mode "\\.mzn\\'"
|
||||||
|
:hook (minizinc-mode . minizinc-setup-compile-command))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user