diff options
Diffstat (limited to '.emacs.d/lisp/php-mode.el')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 38f1a1b..6b9e2ee 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -8,14 +8,14 @@ | |||
| 8 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> | 8 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> |
| 9 | ;; URL: https://github.com/ejmr/php-mode | 9 | ;; URL: https://github.com/ejmr/php-mode |
| 10 | ;; Keywords: languages php | 10 | ;; Keywords: languages php |
| 11 | ;; Version: 1.19.0 | 11 | ;; Version: 1.19.1 |
| 12 | ;; Package-Requires: ((emacs "24") (cl-lib "0.5")) | 12 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) |
| 13 | ;; License: GPL-3.0-or-later | 13 | ;; License: GPL-3.0-or-later |
| 14 | 14 | ||
| 15 | (defconst php-mode-version-number "1.19.0" | 15 | (defconst php-mode-version-number "1.19.1" |
| 16 | "PHP Mode version number.") | 16 | "PHP Mode version number.") |
| 17 | 17 | ||
| 18 | (defconst php-mode-modified "2018-04-08" | 18 | (defconst php-mode-modified "2018-05-12" |
| 19 | "PHP Mode build date.") | 19 | "PHP Mode build date.") |
| 20 | 20 | ||
| 21 | ;; This file is free software; you can redistribute it and/or | 21 | ;; This file is free software; you can redistribute it and/or |
| @@ -182,7 +182,7 @@ Turning this on will open it whenever `php-mode' is loaded." | |||
| 182 | "Apply the list of extra constant keywords `VALUE'. | 182 | "Apply the list of extra constant keywords `VALUE'. |
| 183 | 183 | ||
| 184 | This function is called when the custom variable php-extra-constants | 184 | This function is called when the custom variable php-extra-constants |
| 185 | is updated. The web-mode-extra-constants list is appended to the list | 185 | is updated. The web-mode-extra-constants list is appended to the list |
| 186 | of constants when set." | 186 | of constants when set." |
| 187 | ;; remove old keywords | 187 | ;; remove old keywords |
| 188 | (when (boundp 'php-extra-constants) | 188 | (when (boundp 'php-extra-constants) |
| @@ -350,7 +350,7 @@ Turning this on will force PEAR rules on all PHP files." | |||
| 350 | 350 | ||
| 351 | (defcustom php-mode-warn-if-mumamo-off t | 351 | (defcustom php-mode-warn-if-mumamo-off t |
| 352 | "Warn once per buffer if you try to indent a buffer without | 352 | "Warn once per buffer if you try to indent a buffer without |
| 353 | mumamo-mode turned on. Detects if there are any HTML tags in the | 353 | mumamo-mode turned on. Detects if there are any HTML tags in the |
| 354 | buffer before warning, but this is is not very smart; e.g. if you | 354 | buffer before warning, but this is is not very smart; e.g. if you |
| 355 | have any tags inside a PHP string, it will be fooled." | 355 | have any tags inside a PHP string, it will be fooled." |
| 356 | :type '(choice (const :tag "Warn" t) (const "Don't warn" nil))) | 356 | :type '(choice (const :tag "Warn" t) (const "Don't warn" nil))) |
| @@ -1107,8 +1107,7 @@ this ^ lineup" | |||
| 1107 | 1107 | ||
| 1108 | (define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0") | 1108 | (define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0") |
| 1109 | 1109 | ||
| 1110 | (defvar php-mode--delayed-set-style nil) | 1110 | (defvar-local php-mode--delayed-set-style nil) |
| 1111 | (make-variable-buffer-local 'php-mode--delayed-set-style) | ||
| 1112 | 1111 | ||
| 1113 | (defun php-set-style (stylename &optional dont-override) | 1112 | (defun php-set-style (stylename &optional dont-override) |
| 1114 | "Set the current `php-mode' buffer to use the style STYLENAME. | 1113 | "Set the current `php-mode' buffer to use the style STYLENAME. |
| @@ -1188,6 +1187,7 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1188 | "Display informations useful for debugging PHP Mode." | 1187 | "Display informations useful for debugging PHP Mode." |
| 1189 | (interactive) | 1188 | (interactive) |
| 1190 | (require 'cus-edit) | 1189 | (require 'cus-edit) |
| 1190 | (require 'pkg-info nil t) | ||
| 1191 | (php-mode-debug--buffer 'init) | 1191 | (php-mode-debug--buffer 'init) |
| 1192 | (php-mode-debug--message "Feel free to report on GitHub what you noticed!") | 1192 | (php-mode-debug--message "Feel free to report on GitHub what you noticed!") |
| 1193 | (php-mode-debug--message "https://github.com/ejmr/php-mode/issues/new") | 1193 | (php-mode-debug--message "https://github.com/ejmr/php-mode/issues/new") |
| @@ -1197,10 +1197,13 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1197 | (php-mode-debug--message "--- PHP-MODE DEBUG BEGIN ---") | 1197 | (php-mode-debug--message "--- PHP-MODE DEBUG BEGIN ---") |
| 1198 | (php-mode-debug--message "versions: %s; %s" (emacs-version) (php-mode-version)) | 1198 | (php-mode-debug--message "versions: %s; %s" (emacs-version) (php-mode-version)) |
| 1199 | (php-mode-debug--message "package-version: %s" | 1199 | (php-mode-debug--message "package-version: %s" |
| 1200 | (let ((pkg (and (boundp 'package-alist) | 1200 | (if (fboundp 'pkg-info) |
| 1201 | (cadr (assq 'php-mode package-alist))))) | 1201 | (pkg-info-version-info 'php-mode) |
| 1202 | (when (and pkg (member (package-desc-status pkg) '("unsigned" "dependency"))) | 1202 | (let ((pkg (and (boundp 'package-alist) |
| 1203 | (package-version-join (package-desc-version pkg))))) | 1203 | (cadr (assq 'php-mode package-alist))))) |
| 1204 | (when (and pkg (member (package-desc-status pkg) '("unsigned" "dependency"))) | ||
| 1205 | (package-version-join (package-desc-version pkg)))))) | ||
| 1206 | |||
| 1204 | (php-mode-debug--message "major-mode: %s" major-mode) | 1207 | (php-mode-debug--message "major-mode: %s" major-mode) |
| 1205 | (php-mode-debug--message "minor-modes: %s" | 1208 | (php-mode-debug--message "minor-modes: %s" |
| 1206 | (cl-loop for s in minor-mode-list | 1209 | (cl-loop for s in minor-mode-list |
| @@ -1236,13 +1239,13 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1236 | (c-init-language-vars php-mode) | 1239 | (c-init-language-vars php-mode) |
| 1237 | (c-common-init 'php-mode) | 1240 | (c-common-init 'php-mode) |
| 1238 | 1241 | ||
| 1239 | (set (make-local-variable 'font-lock-string-face) 'php-string) | 1242 | (setq-local font-lock-string-face 'php-string) |
| 1240 | (set (make-local-variable 'font-lock-keyword-face) 'php-keyword) | 1243 | (setq-local font-lock-keyword-face 'php-keyword) |
| 1241 | (set (make-local-variable 'font-lock-builtin-face) 'php-builtin) | 1244 | (setq-local font-lock-builtin-face 'php-builtin) |
| 1242 | (set (make-local-variable 'c-preprocessor-face-name) 'php-php-tag) | 1245 | (setq-local c-preprocessor-face-name 'php-php-tag) |
| 1243 | (set (make-local-variable 'font-lock-function-name-face) 'php-function-name) | 1246 | (setq-local font-lock-function-name-face 'php-function-name) |
| 1244 | (set (make-local-variable 'font-lock-variable-name-face) 'php-variable-name) | 1247 | (setq-local font-lock-variable-name-face 'php-variable-name) |
| 1245 | (set (make-local-variable 'font-lock-constant-face) 'php-constant) | 1248 | (setq-local font-lock-constant-face 'php-constant) |
| 1246 | 1249 | ||
| 1247 | (modify-syntax-entry ?_ "_" php-mode-syntax-table) | 1250 | (modify-syntax-entry ?_ "_" php-mode-syntax-table) |
| 1248 | (modify-syntax-entry ?` "\"" php-mode-syntax-table) | 1251 | (modify-syntax-entry ?` "\"" php-mode-syntax-table) |
| @@ -1251,7 +1254,7 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1251 | (modify-syntax-entry ?\n "> b" php-mode-syntax-table) | 1254 | (modify-syntax-entry ?\n "> b" php-mode-syntax-table) |
| 1252 | (modify-syntax-entry ?$ "'" php-mode-syntax-table) | 1255 | (modify-syntax-entry ?$ "'" php-mode-syntax-table) |
| 1253 | 1256 | ||
| 1254 | (set (make-local-variable 'syntax-propertize-function) #'php-syntax-propertize-function) | 1257 | (setq-local syntax-propertize-function #'php-syntax-propertize-function) |
| 1255 | (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) | 1258 | (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) |
| 1256 | #'php-syntax-propertize-extend-region) | 1259 | #'php-syntax-propertize-extend-region) |
| 1257 | 1260 | ||
| @@ -1285,8 +1288,7 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1285 | 1288 | ||
| 1286 | ;; syntax-begin-function is obsolete in Emacs 25.1 | 1289 | ;; syntax-begin-function is obsolete in Emacs 25.1 |
| 1287 | (with-no-warnings | 1290 | (with-no-warnings |
| 1288 | (set (make-local-variable 'syntax-begin-function) | 1291 | (setq-local syntax-begin-function 'c-beginning-of-syntax)) |
| 1289 | 'c-beginning-of-syntax)) | ||
| 1290 | 1292 | ||
| 1291 | ;; We map the php-{beginning,end}-of-defun functions so that they | 1293 | ;; We map the php-{beginning,end}-of-defun functions so that they |
| 1292 | ;; replace the similar commands that we inherit from CC Mode. | 1294 | ;; replace the similar commands that we inherit from CC Mode. |
| @@ -1294,17 +1296,14 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1294 | ;; following two local variables, but we keep them for now until we | 1296 | ;; following two local variables, but we keep them for now until we |
| 1295 | ;; are completely sure their removal will not break any current | 1297 | ;; are completely sure their removal will not break any current |
| 1296 | ;; behavior or backwards compatibility. | 1298 | ;; behavior or backwards compatibility. |
| 1297 | (set (make-local-variable 'beginning-of-defun-function) | 1299 | (setq-local beginning-of-defun-function 'php-beginning-of-defun) |
| 1298 | 'php-beginning-of-defun) | 1300 | (setq-local end-of-defun-function 'php-end-of-defun) |
| 1299 | (set (make-local-variable 'end-of-defun-function) | ||
| 1300 | 'php-end-of-defun) | ||
| 1301 | 1301 | ||
| 1302 | (set (make-local-variable 'open-paren-in-column-0-is-defun-start) | 1302 | (setq-local open-paren-in-column-0-is-defun-start nil) |
| 1303 | nil) | 1303 | (setq-local defun-prompt-regexp |
| 1304 | (set (make-local-variable 'defun-prompt-regexp) | 1304 | "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") |
| 1305 | "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") | 1305 | (setq-local add-log-current-defun-header-regexp |
| 1306 | (set (make-local-variable 'add-log-current-defun-header-regexp) | 1306 | php-beginning-of-defun-regexp) |
| 1307 | php-beginning-of-defun-regexp) | ||
| 1308 | 1307 | ||
| 1309 | (when (>= emacs-major-version 25) | 1308 | (when (>= emacs-major-version 25) |
| 1310 | (with-silent-modifications | 1309 | (with-silent-modifications |
| @@ -1700,7 +1699,7 @@ a completion list." | |||
| 1700 | 1699 | ||
| 1701 | ;; Highlight return types in functions and methods. | 1700 | ;; Highlight return types in functions and methods. |
| 1702 | ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) | 1701 | ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) |
| 1703 | (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\{" 1 font-lock-type-face) | 1702 | (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) |
| 1704 | 1703 | ||
| 1705 | ;; Highlight class names used as nullable type hints | 1704 | ;; Highlight class names used as nullable type hints |
| 1706 | ("\\?\\(\\(:?\\sw\\|\\s_\\)+\\)\\s-+\\$" 1 font-lock-type-face) | 1705 | ("\\?\\(\\(:?\\sw\\|\\s_\\)+\\)\\s-+\\$" 1 font-lock-type-face) |
