Skip to content

Smart Scan: Jump between symbols in a buffer

by mickey on October 31st, 2013

A few years ago I wrote Effective Editing I: Movement and in that article I included a bunch of code for a feature I called “Smart Scan.” Back then I didn’t bother putting it on Github so I just left it as source code embedded in the article. I’ve now realized that hundreds have stuck it in their .emacs file but without the benefit of any potential updates, and with no way to actually contribute to the package.

Basically, Smart Scan let’s you jump between symbols in your current buffer that matches the one point is on. It does it unintrusively and without any prompts or other fancy UI gimmicks. Simply put your point on a symbol you want to search for in your buffer and type either M-n or M-p to move forward or backward respectively. Give it a shot. I have moved it Github here. Patches welcome :) Enjoy!

From → All Articles

  1. awesome! can’t wait to start using this. any chance you’ll add it to a package repo like MELPA or Marmalade?

  2. Cool! Probably the most astonishing thing here is that M-n and M-p were unoccupied…

  3. evil permalink

    For those using evil-mode, the default keys are * and #, and it’s super handy !

  4. Hi,

    Smartscan is a nice addition. However, it conflicts with the key bindings of minibuffer when it is globally enabled. I hope this can get fixed soon.

  5. lpm permalink

    Is this like highlight-symbol-next in highlight-symbol?

    • mickey permalink

      No idea – never used it.

    • mickey permalink

      Yeah that’s true. I accepted a pull request that added a global minor mode and I’m now regretting that. I would suggest globally binding smart scan to M-n and M-p and not using the minor mode.

  6. Nils Fagerburg permalink

    Here’s a patch to push the mark before the first use, so you can pop the mark to go back where you were the same way you can with regular iSearch. :)

    • mickey permalink

      Good idea. I’ve been meaning to add this myself. Could you make a pull request on Github?

Trackbacks & Pingbacks

  1. my emacs and linux engineering note. | nova0302

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS