From aa6722130316cd9460a5276bd07486887411799a Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Fri, 20 Dec 2019 12:02:17 +0100 Subject: Upgrade all modes --- .emacs.d/lisp/php-project.el | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to '.emacs.d/lisp/php-project.el') diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el index eb9a50e..18115cc 100644 --- a/.emacs.d/lisp/php-project.el +++ b/.emacs.d/lisp/php-project.el @@ -5,8 +5,8 @@ ;; Author: USAMI Kenta ;; Keywords: tools, files ;; URL: https://github.com/emacs-php/php-mode -;; Version: 1.21.4 -;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) +;; Version: 1.22.1 +;; Package-Requires: ((emacs "24.3")) ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify @@ -72,6 +72,19 @@ ;; Constants (defconst php-project-composer-autoloader "vendor/autoload.php") +;; Custom variables +(defgroup php-project nil + "Major mode for editing PHP code." + :tag "PHP Project" + :prefix "php-project-" + :group 'php) + +(defcustom php-project-auto-detect-etags-file nil + "If `T', automatically detect etags file when file is opened." + :tag "PHP Project Auto Detect Etags File" + :group 'php-project + :type 'boolean) + ;; Variables (defvar php-project-available-root-files '((projectile ".projectile") @@ -104,6 +117,12 @@ STRING (put 'php-project-root 'safe-local-variable #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))) + (defvar-local php-project-etags-file nil) + (put 'php-project-etags-file 'safe-local-variable + #'(lambda (v) (or (functionp v) + (eq v t) + (php-project--eval-bootstrap-scripts v)))) + (defvar-local php-project-bootstrap-scripts nil "List of path to bootstrap php script file. @@ -172,7 +191,6 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") (put 'php-project-server-start 'safe-local-variable #'(lambda (v) (or (functionp v) (php-project--eval-bootstrap-scripts v))))) - ;; Functions (defun php-project--validate-php-file-as-template (val) @@ -229,6 +247,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") (t (prog1 nil (warn "php-project-php-file-as-template is unexpected format"))))) +(defun php-project-apply-local-variables () + "Apply php-project variables to local variables." + (when (null tags-file-name) + (when (or (and php-project-auto-detect-etags-file + (null php-project-etags-file)) + (eq php-project-etags-file t)) + (let ((tags-file (expand-file-name "TAGS" (php-project-get-root-dir)))) + (when (file-exists-p tags-file) + (setq-local php-project-etags-file tags-file)))) + (when php-project-etags-file + (setq-local tags-file-name (php-project--eval-bootstrap-scripts php-project-etags-file))))) ;;;###autoload (defun php-project-get-bootstrap-scripts () "Return list of bootstrap script." -- cgit v1.3