@@ -342,6 +342,12 @@ In that case set to `NIL'."
342342 :tag " PHP Mode Disable C Mode Hook"
343343 :type 'boolean )
344344
345+ (defcustom php-mode-enable-project-local-variable t
346+ " When set to `T' , apply project local variable to buffer local variable."
347+ :group 'php-mode
348+ :tag " PHP Mode Enable Project Local Variable"
349+ :type 'boolean )
350+
345351(defun php-mode-version ()
346352 " Display string describing the version of PHP Mode."
347353 (interactive )
@@ -1116,6 +1122,11 @@ After setting the stylevars run hooks according to STYLENAME
11161122 (php-set-style (symbol-name coding-style)))
11171123 (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay )))))
11181124
1125+ (defun php-mode-set-local-variable-delay ()
1126+ " Set local variable from php-project."
1127+ (php-project-apply-local-variables)
1128+ (remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay ))
1129+
11191130(defvar php-mode-syntax-table
11201131 (let ((table (make-syntax-table )))
11211132 (c-populate-syntax-table table)
@@ -1169,6 +1180,9 @@ After setting the stylevars run hooks according to STYLENAME
11691180 ; ; PHP vars are case-sensitive
11701181 (setq case-fold-search t )
11711182
1183+ (when php-mode-enable-project-local-variable
1184+ (add-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay t t ))
1185+
11721186 ; ; When php-mode-enable-project-coding-style is set, it is delayed by hook.
11731187 ; ; Since it depends on the timing at which the file local variable is set.
11741188 ; ; File local variables are set after initialization of major mode except `run-hook' is complete.
0 commit comments