问题标签 [php-mode]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
php - 如何配置 emacs 以在 php 模式下正确注释代码?
我有 emacs 23.3.1,在 Windows 上运行。
php-mode 1.5 来自 http://php-mode.sourceforge.net/,修改:2008-11-04
我认为这曾经可以工作,但是现在,当我尝试使用注释区域注释掉一段代码时,注释区域是“newcomment.el”中的一个交互式编译的 Lisp 函数,我得到的结果很差。
例子:
前:
后:
可以看到注释块中的每一行都有单行注释开始顺序//
和多行注释结束顺序*/
。
这不是一个大问题,尽管它很丑陋。当我尝试取消注释该块时,问题就出现了。我收到错误消息“找不到评论结束”。换句话说,comment-region
是不可逆的C-u comment-region
。
我会看看我是否能解决这个问题,但是在 php-mode 中是否有我缺少的设置?
有人知道吗?
更多的
我没有在我的 php-mode-hook 函数中添加任何东西来更改comment-start
andcomment-end
变量。当我调试时,comment-region
我可以看到它们以某种方式设置为不匹配//
的一对。*/
这就解释了注释区域的奇怪结果。我不相信是我的代码确实设置了这些变量。
我尝试在我的钩子中明确地将它们设置为//
and (空字符串)。在这种情况下,comment-region
看起来更漂亮,但它仍然没有取消注释。我也尝试了匹配的/*
and */
,但结果相同。取消注释不成功;错误是can't find comment end.
。
更多2
我认为我的语法表是正确的。它显示了这一点:
...这对我来说似乎是正确的。
php - 使用闭包时如何修复 php 模式缩进
我在 Emacs 中使用 php-mode,它可以正常工作,除非我使用闭包作为这样的参数:
当函数在函数调用内部时,缩进会加倍。如何解决这个问题?
编辑
如何使它看起来像这样(与javascript-mode处理匿名函数相同)。
emacs - Aquamacs 网络模式
我正在 Aquamacs 中搜索一种用于 Web 编辑(HTML/JS/PHP、CSS 分别)的模式。早些时候在 Cocoa Emacs 中我一直在使用 web-mode.el,但在 Aquamacs 中我得到了
错误。怎么了?使用相同的 .emacs 配置 Cocoa Emacs 很好。
问题是我需要一种可以将这三种模式(对我来说最重要的是语法着色)组合在一起的模式。
emacs - 如何将 php 模式中的缩进更改为 Emacs 中的 2 个空格?
我尝试将缩进从 4 个空格更改为 2 个空格(我需要使用这种样式编写代码)。
我尝试使用 php 代码在缓冲区中对此进行评估:
或者
但它没有用,当我输入 TAB 时,我得到了 4 个空格。
php - php-mode 突然缩进不同
在升级到 EMACS 24.3(我认为是从 24.2)并将 MELPAphp-mode
包升级到版本 20130920.1850 之后,php-mode
现在缩进如下:
它之前做了什么:
如何恢复以前的行为?
更新:最终,我在 Github 上提出了一个问题,php-mode 的维护者确认存在错误。
php - 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 not in a proper way.
However, I would like to keep those flags on while editing pure .php files (php controllers, which contain only php source).
How can I do that?
php - GNU emacs 的 PHP 模式未列为 MELPA 包
文档说:
使用 GNU Emacs 24 或更高版本,您可以使用其包功能从 MELPA 安装 PHP 模式。
但是当我按下Alt-x list-packages
我没有看到这个模式被列出来。
为什么?