Skip to content

Commit 215dde5

Browse files
committed
Modify defvar-local and setq-local
Thease functions are added in Emacs 24.3.
1 parent 2e4c2a6 commit 215dde5

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

php-mode.el

+19-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
;; URL: https://github.com/ejmr/php-mode
1010
;; Keywords: languages php
1111
;; Version: 1.19.1
12-
;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
12+
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5"))
1313
;; License: GPL-3.0-or-later
1414

1515
(defconst php-mode-version-number "1.19.1"
@@ -1107,8 +1107,7 @@ this ^ lineup"
11071107

11081108
(define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0")
11091109

1110-
(defvar php-mode--delayed-set-style nil)
1111-
(make-variable-buffer-local 'php-mode--delayed-set-style)
1110+
(defvar-local php-mode--delayed-set-style nil)
11121111

11131112
(defun php-set-style (stylename &optional dont-override)
11141113
"Set the current `php-mode' buffer to use the style STYLENAME.
@@ -1240,13 +1239,13 @@ After setting the stylevars run hooks according to STYLENAME
12401239
(c-init-language-vars php-mode)
12411240
(c-common-init 'php-mode)
12421241

1243-
(set (make-local-variable 'font-lock-string-face) 'php-string)
1244-
(set (make-local-variable 'font-lock-keyword-face) 'php-keyword)
1245-
(set (make-local-variable 'font-lock-builtin-face) 'php-builtin)
1246-
(set (make-local-variable 'c-preprocessor-face-name) 'php-php-tag)
1247-
(set (make-local-variable 'font-lock-function-name-face) 'php-function-name)
1248-
(set (make-local-variable 'font-lock-variable-name-face) 'php-variable-name)
1249-
(set (make-local-variable 'font-lock-constant-face) 'php-constant)
1242+
(setq-local font-lock-string-face 'php-string)
1243+
(setq-local font-lock-keyword-face 'php-keyword)
1244+
(setq-local font-lock-builtin-face 'php-builtin)
1245+
(setq-local c-preprocessor-face-name 'php-php-tag)
1246+
(setq-local font-lock-function-name-face 'php-function-name)
1247+
(setq-local font-lock-variable-name-face 'php-variable-name)
1248+
(setq-local font-lock-constant-face 'php-constant)
12501249

12511250
(modify-syntax-entry ?_ "_" php-mode-syntax-table)
12521251
(modify-syntax-entry ?` "\"" php-mode-syntax-table)
@@ -1255,7 +1254,7 @@ After setting the stylevars run hooks according to STYLENAME
12551254
(modify-syntax-entry ?\n "> b" php-mode-syntax-table)
12561255
(modify-syntax-entry ?$ "'" php-mode-syntax-table)
12571256

1258-
(set (make-local-variable 'syntax-propertize-function) #'php-syntax-propertize-function)
1257+
(setq-local syntax-propertize-function #'php-syntax-propertize-function)
12591258
(add-to-list (make-local-variable 'syntax-propertize-extend-region-functions)
12601259
#'php-syntax-propertize-extend-region)
12611260

@@ -1289,26 +1288,22 @@ After setting the stylevars run hooks according to STYLENAME
12891288

12901289
;; syntax-begin-function is obsolete in Emacs 25.1
12911290
(with-no-warnings
1292-
(set (make-local-variable 'syntax-begin-function)
1293-
'c-beginning-of-syntax))
1291+
(setq-local syntax-begin-function 'c-beginning-of-syntax))
12941292

12951293
;; We map the php-{beginning,end}-of-defun functions so that they
12961294
;; replace the similar commands that we inherit from CC Mode.
12971295
;; Because of our remapping we may not actually need to keep the
12981296
;; following two local variables, but we keep them for now until we
12991297
;; are completely sure their removal will not break any current
13001298
;; behavior or backwards compatibility.
1301-
(set (make-local-variable 'beginning-of-defun-function)
1302-
'php-beginning-of-defun)
1303-
(set (make-local-variable 'end-of-defun-function)
1304-
'php-end-of-defun)
1305-
1306-
(set (make-local-variable 'open-paren-in-column-0-is-defun-start)
1307-
nil)
1308-
(set (make-local-variable 'defun-prompt-regexp)
1309-
"^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*")
1310-
(set (make-local-variable 'add-log-current-defun-header-regexp)
1311-
php-beginning-of-defun-regexp)
1299+
(setq-local beginning-of-defun-function 'php-beginning-of-defun)
1300+
(setq-local end-of-defun-function 'php-end-of-defun)
1301+
1302+
(setq-local open-paren-in-column-0-is-defun-start nil)
1303+
(setq-local defun-prompt-regexp
1304+
"^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*")
1305+
(setq-local add-log-current-defun-header-regexp
1306+
php-beginning-of-defun-regexp)
13121307

13131308
(when (>= emacs-major-version 25)
13141309
(with-silent-modifications

php-project.el

+6-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
;; Keywords: tools, files
77
;; URL: https://github.com/ejmr/php-mode
88
;; Version: 1.19.1
9-
;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
9+
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5"))
1010
;; License: GPL-3.0-or-later
1111

1212
;; This program is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@
8888

8989
;;;###autoload
9090
(progn
91-
(defvar php-project-root 'auto
91+
(defvar-local php-project-root 'auto
9292
"Method of searching for the top level directory.
9393
9494
`auto' (default)
@@ -101,42 +101,37 @@ STRING
101101
A file/directory name of top level marker.
102102
If the string is an actual directory path, it is set as the absolute path
103103
of the root directory, not the marker.")
104-
(make-variable-buffer-local 'php-project-root)
105104
(put 'php-project-root 'safe-local-variable
106105
#'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))))
107106

108107
;;;###autoload
109108
(progn
110-
(defvar php-project-bootstrap-scripts nil
109+
(defvar-local php-project-bootstrap-scripts nil
111110
"List of path to bootstrap php script file.
112111
113112
The ideal bootstrap file is silent, it only includes dependent files,
114113
defines constants, and sets the class loaders.")
115-
(make-variable-buffer-local 'php-project-bootstrap-scripts)
116114
(put 'php-project-bootstrap-scripts 'safe-local-variable #'php-project--eval-bootstrap-scripts))
117115

118116
;;;###autoload
119117
(progn
120-
(defvar php-project-php-executable nil
118+
(defvar-local php-project-php-executable nil
121119
"Path to php executable file.")
122-
(make-variable-buffer-local 'php-project-php-executable)
123120
(put 'php-project-php-executable 'safe-local-variable
124121
#'(lambda (v) (and (stringp v) (file-executable-p v)))))
125122

126123
;;;###autoload
127124
(progn
128-
(defvar php-project-phan-executable nil
125+
(defvar-local php-project-phan-executable nil
129126
"Path to phan executable file.")
130-
(make-variable-buffer-local 'php-project-phan-executable)
131127
(put 'php-project-phan-executable 'safe-local-variable #'php-project--eval-bootstrap-scripts))
132128

133129
;;;###autoload
134130
(progn
135-
(defvar php-project-coding-style nil
131+
(defvar-local php-project-coding-style nil
136132
"Symbol value of the coding style of the project that PHP major mode refers to.
137133
138134
Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
139-
(make-variable-buffer-local 'php-project-coding-style)
140135
(put 'php-project-coding-style 'safe-local-variable #'symbolp))
141136

142137

0 commit comments

Comments
 (0)