Questions tagged [php-mode]
17 questions
29
votes
2 answers
Making php-mode (and other cc-mode derived modes) compatible with Emacs 23
I am using Emacs 23 and php-mode.el 1.5.0. When I have this in my .emacs:
(require 'php-mode)
I get this error message when Emacs starts:
Warning (initialization): An error occurred while loading `/Users/kdj/.emacs':
error: `c-lang-defconst' must…

Kristopher Johnson
- 81,409
- 55
- 245
- 302
6
votes
3 answers
Let's share our emacs php configs
I'm pretty new to emacs and I think it would be nice if you share your config that you use in your everyday php work.

zerkms
- 249,484
- 69
- 436
- 539
4
votes
3 answers
Emacs php-mode and paredit
I would like to use paredit in combination with php-mode, but it doesn't add a closing curly bracket "}". Might this have something todo with the fact that an electric brace is bound to "{"? And how could I overwrite this?
Thanks.

Beatlevic
- 605
- 1
- 6
- 13
3
votes
2 answers
how do I get hs-minor-mode to load automatically on php-mode in emacs?
For my favorite modes, I use the following snippet to load hs-minor-mode on startup:
(add-hook '____-mode-hook 'hs-minor-mode)
So far it's gotten working on css-mode, perl-mode, sh-mode (bash), and lisp-mode. But for some reason it won't load for…

user572491
- 43
- 3
3
votes
3 answers
how to fix php-mode indenting when using closures
I use php-mode in Emacs, it work fine execept when I use closures as argument like this:
$app->get('/', function() use ($app) {
echo "foo";
});
It seams that when function is inside function invocation the indentation is doubled. How to…

jcubic
- 61,973
- 54
- 229
- 402
2
votes
1 answer
Double indent when using Emacs php-mode
My problem is that with curly brackets in new lines, I am getting and additional indent, as shown in the code listed below.
I am using emacs 22.2 on debian-lenny, I have instaled php-mode.el from github…

Paul Salber
- 700
- 6
- 12
2
votes
1 answer
Emacs yet another snippet extension php-mode
I'm new to using emacs, and I am currently having some trouble with the 'yet another snippet' extension.
I am trying to do some work using the php-mode major mode. Unfortunately, it is based on the cc-mode, which means the snippet extension is…

Justin Wood
- 9,941
- 2
- 33
- 46
2
votes
1 answer
How do I change indent in php-mode to 2 spaces in Emacs?
I try to change indent from 4 spaces to 2 spaces (I need to write code with this style).
I try to evaluate this in the buffer with php code:
(setq tab-width 2)
or
(setq-default tab-width 2)
but it didn't work, when I type TAB I got 4 spaces.

jcubic
- 61,973
- 54
- 229
- 402
2
votes
1 answer
Emacs23 php-mode problem
I keep getting this error and similar errors while using php-mode on Emacs23 on Ubuntu:
Debugger entered--Lisp error: (void-function php-template-if-hook)
php-template-if-hook()
abbrev-insert(if #("if" 0 2 (fontified t face…

partoa
- 900
- 13
- 22
1
vote
2 answers
How to compose region like ""
I want fold php block in php template file.
to >>>>
{{PHP}}
{{PHP}}
First, I try to use font-lock-add-keywords, it…
lot
- 335
- 3
- 9
1
vote
1 answer
How to toggle off c-electric-flag and c-syntactic-indentation only when editing ".html.php" files in Emacs?
I need to unset the c-electric-flag and c-syntactic-indentation flags in Emacs23.4 when I open php files which name ends with .html.php, and only for that "name-pattern", because I use php-mode within html-mode and those flags indent the php code…

tonix
- 6,671
- 13
- 75
- 136
1
vote
1 answer
php-mode suddenly indents differently
After upgrading to EMACS 24.3 (I think from 24.2) and also upgrading the MELPA php-mode package to version 20130920.1850, php-mode now indents as follows:
array('a' => 1,
'b' => 2);
What it did previously:
array('a' => 1,
'b' => 2);
How do I…

feklee
- 7,555
- 9
- 54
- 72
1
vote
1 answer
How to configure emacs to properly comment code in php-mode?
I have emacs 23.3.1, running on windows.
php-mode 1.5 from http://php-mode.sourceforge.net/,
Modified: 2008-11-04
I think this used to work, but now, when I try to comment out a block of code, using
comment-region, which is an…

Cheeso
- 189,189
- 101
- 473
- 713
0
votes
1 answer
Emacs php-mode font-lock properties are not applied to certain chars
For example variable dollar signs.
php-mode.el line 1087:
'("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-variable-name-face)) ; $variable
If I'm not mistaken the regexp should match $variable including the dollar sign.
Now, i'm trying to figure out…

user883410
- 3
- 1
0
votes
2 answers
Object indentation in emacs php-mode
I would like to have this indentation like Zend does on objects:
$this->getResponse()
->appendBody('Hello World');
But what I have now is:
$this->getResponse()
->appendBody('Hello World');
and I don't have any idea how I can do in this…

aykut yaman
- 41
- 1
- 4