9

When you type closing parenthesis (or maybe it works for other paired symbols too), and opening parenthesis is not visible on the screen, Emacs “jumps” to opening parenthesis to show you where it is. This is very handy.

I want to make period for which opening parenthesis is shown shorter (say, half a second). This shouldn't be hard, but the problem is that I don't know what this functionality is called, so I cannot search Emacs variables/functions.

Dan
  • 32,584
  • 6
  • 98
  • 168
Mark Karpov
  • 4,893
  • 1
  • 24
  • 53
  • 1
    Side note: you don't have to wait for the cursor to come back. You probably knew this, but some users don't realize it, so they find the delay excruciating. – Stefan Aug 18 '15 at 22:14

2 Answers2

5

Emacs comes with the package show-paren-mode. Instead of temporarily blinking the corresponding parenthesis when one is written, the parenthesis corresponding to the one under the cursor is highlighted.

There are also other packages with some additional bells and whistles. I prefer mic-paren. This package is faster and it can highlight both forward and backward at the same time, should the cursor be between parentheses like )(.

Lindydancer
  • 6,095
  • 1
  • 13
  • 25
5

I think you want to adjust the parameters for Blinking Parentheses. In particular, you can adjust blink-matching-delay, which:

This variable specifies the number of seconds to keep indicating the matching parenthesis. A fraction of a second often gives good results, but the default is 1, which works on all systems.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • That's it. Unfortunately, it doesn't seem to like value of `0.5`. According to description of `blink-matching-delay` it should be set to *number of [whole] seconds*. Is there any way to set it to half of second? – Mark Karpov Aug 18 '15 at 12:10
  • @Mark: not sure. The text above is from the manual, which implies that fractions work on some systems but not all of them. Maybe try other fractional values? – Dan Aug 18 '15 at 12:13
  • Doesn't seem to work. For some reason it always uses 1 second delay. I need to read source code, this may be a bug. – Mark Karpov Aug 18 '15 at 12:17
  • @Mark: the manual is certainly ambiguous on this point, so I wonder if it's a system-level problem. Good luck on the bug hunt! – Dan Aug 18 '15 at 12:19
  • 3
    It uses `sit-for` internally. I've tested it and it works OK with floating point intervals, so my system supports it (it would be strange if GNU/Linux didn't support that). I'm going to report this. – Mark Karpov Aug 18 '15 at 12:24
  • 1
    Here what Emacs devs say: *The behavior you're describing was a recent regression, and it was fixed in b892438d7 (yesterday).* I will pull/rebuild Emacs and I should be fine. Accepting your answer. – Mark Karpov Aug 18 '15 at 16:43