doomemacs/modules/lang/nim/config.el
Henrik Lissner ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00

39 lines
1.3 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; lang/nim/config.el -*- lexical-binding: t; -*-
(use-package! nim-mode
:defer t
:init
(add-hook! 'nim-mode-hook
(defun +nim-init-nimsuggest-mode-h ()
"Conditionally load `nimsuggest-mode', instead of clumsily erroring out if
nimsuggest isn't installed."
(unless (stringp nimsuggest-path)
(setq nimsuggest-path (executable-find "nimsuggest")))
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
(nimsuggest-mode))))
(when IS-WINDOWS
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
(defadvice! +nim--suggest-get-temp-file-name-a (path)
"Removes invalid characters from the temp file path, including the unicode
character that colon is replaced with, which is known to cause issues on
windows."
:filter-return #'nimsuggest--get-temp-file-name
(replace-regexp-in-string "[* |<>\"?*]" "" path)))
:config
(set-lookup-handlers! '(nim-mode nimsuggest-mode)
:definition #'+nimsuggest-find-definition
:documentation #'nimsuggest-show-doc)
(map! :localleader
:map nim-mode-map
"b" #'nim-compile
"h" #'nimsuggest-show-doc
"d" #'nimsuggest-find-definition))
(use-package! flycheck-nim
:when (modulep! :checkers syntax)
:after nim-mode)