aboutsummaryrefslogtreecommitdiffstats
path: root/oni-php
diff options
context:
space:
mode:
Diffstat (limited to 'oni-php')
-rw-r--r--oni-php/oni-php.el29
1 files changed, 15 insertions, 14 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el
index 5964c34..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.111947
+;; 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
@@ -30,6 +30,7 @@
(require 'align)
(require 'company)
(require 'hydra)
+(require 'map)
(require 'project)
(require 'whitespace)
(require 'yasnippet)
@@ -129,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)