我在.emacs中使用以下智能选项卡defun来完成单词或只是执行标准选项卡:

(global-set-key [(tab)] 'smart-tab)
(defun smart-tab ()
  "This smart tab is minibuffer compliant: it acts as usual in
    the minibuffer. Else, if mark is active, indents region. Else if
    point is at the end of a symbol, expands it. Else indents the
    current line."
  (interactive)
  (if (minibufferp)
      (unless (minibuffer-complete)
        (dabbrev-expand nil))
    (if mark-active
        (indent-region (region-beginning)
                       (region-end))
      (if (looking-at "\\_>")
          (dabbrev-expand nil)
        (indent-for-tab-command)))))

然而,当我使用magit-status进行git Git集成时,我之前可以选择一个已修改的文件,点击标签,并立即在该文件上看到差异以查看已修改的内容。但是,每当我现在尝试选项卡时,我的迷你缓冲区中都会出现以下错误。

indent-relative: Buffer is read-only: #<buffer *magit: my_project*

有关接近此问题的想法,并且可能仅将智能标签应用于某些模式吗?

谢谢!

有帮助吗?

解决方案

我是智能标签的维护者,可以从GitHub获得 。最新版本定义了一个次要模式,它在只读缓冲区或迷你缓冲区中自动关闭,允许像ido-mode和magit这样的东西正常工作。它还可以更好地处理您希望密钥运行与indent-for-tab-command不同的命令的情况,例如org-mode。我强烈建议您使用GitHub版本,因为它避免了使用全局键绑定的基本版本的许多麻烦。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top