diff --git a/core/core-modules.el b/core/core-modules.el index 00e2a9550..e54a256ad 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -25,6 +25,7 @@ MODULES). E.g. A warning will be put out if these deprecated modules are used.") (defvar doom--current-module nil) +(defvar doom--current-flags nil) ;; @@ -286,10 +287,12 @@ to least)." (message "Warning: couldn't find the %s %s module" category module) (let ((key (cons category module))) (doom-module-set category module :flags flags :path path) - (push `(let ((doom--current-module ',key)) + (push `(let ((doom--current-module ',key) + (doom--current-flags ',flags)) (load! "init" ,path t)) init-forms) - (push `(let ((doom--current-module ',key)) + (push `(let ((doom--current-module ',key) + (doom--current-flags ',flags)) (load! "config" ,path t)) config-forms)))))))))) `(let (file-name-handler-alist) @@ -366,18 +369,15 @@ Module FLAGs are set in your config's `doom!' block, typically in When this macro is used from inside a module, MODULE and SUBMODULE can be omitted. eg. (featurep! +flag1)" - (unless submodule - (let ((module-pair - (or doom--current-module - (doom-module-from-path (FILE!))))) - (unless module-pair - (error "featurep! couldn't detect what module its in! (in %s)" path)) - (setq flag module - module (car module-pair) - submodule (cdr module-pair)))) - (if flag - (and (memq flag (doom-module-get module submodule :flags)) t) - (doom-module-p module submodule))) + (and (cond (submodule (doom-module-p module submodule)) + (doom--current-flags (memq module doom--current-flags)) + ((let ((module-pair + (or doom--current-module + (doom-module-from-path (FILE!))))) + (unless module-pair + (error "featurep! couldn't detect what module its in! (in %s)" (FILE!))) + (memq module (doom-module-get (car module-pair) (cdr module-pair) :flags))))) + t)) ;; diff --git a/modules/lang/php/config.el b/modules/lang/php/config.el index 22d5788c9..eeb9867e4 100644 --- a/modules/lang/php/config.el +++ b/modules/lang/php/config.el @@ -2,12 +2,6 @@ (defvar +php--company-backends nil) -;; (def-package! hack-mode -;; :mode "\\.hh$" -;; :config -;; (set-company-backend! 'hack-mode '(company-capf))) - - (def-package! php-mode :mode "\\.inc\\'" :interpreter "php" @@ -44,6 +38,11 @@ :n "s" #'phpunit-current-test))) +(def-package! hack-mode + :when (featurep! +hack) + :mode "\\.hh$") + + (def-package! php-refactor-mode :hook php-mode) diff --git a/modules/lang/php/packages.el b/modules/lang/php/packages.el index 5db18500f..553413d80 100644 --- a/modules/lang/php/packages.el +++ b/modules/lang/php/packages.el @@ -10,7 +10,6 @@ (when (featurep! :completion company) (package! company-php)) -;; (package! hack-mode -;; :recipe -;; (:fetcher url :url "https://raw.githubusercontent.com/facebook/hhvm/master/hphp/hack/editor-plugins/emacs/hack-mode.el")) +(when (featurep! +hack) + (package! hack-mode :recipe (:fetcher github :repo "hhvm/hack-mode")))