aboutsummaryrefslogtreecommitdiffstats
path: root/oni-php
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-03-16 14:52:04 -0700
committerGravatar Tom Willemse2026-03-16 14:52:04 -0700
commit3736b8d1549c93f7f3b774174bf40225c49181a8 (patch)
tree0486fdb96f69a057bd82631921fa09937afd4df0 /oni-php
parenta6fa67d43b78646b28a874d64ddea164e67adc56 (diff)
downloademacs-config-3736b8d1549c93f7f3b774174bf40225c49181a8.tar.gz
emacs-config-3736b8d1549c93f7f3b774174bf40225c49181a8.zip
oni-php: Switch out ‘php-mode’ for ‘php-ts-mode’
Diffstat (limited to 'oni-php')
-rw-r--r--oni-php/oni-php.el77
-rw-r--r--oni-php/snippets/php-ts-mode/.yas-parents1
2 files changed, 40 insertions, 38 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el
index f910d23..e4d9693 100644
--- a/oni-php/oni-php.el
+++ b/oni-php/oni-php.el
@@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2026.0306.123604
-;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers)
+;; Version: 2026.0316.124639
+;; Package-Requires: (oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -30,7 +30,8 @@
(require 'align)
(require 'company)
(require 'hydra)
-(require 'php-mode)
+(require 'php-ts-mode)
+(require 'project)
(require 'whitespace)
(require 'yasnippet)
@@ -129,45 +130,45 @@ Do the insert N times."
(indent-region start (point))
(goto-char insert-marker))))
-(defun oni-php-comment-dwim (func &rest args)
- "See if a PHP documentation comment should be added and add it.
-Otherwise call FUNC with ARGS. This is meant as advice around
-‘comment-dwim’ to make it smarter for PHP code."
- (if (and (derived-mode-p 'php-mode)
- (not (region-active-p))
- (looking-back (rx (minimal-match (zero-or-more blank))) (line-beginning-position))
- (looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
- (or (regexp php-beginning-of-defun-regexp)
- (regexp php--re-classlike-pattern)))))
- (oni-php-doc-comment)
- (apply func args)))
+;; (defun oni-php-comment-dwim (func &rest args)
+;; "See if a PHP documentation comment should be added and add it.
+;; Otherwise call FUNC with ARGS. This is meant as advice around
+;; ‘comment-dwim’ to make it smarter for PHP code."
+;; (if (and (derived-mode-p 'php-mode)
+;; (not (region-active-p))
+;; (looking-back (rx (minimal-match (zero-or-more blank))) (line-beginning-position))
+;; (looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
+;; (or (regexp php-beginning-of-defun-regexp)
+;; (regexp php--re-classlike-pattern)))))
+;; (oni-php-doc-comment)
+;; (apply func args)))
(defhydra php-mode-hydra (:color blue)
("a" align-current "Align current selection"))
-(advice-add 'comment-dwim :around #'oni-php-comment-dwim)
+;; (advice-add 'comment-dwim :around #'oni-php-comment-dwim)
-(add-hook 'php-mode-hook #'oni-php--set-require-final-newline)
-(add-hook 'php-mode-hook #'oni-php--whitespace-mode)
-(add-hook 'php-mode-hook 'company-mode)
-(add-hook 'php-mode-hook 'display-fill-column-indicator-mode)
-(add-hook 'php-mode-hook 'electric-indent-local-mode)
-(add-hook 'php-mode-hook 'fic-mode)
-(add-hook 'php-mode-hook 'flycheck-mode)
-(add-hook 'php-mode-hook 'ggtags-mode)
-(add-hook 'php-mode-hook 'oni-php--auto-fill-mode)
-(add-hook 'php-mode-hook 'oni-php-set-rainbow-identifier-faces)
-(add-hook 'php-mode-hook 'rainbow-delimiters-mode)
-(add-hook 'php-mode-hook 'rainbow-identifiers-mode)
-(add-hook 'php-mode-hook 'smartparens-mode)
-(add-hook 'php-mode-hook 'subword-mode)
-(add-hook 'php-mode-hook 'yas-minor-mode)
+(add-hook 'php-ts-mode-hook #'oni-php--set-require-final-newline)
+(add-hook 'php-ts-mode-hook #'oni-php--whitespace-mode)
+(add-hook 'php-ts-mode-hook 'company-mode)
+(add-hook 'php-ts-mode-hook 'display-fill-column-indicator-mode)
+(add-hook 'php-ts-mode-hook 'electric-indent-local-mode)
+(add-hook 'php-ts-mode-hook 'fic-mode)
+(add-hook 'php-ts-mode-hook 'flycheck-mode)
+(add-hook 'php-ts-mode-hook 'ggtags-mode)
+(add-hook 'php-ts-mode-hook 'oni-php--auto-fill-mode)
+(add-hook 'php-ts-mode-hook 'oni-php-set-rainbow-identifier-faces)
+(add-hook 'php-ts-mode-hook 'rainbow-delimiters-mode)
+(add-hook 'php-ts-mode-hook 'rainbow-identifiers-mode)
+(add-hook 'php-ts-mode-hook 'smartparens-mode)
+(add-hook 'php-ts-mode-hook 'subword-mode)
+(add-hook 'php-ts-mode-hook 'yas-minor-mode)
(with-eval-after-load 'company
(add-to-list 'company-backends 'company-ac-php-backend))
-(define-key php-mode-map (kbd "C-c m") #'php-mode-hydra/body)
-(define-key php-mode-map (kbd ".") #'oni-php-insert-dot-dwim)
+(define-key php-ts-mode-map (kbd "C-c m") #'php-mode-hydra/body)
+(define-key php-ts-mode-map (kbd ".") #'oni-php-insert-dot-dwim)
;; In PHP code it's nice to have any ~=>~ aligned.
@@ -182,7 +183,7 @@ Otherwise call FUNC with ARGS. This is meant as advice around
`(php-array-arrow
(regexp . ,(rx any (group (zero-or-more whitespace)) "=>" any))
(group . (1))
- (modes . '(php-mode web-mode))
+ (modes . '(php-mode web-mode php-ts-mode))
(repeat . t)))
;; The WordPress coding standards specify that multiple assignments
@@ -198,18 +199,18 @@ Otherwise call FUNC with ARGS. This is meant as advice around
(regexp . ,(rx any (group (zero-or-more whitespace)) "="
(zero-or-more whitespace) any))
(group . (1))
- (modes . '(php-mode web-mode))
+ (modes . '(php-mode web-mode php-ts-mode))
(repeat . t)))
-(with-eval-after-load 'php-mode
+(with-eval-after-load 'php-ts-mode
(with-eval-after-load 'yasnippet
(oni-php-snippets-initialize)))
;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode))
+(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-ts-mode))
;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode))
+(add-to-list 'auto-mode-alist '("\\.module\\'" . php-ts-mode))
;;;###autoload
(with-eval-after-load 'grep
diff --git a/oni-php/snippets/php-ts-mode/.yas-parents b/oni-php/snippets/php-ts-mode/.yas-parents
new file mode 100644
index 0000000..00d75e1
--- /dev/null
+++ b/oni-php/snippets/php-ts-mode/.yas-parents
@@ -0,0 +1 @@
+php-mode \ No newline at end of file