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

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))
| improve this answer | |
  • 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 at 6: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))))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.