gpt4 book ai didi

emacs - 如何完成禁用 flymake 以及它所连接的所有内容?

转载 作者:行者123 更新时间:2023-12-01 11:41:04 31 4
gpt4 key购买 nike

以下是我的 init.el 中的片段Flymake的相关资料:

(add-hook 'python-mode-hook 
(lambda ()
(unless (eq buffer-file-name nil) (flymake-mode 1)) ;dont invoke flymake on temporary buffers for the interpreter
(local-set-key [f2] 'flymake-goto-prev-error)
(local-set-key [f3] 'flymake-goto-next-error)
(local-set-key [f4] 'flymake-display-err-menu-for-current-line)
(hs-minor-mode)
(orgtbl-mode)
(outline-minor-mode -1)))

...

;;===== PyFlakes
;; code checking via pyflakes+flymake
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pychecker" (list local-file))))

(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pyflakes-init)))

(mapcar (lambda (hook) (add-hook 'find-file-hook hook))
(list 'flymake-find-file-hook))

(unload-feature 'flymake) ; unloaded in an attempt to get rid of the error

但每次我 find-filerevert-buffer (扩展 .xml.php.html )我收到以下错误(不是 .py ):

Flymake: Failed to launch syntax check process 'php' with args (-f _posteddata_flymake.php -l): Searching for program: permission denied, php. Flymake will be switch OFF



或者

Flymake: Failed to launch syntax check process 'xml' with args (val //path/to/file/config/prod-conf_flymake.xml): Searching for program: permission denied, xml. Flymake will be switch OFF



我也试过做 (load "flymake" nil)但它也不起作用。

打开或重新加载大量文件时会浪费大量时间。

我该如何解决?

最佳答案

只是不要将 Flymake 添加到 find-file-hook .而是仅将其添加到主要模式的 Hook 中,您希望在其中使用它。

您可能还想查看替代方案 Flycheck包,在全局范围内启用更安全,支持更多语言,并且需要更少的定制。免责声明:我是这个包的作者。

关于emacs - 如何完成禁用 flymake 以及它所连接的所有内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20780905/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com