我刚刚安装了一个插件,想要在全局启用它。为了手动开启它,我需要输入 M-x highlight-indentation-mode。下面是我尝试过的列表:(highlight-indentation-mode t)
、(highlight-indentation-mode 1)
、(setq highlight-indentation-mode t)
。但是都没有起作用。接着我想到可能需要全局启用这个模式,于是开始搜索相关信息。我尝试了以下方法:
(define-globalized-minor-mode global-highlight-indentation-mode highlight-indentation-mode
(lambda () (setq highlight-indentation-mode t)))
不,这明显不是我要找的机器人,它虽然开启了变量,但模式仍然无法正常工作。
(define-globalized-minor-mode global-highlight-indentation-mode highlight-indentation-mode
(lambda () highlight-indentation-mode t))
(define-globalized-minor-mode global-highlight-indentation-mode highlight-indentation-mode
(highlight-indentation-mode t))
这两个命令刚刚让我的Emacs崩溃了:当我尝试使用这两个命令打开文件时,在配置文件中,Emacs会报错并拒绝打开文件。
更新:根据评论的建议,我也尝试了。
(defun enable-highlight-indentation-mode ()
(interactive)
(highlight-indentation-mode t))
(define-globalized-minor-mode global-highlight-indentation-mode highlight-indentation-mode
enable-highlight-indentation-mode)
(global-highlight-indentation-mode t)
同样的问题也出现在没有 (interactive)
的情况下。当我试图使用这个功能打开一个文件时,Emacs拒绝打开,并显示以下错误信息:
File mode specification error: (void-function nil)
c-font-lock-fontify-region: Symbol's function definition is void: nil
(defun turn-on-highlight-indentation-mode () (highlight-indentation-mode 1)) (define-globalized-minor-mode global-highlight-indentation-mode highlight-indentation-mode turn-on-highlight-indentation-mode)
- lawlist(setq debug-on-error t)
这可能会告诉你导致问题的函数名称。 - lawlist