lang/php: fix stringp error & phpctags path

Also provide a way to silence phpctags warnings on starting
php-mode (set ac-php-ctags-executable to nil).
This commit is contained in:
Henrik Lissner 2018-08-01 18:15:11 +02:00
parent 06aa16bbfb
commit 8bbff852f7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 14 additions and 11 deletions

View file

@ -18,7 +18,9 @@ ignore the cache."
(defun +php|init-ac-php-core-eldoc () (defun +php|init-ac-php-core-eldoc ()
"Initialize eldoc support for `php-mode' with `ac-php-core'. Fails gracefully "Initialize eldoc support for `php-mode' with `ac-php-core'. Fails gracefully
if phpctags isn't installed." if phpctags isn't installed."
(require 'company-php) (require 'ac-php-core)
(if (file-exists-p ac-php-ctags-executable) (cond ((not ac-php-ctags-executable))
(ac-php-core-eldoc-setup) ((not (file-exists-p ac-php-ctags-executable))
(message "phpctags is missing; eldoc support is disabled"))) (message "Could not find phpctags executable, eldoc support is disabled")
(message "To disable these warnings, set ac-php-ctags-executable to nil"))
((ac-php-core-eldoc-setup))))

View file

@ -73,14 +73,15 @@
:init :init
(add-to-list '+php--company-backends 'company-ac-php-backend nil #'eq) (add-to-list '+php--company-backends 'company-ac-php-backend nil #'eq)
(add-hook 'php-mode-hook #'+php|init-ac-php-core-eldoc) (add-hook 'php-mode-hook #'+php|init-ac-php-core-eldoc)
:config
(setq ac-php-tags-path (concat doom-cache-dir "ac-php/")) (setq ac-php-tags-path (concat doom-cache-dir "ac-php/"))
;; prioritize phpctags in PATH ;; loaded by `company-php'
(when (file-in-directory-p ac-php-ctags-executable ac-php-root-directory) (after! ac-php-core
(setq ac-php-ctags-executable (when (equal ac-php-ctags-executable
(or (executable-find "phpctags") (concat ac-php-root-directory "phpctags"))
(if (file-exists-p ac-php-ctags-executable) ;; prioritize phpctags in PATH
ac-php-ctags-executable))))) (setq ac-php-ctags-executable
(or (executable-find "phpctags")
ac-php-ctags-executable)))))
;; ;;