Fix project mode definitions
This commit is contained in:
parent
22e3baf184
commit
3ac1d382be
10 changed files with 113 additions and 93 deletions
14
modules/lang/php/autoload.el
Normal file
14
modules/lang/php/autoload.el
Normal file
|
@ -0,0 +1,14 @@
|
|||
;;; lang/php/autoload.el
|
||||
|
||||
(defvar +php-composer-conf (make-hash-table :test 'equal))
|
||||
|
||||
;;;###autoload
|
||||
(defun +php-composer-conf (&optional project-root refresh-p)
|
||||
"Retrieve the contents of composer.json as an alist. If REFRESH-P is non-nil
|
||||
ignore the cache."
|
||||
(let ((project-root (or project-root (doom-project-root))))
|
||||
(or (and (not refresh-p) (gethash project-root +php-composer-conf))
|
||||
(let ((package-file (expand-file-name "composer.json" project-root)))
|
||||
(when-let (data (and (file-exists-p package-file)
|
||||
(json-read-file package-file)))
|
||||
(puthash project-root data +php-composer-conf))))))
|
Loading…
Add table
Add a link
Reference in a new issue