lang/php: add +hack support

This commit is contained in:
Henrik Lissner 2018-07-29 02:46:18 +02:00
parent 6cfbeaa4f6
commit db8ed4aac6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 21 additions and 23 deletions

View file

@ -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
(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)" 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)))
(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))
;;

View file

@ -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)

View file

@ -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")))