10

This is a really nice feature, but it only displays when inserting a paren, not when changing to a cursor position. Is there an interactive command that I can call to display this? Can I configure it to show up on cursor move?

enter image description here

Malabarba
  • 22,878
  • 6
  • 78
  • 163
wdkrnls
  • 3,657
  • 2
  • 27
  • 46

2 Answers2

6

That message is printed when the beginning of the sexp is not visible in the window; otherwise, the opening paren is temporarily highlighted.

This behavior is implemented in simple.el and is not associated with any minor mode. It is implemented using a hook that runs when a character is inserted.

The actual blinking/message comes from command blink-matching-open, which you can call yourself. For example you could start an idle-timer that will call this command whenever you pause for a short time on a closing paren. This is the way that the built-in show-paren-mode works.

(defvar match-paren--idle-timer nil)
(defvar match-paren--delay 0.5)
(setq match-paren--idle-timer (run-with-idle-timer match-paren--delay t #'blink-matching-open))
glucas
  • 20,175
  • 1
  • 51
  • 83
  • I want this too, but how do I make it not temporary? I.e. I want the message to stay in the minibuffer till the cursor is moved. – Faheem Mitha Jan 29 '20 at 06:27
4

You can use M-x blink-matching-open RET to display the message if you're right after a paren. To do it more "on the fly" you might like to try M-x show-paren-mode, tho it doesn't actually give you this message.

Otherwise, you could use something like

(add-hook 'post-command-hook
          (lambda ()
            (if (and (not (bobp))
                     (eq ?\) (char-syntax (char-before))))
                (blink-matching-open))))
Stefan
  • 26,154
  • 3
  • 46
  • 84