Add doom*project-root advice fn

This commit is contained in:
Henrik Lissner 2017-06-19 00:03:37 +02:00
parent 7d081c3154
commit a2ca21cc21
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 9 additions and 6 deletions

View file

@ -77,6 +77,11 @@ state are passed in.")
(let ((projectile-require-project-root strict-p)) (let ((projectile-require-project-root strict-p))
(ignore-errors (projectile-project-root)))) (ignore-errors (projectile-project-root))))
(defun doom*project-root (&rest _)
"An advice function used to replace project-root-detection functions in other
libraries."
(doom-project-root))
(defmacro doom-project-has! (files) (defmacro doom-project-has! (files)
"Checks if the project has the specified FILES, relative to the project root, "Checks if the project has the specified FILES, relative to the project root,
unless the path begins with ./ or ../, in which case it's relative to unless the path begins with ./ or ../, in which case it's relative to

View file

@ -87,9 +87,7 @@
:commands tern-mode :commands tern-mode
:init (add-hook 'js2-mode-hook #'tern-mode) :init (add-hook 'js2-mode-hook #'tern-mode)
:config :config
;; Fix project detection (advice-add #'tern-project-dir :override #'doom*project-root))
(defun +javascript*tern-project-dir (&rest _) (doom-project-root))
(advice-add #'tern-project-dir :override #'+javascript*tern-project-dir))
(def-package! company-tern (def-package! company-tern

View file

@ -27,8 +27,6 @@
(eldoc-mode +1))) (eldoc-mode +1)))
(add-hook! (typescript-mode web-mode) #'+typescript|tide-setup) (add-hook! (typescript-mode web-mode) #'+typescript|tide-setup)
(advice-add #'tide-project-root :override #'doom-project-root)
(map! :map typescript-mode-map (map! :map typescript-mode-map
:m "gd" #'tide-jump-to-definition :m "gd" #'tide-jump-to-definition
:localleader :localleader
@ -41,5 +39,7 @@
(set! :company-backend 'typescript-mode '(company-tide)) (set! :company-backend 'typescript-mode '(company-tide))
(setq tide-format-options (setq tide-format-options
'(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t
:placeOpenBraceOnNewLineForFunctions nil))) :placeOpenBraceOnNewLineForFunctions nil))
(advice-add #'tide-project-root :override #'doom*project-root))