diff options
| author | Simeon Simeonov | 2018-04-10 12:01:58 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2018-04-10 12:01:58 +0200 |
| commit | ea4b3cb0f2d507bf0bc31287418c3bf24349a480 (patch) | |
| tree | c4025ecef48dee4c38cc722914d487dbfdc2da88 /.emacs.d/lisp/php-mode.el | |
| parent | e148d19f5d03fef8523c0c6e79c880ce562cfddc (diff) | |
Upgrade php-mode and yaml-mode
Diffstat (limited to '.emacs.d/lisp/php-mode.el')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 40da74c..38f1a1b 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | (defconst php-mode-version-number "1.19.0" | 15 | (defconst php-mode-version-number "1.19.0" |
| 16 | "PHP Mode version number.") | 16 | "PHP Mode version number.") |
| 17 | 17 | ||
| 18 | (defconst php-mode-modified "2018-03-28" | 18 | (defconst php-mode-modified "2018-04-08" |
| 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 |
| @@ -84,7 +84,7 @@ | |||
| 84 | (require 'speedbar) | 84 | (require 'speedbar) |
| 85 | (require 'imenu) | 85 | (require 'imenu) |
| 86 | (require 'nadvice nil t) | 86 | (require 'nadvice nil t) |
| 87 | (require 'php-project nil t) | 87 | (require 'package) |
| 88 | 88 | ||
| 89 | (require 'cl-lib) | 89 | (require 'cl-lib) |
| 90 | (require 'mode-local) | 90 | (require 'mode-local) |
| @@ -486,6 +486,9 @@ In that case set to `NIL'." | |||
| 486 | (c-lang-defconst c-opt-cpp-prefix | 486 | (c-lang-defconst c-opt-cpp-prefix |
| 487 | php "\\s-*<\\?") | 487 | php "\\s-*<\\?") |
| 488 | 488 | ||
| 489 | (c-lang-defconst c-anchored-cpp-prefix | ||
| 490 | php "\\s-*\\(<\\?(=\\|\\sw+)\\)") | ||
| 491 | |||
| 489 | (c-lang-defconst c-identifier-ops | 492 | (c-lang-defconst c-identifier-ops |
| 490 | php '( | 493 | php '( |
| 491 | (left-assoc "\\" "::" "->") | 494 | (left-assoc "\\" "::" "->") |
| @@ -1179,6 +1182,8 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1179 | (declare (indent 1)) | 1182 | (declare (indent 1)) |
| 1180 | (php-mode-debug--buffer 'insert (apply #'format format-string args) "\n")) | 1183 | (php-mode-debug--buffer 'insert (apply #'format format-string args) "\n")) |
| 1181 | 1184 | ||
| 1185 | (declare-function custom-group-members "cus-edit" (symbol groups-only)) | ||
| 1186 | |||
| 1182 | (defun php-mode-debug () | 1187 | (defun php-mode-debug () |
| 1183 | "Display informations useful for debugging PHP Mode." | 1188 | "Display informations useful for debugging PHP Mode." |
| 1184 | (interactive) | 1189 | (interactive) |
| @@ -1264,7 +1269,8 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1264 | (setq php-mode--delayed-set-style t) | 1269 | (setq php-mode--delayed-set-style t) |
| 1265 | (when (fboundp 'advice-add) | 1270 | (when (fboundp 'advice-add) |
| 1266 | (advice-add #'c-set-style :after #'php-mode--disable-delay-set-style '(local)))) | 1271 | (advice-add #'c-set-style :after #'php-mode--disable-delay-set-style '(local)))) |
| 1267 | (php-set-style (symbol-name php-mode-coding-style))) | 1272 | (let ((php-mode-enable-backup-style-variables nil)) |
| 1273 | (php-set-style (symbol-name php-mode-coding-style)))) | ||
| 1268 | 1274 | ||
| 1269 | (when (or php-mode-force-pear | 1275 | (when (or php-mode-force-pear |
| 1270 | (and (stringp buffer-file-name) | 1276 | (and (stringp buffer-file-name) |
| @@ -1305,6 +1311,9 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1305 | (save-excursion | 1311 | (save-excursion |
| 1306 | (php-syntax-propertize-function (point-min) (point-max)))))) | 1312 | (php-syntax-propertize-function (point-min) (point-max)))))) |
| 1307 | 1313 | ||
| 1314 | |||
| 1315 | (declare-function semantic-create-imenu-index "semantic/imenu" (&optional stream)) | ||
| 1316 | |||
| 1308 | (defvar-mode-local php-mode imenu-create-index-function | 1317 | (defvar-mode-local php-mode imenu-create-index-function |
| 1309 | (if php-do-not-use-semantic-imenu | 1318 | (if php-do-not-use-semantic-imenu |
| 1310 | #'imenu-default-create-index-function | 1319 | #'imenu-default-create-index-function |
| @@ -1342,11 +1351,12 @@ for \\[find-tag] (which see)." | |||
| 1342 | (delete-region beg (point)) | 1351 | (delete-region beg (point)) |
| 1343 | (insert completion)) | 1352 | (insert completion)) |
| 1344 | (t | 1353 | (t |
| 1345 | (message "Making completion list...") | 1354 | (let ((selected (completing-read |
| 1346 | (with-output-to-temp-buffer "*Completions*" | 1355 | "Select completion: " |
| 1347 | (display-completion-list | 1356 | (all-completions pattern php-functions) |
| 1348 | (all-completions pattern php-functions))) | 1357 | nil t pattern))) |
| 1349 | (message "Making completion list...%s" "done"))))))) | 1358 | (delete-region beg (point)) |
| 1359 | (insert selected)))))))) | ||
| 1350 | 1360 | ||
| 1351 | (defun php-completion-table () | 1361 | (defun php-completion-table () |
| 1352 | "Build variable `php-completion-table' on demand. | 1362 | "Build variable `php-completion-table' on demand. |
| @@ -1363,7 +1373,8 @@ current `tags-file-name'." | |||
| 1363 | (cond ((and (not (string= "" php-completion-file)) | 1373 | (cond ((and (not (string= "" php-completion-file)) |
| 1364 | (file-readable-p php-completion-file)) | 1374 | (file-readable-p php-completion-file)) |
| 1365 | (php-build-table-from-file php-completion-file)) | 1375 | (php-build-table-from-file php-completion-file)) |
| 1366 | (php-manual-path | 1376 | ((and (not (string= "" php-manual-path)) |
| 1377 | (file-directory-p php-manual-path)) | ||
| 1367 | (php-build-table-from-path php-manual-path)) | 1378 | (php-build-table-from-path php-manual-path)) |
| 1368 | (t nil)))) | 1379 | (t nil)))) |
| 1369 | (unless (or php-table tags-table) | 1380 | (unless (or php-table tags-table) |
| @@ -1372,8 +1383,10 @@ current `tags-file-name'." | |||
| 1372 | "`php-completion-file' or `php-manual-path' set"))) | 1383 | "`php-completion-file' or `php-manual-path' set"))) |
| 1373 | (when tags-table | 1384 | (when tags-table |
| 1374 | ;; Combine the tables. | 1385 | ;; Combine the tables. |
| 1375 | (mapatoms (lambda (sym) (intern (symbol-name sym) php-table)) | 1386 | (if (obarrayp tags-table) |
| 1376 | tags-table)) | 1387 | (mapatoms (lambda (sym) (intern (symbol-name sym) php-table)) |
| 1388 | tags-table) | ||
| 1389 | (setq php-table (append tags-table php-table)))) | ||
| 1377 | (setq php-completion-table php-table)))) | 1390 | (setq php-completion-table php-table)))) |
| 1378 | 1391 | ||
| 1379 | (defun php-build-table-from-file (filename) | 1392 | (defun php-build-table-from-file (filename) |
| @@ -1390,19 +1403,11 @@ current `tags-file-name'." | |||
| 1390 | table)) | 1403 | table)) |
| 1391 | 1404 | ||
| 1392 | (defun php-build-table-from-path (path) | 1405 | (defun php-build-table-from-path (path) |
| 1393 | (let ((table (make-vector 1022 0)) | 1406 | "Return list of PHP function name from `PATH' directory." |
| 1394 | (files (directory-files | 1407 | (cl-loop for file in (directory-files path nil "^function\\..+\\.html$") |
| 1395 | path | 1408 | if (string-match "\\.\\([-a-zA-Z_0-9]+\\)\\.html$" file) |
| 1396 | nil | 1409 | collect (replace-regexp-in-string |
| 1397 | "^function\\..+\\.html$"))) | 1410 | "-" "_" (substring file (match-beginning 1) (match-end 1)) t))) |
| 1398 | (mapc (lambda (file) | ||
| 1399 | (string-match "\\.\\([-a-zA-Z_0-9]+\\)\\.html$" file) | ||
| 1400 | (intern | ||
| 1401 | (replace-regexp-in-string | ||
| 1402 | "-" "_" (substring file (match-beginning 1) (match-end 1)) t) | ||
| 1403 | table)) | ||
| 1404 | files) | ||
| 1405 | table)) | ||
| 1406 | 1411 | ||
| 1407 | ;; Find the pattern we want to complete | 1412 | ;; Find the pattern we want to complete |
| 1408 | ;; find-tag-default from GNU Emacs etags.el | 1413 | ;; find-tag-default from GNU Emacs etags.el |
