Emacs php-mode and paredit

I would like to use paredit in combination with php mode, but it does not add the closing curly braces "}". Perhaps this is due to the fact that the electric bracket is attached to "{"? And how can I rewrite this?

Thanks.

+4
source share
3 answers

Using paredit is a php mode, it is a bad idea - it is mainly suitable for editing Lisp code. There is a very nice alternative for general development, although autopilot mode . It is very easy to use and inserts brackets, brackets and quotation marks in the same way as in most IDEs.

+2
source

Some time ago I wrote such a thing for C, but you can also easily use it for PHP:

(define-minor-mode c-helpers-minor-mode "This mode contains little helpers for C developement" nil "" '(((kbd "{") . insert-c-block-parentheses)) ) (defun insert-c-block-parentheses () (interactive) (insert "{") (newline) (newline) (insert "}") (indent-for-tab-command) (previous-line) (indent-for-tab-command) ) (add-hook 'php-mode-hook 'c-helpers-minor-mode) 
+2
source

In my experience, autopair-mode felt extremely sluggish when a large number of buffers were open (plus, paredit-mode ensures that delimiters will never be unbalanced, unlike autopair-mode ). So, if, like me, you absolutely want to use paredit-mode , and there is nothing more to be done, see this answer . In the elisp snippet there, simply replace slime-repl-mode-map and slime-repl-mode-hook with the appropriate variables for php (most likely php-mode-map and php-mode-hook )

+1
source

Source: https://habr.com/ru/post/1343626/


All Articles