diff options
| author | 2025-01-22 12:19:44 -0800 | |
|---|---|---|
| committer | 2025-01-22 12:19:44 -0800 | |
| commit | 097630b001e620119855f587800ab9e7dd590e2b (patch) | |
| tree | 7292261436f712c2bf2384b5613d6c561af5a998 | |
| parent | ecef5d97d93e589f6893cbd822ae32283e356efd (diff) | |
| download | emacs-config-097630b001e620119855f587800ab9e7dd590e2b.tar.gz emacs-config-097630b001e620119855f587800ab9e7dd590e2b.zip | |
oni-php: Add support to add first use statement
| -rw-r--r-- | oni-php/oni-php.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index bd1df6c..986cb35 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: 2024.1230.141448 +;; Version: 2025.0122.121804 ;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra ggtags fic-mode company-php) ;; This program is free software; you can redistribute it and/or modify @@ -83,8 +83,13 @@ nil for some reason." (t (car classes))))) (save-excursion (goto-char (point-min)) - (search-forward "use ") - (forward-paragraph) + + (if (search-forward "use " nil t) + (forward-paragraph) + (search-forward "namespace ") + (forward-line) + (insert "\n")) + (let ((start (point))) (insert "use " class ";\n") (pulse-momentary-highlight-region start (point)))))) |
