diff --git a/init.example.el b/init.example.el index dd96126fd..b0887dcb5 100644 --- a/init.example.el +++ b/init.example.el @@ -84,6 +84,7 @@ ledger ; an accounting system in Emacs lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore + nim ; python + lisp at the speed of c nix ; I hereby declare "nix geht mehr!" ocaml ; an objective camel (org ; organize your plain life in plain text diff --git a/modules/completion/ivy/doctor.el b/modules/completion/ivy/doctor.el index 21300e86d..d730f1552 100644 --- a/modules/completion/ivy/doctor.el +++ b/modules/completion/ivy/doctor.el @@ -1,4 +1,5 @@ -;;; completion/ivy/doctor.el -*- lexical-binding: t; -*- +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; completion/ivy/doctor.el (when (and (not EMACS26+) (featurep! +childframe)) (error! "The +childframe feature requires Emacs 26+")) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 4b5b04bcd..fd25c0a7b 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -129,7 +129,6 @@ compilation database is present in the project.") (def-package! irony - :after cc-mode :commands (irony-install-server irony-mode) :preface (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/")) @@ -145,7 +144,6 @@ compilation database is present in the project.") (add-hook 'irony-mode-hook #'+cc|irony-init-compile-options)) (def-package! irony-eldoc - :after irony :hook (irony-mode . irony-eldoc)) (def-package! flycheck-irony diff --git a/modules/lang/nim/README.org b/modules/lang/nim/README.org new file mode 100644 index 000000000..bd12a1fc3 --- /dev/null +++ b/modules/lang/nim/README.org @@ -0,0 +1,47 @@ +#+TITLE: :lang Nim + +#+begin_quote +This module is a work in progress. +#+end_quote + +This module adds [[https://nim-lang.org][Nim]] support to Emacs. + ++ Code completion (nimsuggest + company) ++ Syntax checking (nimsuggest + flycheck) ++ Babel support (~ob-nim~) + +* Table of Contents :TOC: +- [[Module Flags][Module Flags]] +- [[Prerequisites][Prerequisites]] + - [[Nim][Nim]] +- [[Configuration][Configuration]] + +* Module Flags +This module provides no flags. + +* Prerequisites ++ ~nim~ (for building & evaluation) ++ ~nimsuggest~ (for code completion, syntax checking & jump-to-definition functionality) + +** Nim +=choosenim= is an installer and version manager for the Nim programming +language. You can install the latest stable release of Nim by running the +following in your terminal and following the onscreen instructions: + +#+BEGIN_SRC bash +curl https://nim-lang.org/choosenim/init.sh -sSf | sh +#+END_SRC + +Alternatively, nim is usually available through your OS's package manager: + +*** MacOS +#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes") +brew install nim +#+END_SRC + +*** Arch Linux +#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes") +sudo pacman --needed --noconfirm -S nim nimble +#+END_SRC + +* Configuration diff --git a/modules/lang/nim/config.el b/modules/lang/nim/config.el new file mode 100644 index 000000000..4beffb199 --- /dev/null +++ b/modules/lang/nim/config.el @@ -0,0 +1,32 @@ +;;; lang/nim/config.el -*- lexical-binding: t; -*- + +(def-package! nim-mode + :mode "\\.nim\\'" + :mode ("\\.nim\\(ble\\|s\\)\\'" . nimscript-mode) + :config + (load "nim-mode-autoloads" nil t) + ;; NOTE nim-mode autoloads sets up xref + + (defun +nim|init-nimsuggest-mode () + "Conditionally load `nimsuggest-mode', instead of clumsily erroring out if +nimsuggest isn't installed." + (when (executable-find "nimsuggest") + (nimsuggest-mode))) + (add-hook 'nim-mode-hook #'+nim|init-nimsuggest-mode) + + (map! :map nim-mode-map + :localleader + :n "b" #'+nim/build-menu) + + (def-menu! +nim/build-menu + "Building commands for `nim-mode' buffers." + '(("Build & run" :exec nim-compile)) + :prompt "Build")) + + +(def-package! flycheck-nim + :when (featurep! :feature syntax-checker) + :after nim-mode + :config + (add-hook 'nimsuggest-mode-hook #'flycheck-mode)) + diff --git a/modules/lang/nim/doctor.el b/modules/lang/nim/doctor.el new file mode 100644 index 000000000..788238c98 --- /dev/null +++ b/modules/lang/nim/doctor.el @@ -0,0 +1,9 @@ +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; lang/nim/doctor.el + +(unless (executable-find "nimsuggest") + (warn! "Could not find nimsuggest executable; code-completion, syntax checking and jump-to-definition functionality will be disabled.")) + +(unless (executable-find "nim") + (warn! "Could not find nim executable; build commands will be disabled.")) + diff --git a/modules/lang/nim/packages.el b/modules/lang/nim/packages.el new file mode 100644 index 000000000..f8453e807 --- /dev/null +++ b/modules/lang/nim/packages.el @@ -0,0 +1,9 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/nim/packages.el + +;;; requires nim nimsuggest nimble + +(package! nim-mode) + +(when (featurep! :feature syntax-checker) + (package! flycheck-nim)) diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index dc3c1cb20..91c73748e 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -18,6 +18,8 @@ (package! ob-sql-mode) (package! ob-translate) + (when (featurep! :lang nim) + (package! ob-nim)) (when (featurep! :lang crystal) (package! ob-crystal)) (when (featurep! :lang go)