2

I can't jump to every instance of a character, for instance consider this line :

if( c == '\n' || c == ' ' || c == '\n') continue;

Pressing avy-shortcut SPACE to label all the white spaces will only allow me to jump at the spaces between the c and the =, all the other spaces after and before the (, ), | are ignored. Any idea on how to fix this behavior ?

  • what command are you acutally using ? avy-goto-char ? – bertfred Sep 26 '16 at 17:33
6

It looks like your avy shortcut is bound to avy-goto-word-1, while what you want here is avy-goto-char.

Try M-x avy-goto-char SPC and you will see that when word boundaries are ignored, all spaces are matched. On the other hand, avy-goto-word-1 is searching for a word boundary followed by a space. In your example text that happens to find the spaces following the word "c".

You'll see the same behavior with M-x search-forward-regexp RET \b SPC (ie search forward for the regular expression \b followed by a space). In Emacs regular expressions, \b matches the empty string at the beginning or end of word, where the current syntax table defines what characters are considered part of a word.

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.