当我在Emacs中编辑一个包含PHP代码和HTML标记的PHP文件时,我一直收到警告:
Warning (php-indent):
Indentation fails badly with mixed HTML and PHP.
Look for an Emacs Lisp library that supports "multiple
major modes" like mumamo, mmm-mode or multi-mode.
在我的窗口底部弹出了一个窗口,占据了编辑屏幕的一半。我该如何关闭它?我知道有各种“add-ons”和模式可以添加到Emacs中,使其能够很好地格式化PHP + HTML,但是我只想关闭警告。我该怎么办?
编辑:
以下是php-mode.el文件的一部分,似乎上述错误来自此处:
(defvar php-completion-table nil
"Obarray of tag names defined in current tags table and functions know to PHP.")
(defvar php-warned-bad-indent nil)
(make-variable-buffer-local 'php-warned-bad-indent)
;; Do it but tell it is not good if html tags in buffer.
(defun php-check-html-for-indentation ()
(let ((html-tag-re "</?\\sw+.*?>")
(here (point)))
(if (not (or (re-search-forward html-tag-re (line-end-position) t)
(re-search-backward html-tag-re (line-beginning-position) t)))
t
(goto-char here)
(setq php-warned-bad-indent t)
(lwarn 'php-indent :warning
"\n\t%s\n\t%s\n\t%s\n"
"Indentation fails badly with mixed HTML and PHP."
"Look for an Emacs Lisp library that supports \"multiple"
"major modes\" like mumamo, mmm-mode or multi-mode.")
nil)))
(defun php-cautious-indent-region (start end &optional quiet)
(if (or php-warned-bad-indent
(php-check-html-for-indentation))
(funcall 'c-indent-region start end quiet)))
(defun php-cautious-indent-line ()
(if (or php-warned-bad-indent
(php-check-html-for-indentation))
(funcall 'c-indent-line)))
/usr/share/emacs/site-lisp/php-mode.el
中。我如何检查我加载的库?我只在我的.emacs
文件中看到以下设置:(setq diff-switches "-u")
和(setq frame-title-format (concat "%b - emacs@" (system-name)))
。 - UserIsStuckphp-mode.el
不是Emacs(即emacs -Q
)的一部分。你一定是从其他地方得到它的。尝试使用M-x find-library php-mode
命令,它会带你到文件php-mode.el
,你可以在其中搜索消息。 - Drewphp-mode.el
文件的内容。 - UserIsStuck