help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mic-paren.el 3.10 available


From: rfflrccrd
Subject: Re: mic-paren.el 3.10 available
Date: Thu, 26 Jul 2012 08:22:52 -0700 (PDT)
User-agent: G2/1.0

On 07/26/2012 05:19 AM, Thien-Thi Nguyen wrote:> [NB: CC updated; we use the 
"sources" list to post/announce source code.]
> 
> () Wed, 25 Jul 2012 14:54:57 -0700 (PDT)
> 
>     As I use Viper, a Vim-emulation mode, I looked into the customization
>     group mic-paren-matching, hoping to find a way to emulate the way Vim
>     uses to highlight parentheses.  I found nothing.  Do you confirm it
>     is so?
> 
> No, but that's not saying much -- i don't use Vim.  FWIW, my mic-paren
> usage is very simple:
> 
> http://www.gnuvola.org/software/personal-elisp/dist/lisp/low-stress/turn-on-mic-paren.el
> 
>     Basically, since Vim uses both a bar cursor and a block cursor,
>     depending on context it highilights sometimes the parenthesis before
>     the cursor and sometimes the one after the cursor.
> 
> Could you please give an example or point to one on the net?
> 

Thank you for your prompt reply.

I thought that firing up Vim and checking out its behaviour first hand would 
have been worth a hundred words, but asking an Emacs user to use Vim is rude, 
isn't it? ;-)

Jokes apart, I would have liked to record and link a explanatory video, but I 
wasn't able to install any desktop recorder on my PC. I'll have to rely on 
words.

Vim matches brackets in two ways, depending on whether you are typing text or 
moving around, as typing text and moving around are two different modes in Vim. 
 
When you are moving around, Vim matches the bracket after point.  This 
behaviour is crucial because, while moving around, you can't go beyond the last 
character on the line: if such character were a bracket, you would not be able 
to match it.

When you are typing text, Vim matches:
 - the bracket after point, if there is one;
 - otherwise the bracket before point, if there is one.

Also, Vim always highlights both brackets.

Try it with this snippet (trailing whitespace is intentional):

( (()) )
[ [[]] ]

Vim also instantly highlights all mismatched closing parentheses, while 
ignoring square brackets and curly brackets, at least while editing Lisp code - 
which is the only code I edit in Vim - but I think that such behaviour is 
beyond the goals of mic-paren anyway.

I've noticed that mic-paren ignores curly brackets.  This is intentional, I 
suppose, as mic-paren targets Lisp code, but if it were able to match curly 
brackets as well, then it would be useful in other programming modes.

Have a nice day.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]