I am using Emacs with php-mode.el: http://php-mode.sourceforge.net/php-mode.el.html
I have the following lines in my .emacs file:
(load-file "~/.emacs.d/php-mode.el")
(require 'php-mode)
(setq c-default-style "linux" c-basic-offset 4)
It is working really nicely for the most part. The issue is that for certain bits of code Emacs displays the code differently to other editors. For example, I have the following code in Emacs:
public function showStuff($items, $Stuff) {
$restrict = true;
$stuff = false;
$moreStuff = true;
if (($restrict && $stuff >= $moreStuff)
|| ( $moreStuff > 10)) {
return true;
}
return false;
}
But viewing the same file in Eclipse/Sublime Text/Text Wrangler looks like:
public function showStuff($items, $Stuff) {
$restrict = true;
$stuff = false;
$moreStuff = true;
if (($restrict && $stuff >= $moreStuff)
|| ( $moreStuff > 10)) {
return true;
}
return false;
}
Can anyone comment on why I am seeing these results and a possible solution?
Thanks.
As it seems you want to use spaces rather than tabs, I think this is basically a duplicate of:
I can't find this: How do I use 4 SPACES instead of a TAB in EMACS?
Or if you wanted this only for PHP files, then you would use:
Before that, with the code looking correct in Emacs, convert the tabs to spaces with:
untabifyRETI would also take a look at:
http://www.emacswiki.org/emacs/CategoryIndentation
(or take note of it, at least — indentation can be trickier than expected in Emacs, and there’s lots of good information there.)