在迷你缓冲器中显示匹配支架的线

Dan*_*Dan 5 emacs minibuffer

当我在emacs中键入一个关闭括号时,迷你缓冲区会显示包含匹配的开括号的行.有没有办法在迷你缓冲区中显示括号,括号等的匹配行而不删除括号并重新输入?

sco*_*zer 10

我假设您已启用show-paren-mode,因此突出显示匹配的parens:

(show-paren-mode t)
Run Code Online (Sandbox Code Playgroud)

如果paren离开屏幕,这将显示匹配的行:

(defadvice show-paren-function (after my-echo-paren-matching-line activate)
  "If a matching paren is off-screen, echo the matching line."
  (when (char-equal (char-syntax (char-before (point))) ?\))
    (let ((matching-text (blink-matching-open)))
      (when matching-text
        (message matching-text)))))
Run Code Online (Sandbox Code Playgroud)