aboutsummaryrefslogtreecommitdiffstats
path: root/oni-php
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-04-01 11:22:02 -0700
committerGravatar Tom Willemse2026-04-01 11:29:50 -0700
commitd2f612b4b44d1767c4f7f7c01eb06ab148f74a7c (patch)
treede1127f78588a446ba789bd1e1dfc74446ddd03e /oni-php
parent2147f4045ad9bbd75cef1014bb27a699c2af9f54 (diff)
downloademacs-config-d2f612b4b44d1767c4f7f7c01eb06ab148f74a7c.tar.gz
emacs-config-d2f612b4b44d1767c4f7f7c01eb06ab148f74a7c.zip
oni-php: Bring back ‘oni-php-comment-dwim’
Diffstat (limited to 'oni-php')
-rw-r--r--oni-php/oni-php.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el
index f5ec1f3..36bf76f 100644
--- a/oni-php/oni-php.el
+++ b/oni-php/oni-php.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2026.0327.112457
+;; Version: 2026.0331.120917
;; 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
@@ -130,23 +130,23 @@ 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)