Skip to content

Commit 1269029

Browse files
authored
Merge pull request #573 from emacs-php/feature/php-set-style-display-only-php-inherited-styles
Make php-set-style display only styles that inherited "php"
2 parents e17dbe1 + 2de6e81 commit 1269029

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

php-mode.el

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,14 @@ this ^ lineup"
10091009
(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands"
10101010
(cons "PHP" (c-lang-const c-mode-menu php)))
10111011

1012+
(defun php-mode-get-style-alist ()
1013+
"Return an alist consisting of `php' style and styles that inherit it."
1014+
(cl-loop for l in c-style-alist
1015+
if (or (string= (car l) "php")
1016+
(equal (cadr l) "php"))
1017+
collect l))
1018+
1019+
(defvar php-mode-set-style-history nil)
10121020
(defvar-local php-mode--delayed-set-style nil)
10131021
(defvar-local php-style-delete-trailing-whitespace nil)
10141022

@@ -1027,7 +1035,15 @@ After setting the stylevars run hooks according to STYLENAME
10271035
\"wordpress\" `php-mode-wordpress-hook'
10281036
\"symfony2\" `php-mode-symfony2-hook'
10291037
\"psr2\" `php-mode-psr2-hook'"
1030-
(interactive)
1038+
(interactive
1039+
(list (let ((completion-ignore-case t)
1040+
(prompt (format "Which %s indentation style? "
1041+
mode-name)))
1042+
(completing-read prompt
1043+
(php-mode-get-style-alist)
1044+
nil t nil
1045+
'php-mode-set-style-history
1046+
c-indentation-style))))
10311047
(php-mode--disable-delay-set-style)
10321048

10331049
;; Back up manually set variables
@@ -1051,7 +1067,6 @@ After setting the stylevars run hooks according to STYLENAME
10511067
((equal stylename "wordpress") (run-hooks 'php-mode-wordpress-hook))
10521068
((equal stylename "symfony2") (run-hooks 'php-mode-symfony2-hook))
10531069
((equal stylename "psr2") (run-hooks 'php-mode-psr2-hook))))
1054-
(put 'php-set-style 'interactive-form (interactive-form 'c-set-style))
10551070

10561071
(defun php-mode--disable-delay-set-style (&rest args)
10571072
"Disable php-mode-set-style-delay on after hook. `ARGS' be ignore."

0 commit comments

Comments
 (0)