From 215dde5b809bff44e23f46c763018f312d368d1b Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sat, 12 May 2018 22:14:20 +0900 Subject: [PATCH] Modify defvar-local and setq-local Thease functions are added in Emacs 24.3. --- php-mode.el | 43 +++++++++++++++++++------------------------ php-project.el | 17 ++++++----------- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/php-mode.el b/php-mode.el index 22d8702d..6b9e2ee6 100644 --- a/php-mode.el +++ b/php-mode.el @@ -9,7 +9,7 @@ ;; URL: https://github.com/ejmr/php-mode ;; Keywords: languages php ;; Version: 1.19.1 -;; Package-Requires: ((emacs "24") (cl-lib "0.5")) +;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) ;; License: GPL-3.0-or-later (defconst php-mode-version-number "1.19.1" @@ -1107,8 +1107,7 @@ this ^ lineup" (define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0") -(defvar php-mode--delayed-set-style nil) -(make-variable-buffer-local 'php-mode--delayed-set-style) +(defvar-local php-mode--delayed-set-style nil) (defun php-set-style (stylename &optional dont-override) "Set the current `php-mode' buffer to use the style STYLENAME. @@ -1240,13 +1239,13 @@ After setting the stylevars run hooks according to STYLENAME (c-init-language-vars php-mode) (c-common-init 'php-mode) - (set (make-local-variable 'font-lock-string-face) 'php-string) - (set (make-local-variable 'font-lock-keyword-face) 'php-keyword) - (set (make-local-variable 'font-lock-builtin-face) 'php-builtin) - (set (make-local-variable 'c-preprocessor-face-name) 'php-php-tag) - (set (make-local-variable 'font-lock-function-name-face) 'php-function-name) - (set (make-local-variable 'font-lock-variable-name-face) 'php-variable-name) - (set (make-local-variable 'font-lock-constant-face) 'php-constant) + (setq-local font-lock-string-face 'php-string) + (setq-local font-lock-keyword-face 'php-keyword) + (setq-local font-lock-builtin-face 'php-builtin) + (setq-local c-preprocessor-face-name 'php-php-tag) + (setq-local font-lock-function-name-face 'php-function-name) + (setq-local font-lock-variable-name-face 'php-variable-name) + (setq-local font-lock-constant-face 'php-constant) (modify-syntax-entry ?_ "_" php-mode-syntax-table) (modify-syntax-entry ?` "\"" php-mode-syntax-table) @@ -1255,7 +1254,7 @@ After setting the stylevars run hooks according to STYLENAME (modify-syntax-entry ?\n "> b" php-mode-syntax-table) (modify-syntax-entry ?$ "'" php-mode-syntax-table) - (set (make-local-variable 'syntax-propertize-function) #'php-syntax-propertize-function) + (setq-local syntax-propertize-function #'php-syntax-propertize-function) (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) #'php-syntax-propertize-extend-region) @@ -1289,8 +1288,7 @@ After setting the stylevars run hooks according to STYLENAME ;; syntax-begin-function is obsolete in Emacs 25.1 (with-no-warnings - (set (make-local-variable 'syntax-begin-function) - 'c-beginning-of-syntax)) + (setq-local syntax-begin-function 'c-beginning-of-syntax)) ;; We map the php-{beginning,end}-of-defun functions so that they ;; replace the similar commands that we inherit from CC Mode. @@ -1298,17 +1296,14 @@ After setting the stylevars run hooks according to STYLENAME ;; following two local variables, but we keep them for now until we ;; are completely sure their removal will not break any current ;; behavior or backwards compatibility. - (set (make-local-variable 'beginning-of-defun-function) - 'php-beginning-of-defun) - (set (make-local-variable 'end-of-defun-function) - 'php-end-of-defun) - - (set (make-local-variable 'open-paren-in-column-0-is-defun-start) - nil) - (set (make-local-variable 'defun-prompt-regexp) - "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") - (set (make-local-variable 'add-log-current-defun-header-regexp) - php-beginning-of-defun-regexp) + (setq-local beginning-of-defun-function 'php-beginning-of-defun) + (setq-local end-of-defun-function 'php-end-of-defun) + + (setq-local open-paren-in-column-0-is-defun-start nil) + (setq-local defun-prompt-regexp + "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") + (setq-local add-log-current-defun-header-regexp + php-beginning-of-defun-regexp) (when (>= emacs-major-version 25) (with-silent-modifications diff --git a/php-project.el b/php-project.el index 8474ddec..53275b97 100644 --- a/php-project.el +++ b/php-project.el @@ -6,7 +6,7 @@ ;; Keywords: tools, files ;; URL: https://github.com/ejmr/php-mode ;; Version: 1.19.1 -;; Package-Requires: ((emacs "24") (cl-lib "0.5")) +;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify @@ -88,7 +88,7 @@ ;;;###autoload (progn - (defvar php-project-root 'auto + (defvar-local php-project-root 'auto "Method of searching for the top level directory. `auto' (default) @@ -101,42 +101,37 @@ STRING A file/directory name of top level marker. If the string is an actual directory path, it is set as the absolute path of the root directory, not the marker.") - (make-variable-buffer-local 'php-project-root) (put 'php-project-root 'safe-local-variable #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files))))) ;;;###autoload (progn - (defvar php-project-bootstrap-scripts nil + (defvar-local php-project-bootstrap-scripts nil "List of path to bootstrap php script file. The ideal bootstrap file is silent, it only includes dependent files, defines constants, and sets the class loaders.") - (make-variable-buffer-local 'php-project-bootstrap-scripts) (put 'php-project-bootstrap-scripts 'safe-local-variable #'php-project--eval-bootstrap-scripts)) ;;;###autoload (progn - (defvar php-project-php-executable nil + (defvar-local php-project-php-executable nil "Path to php executable file.") - (make-variable-buffer-local 'php-project-php-executable) (put 'php-project-php-executable 'safe-local-variable #'(lambda (v) (and (stringp v) (file-executable-p v))))) ;;;###autoload (progn - (defvar php-project-phan-executable nil + (defvar-local php-project-phan-executable nil "Path to phan executable file.") - (make-variable-buffer-local 'php-project-phan-executable) (put 'php-project-phan-executable 'safe-local-variable #'php-project--eval-bootstrap-scripts)) ;;;###autoload (progn - (defvar php-project-coding-style nil + (defvar-local php-project-coding-style nil "Symbol value of the coding style of the project that PHP major mode refers to. Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") - (make-variable-buffer-local 'php-project-coding-style) (put 'php-project-coding-style 'safe-local-variable #'symbolp))