summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/lisp/php-mode.el53
-rw-r--r--.emacs.d/lisp/php-project.el29
-rw-r--r--.emacs.d/lisp/yaml-mode.el8
3 files changed, 52 insertions, 38 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
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el
index c36c81f..d478d9e 100644
--- a/.emacs.d/lisp/php-project.el
+++ b/.emacs.d/lisp/php-project.el
@@ -95,10 +95,15 @@
95 Try to search file in order of `php-project-available-root-files'. 95 Try to search file in order of `php-project-available-root-files'.
96 96
97SYMBOL 97SYMBOL
98 Key of `php-project-available-root-files'.") 98 Key of `php-project-available-root-files'.
99
100STRING
101 A file/directory name of top level marker.
102 If the string is an actual directory path, it is set as the absolute path
103 of the root directory, not the marker.")
99 (make-variable-buffer-local 'php-project-root) 104 (make-variable-buffer-local 'php-project-root)
100 (put 'php-project-root 'safe-local-variable 105 (put 'php-project-root 'safe-local-variable
101 #'(lambda (v) (assq v php-project-available-root-files)))) 106 #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))))
102 107
103;;;###autoload 108;;;###autoload
104(progn 109(progn
@@ -177,15 +182,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
177;;;###autoload 182;;;###autoload
178(defun php-project-get-root-dir () 183(defun php-project-get-root-dir ()
179 "Return path to current PHP project." 184 "Return path to current PHP project."
180 (let ((detect-method 185 (if (and (stringp php-project-root) (file-directory-p php-project-root))
181 (cond 186 php-project-root
182 ((stringp php-project-root) (list php-project-root)) 187 (let ((detect-method
183 ((eq php-project-root 'auto) 188 (cond
184 (cl-loop for m in php-project-available-root-files 189 ((stringp php-project-root) (list php-project-root))
185 append (cdr m))) 190 ((eq php-project-root 'auto)
186 (t (cdr-safe (assq php-project-root php-project-available-root-files)))))) 191 (cl-loop for m in php-project-available-root-files
187 (cl-loop for m in detect-method 192 append (cdr m)))
188 thereis (locate-dominating-file default-directory m)))) 193 (t (cdr-safe (assq php-project-root php-project-available-root-files))))))
194 (cl-loop for m in detect-method
195 thereis (locate-dominating-file default-directory m)))))
189 196
190(provide 'php-project) 197(provide 'php-project)
191;;; php-project.el ends here 198;;; php-project.el ends here
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el
index c3416dd..9f76c38 100644
--- a/.emacs.d/lisp/yaml-mode.el
+++ b/.emacs.d/lisp/yaml-mode.el
@@ -438,13 +438,15 @@ otherwise do nothing."
438 438
439(defun yaml-fill-paragraph (&optional justify region) 439(defun yaml-fill-paragraph (&optional justify region)
440 "Fill paragraph. 440 "Fill paragraph.
441This behaves as `fill-paragraph' except that filling does not 441Outside of comments, this behaves as `fill-paragraph' except that
442cross boundaries of block literals." 442filling does not cross boundaries of block literals. Inside comments,
443this will do usual adaptive fill behaviors."
443 (interactive "*P") 444 (interactive "*P")
444 (save-restriction 445 (save-restriction
445 (yaml-narrow-to-block-literal) 446 (yaml-narrow-to-block-literal)
446 (let ((fill-paragraph-function nil)) 447 (let ((fill-paragraph-function nil))
447 (fill-paragraph justify region)))) 448 (or (fill-comment-paragraph justify)
449 (fill-paragraph justify region)))))
448 450
449(defun yaml-set-imenu-generic-expression () 451(defun yaml-set-imenu-generic-expression ()
450 (make-local-variable 'imenu-generic-expression) 452 (make-local-variable 'imenu-generic-expression)