简体   繁体   English

Emacs / Aquamacs php模式和选项卡缩进

[英]Emacs/Aquamacs php-mode and tabs indent

I can't get my Aquamacs 2.4 (Emacs) to follow the Kohana style: 我无法让我的Aquamacs 2.4(Emacs)遵循Kohana风格:

Emacs in php-mode replaces tabs with spaces. php-mode中的Emacs用空格替换制表符。 I want to disable this and use tab-characters for the indention. 我想禁用此功能,并使用制表符作为缩进。

I tried many solutions like this, but none works for me: 我尝试了许多这样的解决方案,但没有一个适合我:

(require 'php-mode)
(setq php-mode-force-pear t)
(add-hook 'php-mode-hook
      '(lambda ()
         (setq indent-tabs-mode t)
         (setq tab-width 4)
         (setq c-basic-offset 4)))

Any help appreciated. 任何帮助表示赞赏。

Thanks, David 谢谢大卫

If you are looking for tabs for indentation and spaces for alignment then you can use SmartTabs. 如果要查找缩进的标签和对齐的空格,则可以使用SmartTab。
( ---> is a tab, . is a space) --->是制表符, .是空格)

function example()
{
--->command();

--->if ($condition)
--->{
--->--->$arr = array('One',
--->--->.............'Two'); // Tabs for indent, spaces for alignment.
--->--->other_command();
--->}
}

See emacswiki and github for installation details. 有关安装详细信息,请参见emacswikigithub

That should do the job: 那应该做的工作:

(setq c-default-style "bsd"
      c-basic-offset 4)

cf How to configure Emacs (v 23) with nxhtml to follow Kohana coding standards? cf 如何使用nxhtml配置Emacs(v 23)以遵循Kohana编码标准?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM