2

In vanilla emacs, I load the TAGS file, and do a lookup of a symbol with "M-.". I go right to the definition of the symbol.

When using Icicles, I get 374 hits for the same symbol. While I can in theory chip away the non-elephant slowly to find what I want, that's a pain, and I end up just turning off icicles for the tag lookup, and turning it back on.

Is there any way to tell icicles that I just want the definition when I do a tags lookup, and not every relevant match in the tags file?

For instance, I might search for the definition of the task_struct structure in the linux kernel source code. I see many definitions of the form:

struct task_struct taskInfo;

struct task_struct info;

but all I want is the one definition:

struct task_struct {

While I can "chip away the non-elephant, the elephants are pretty similar here, and it is hard to tell while looking at the search results that I only want lines with a curly brace after the name, and the curly brace might have been on a different line anyhow, so there is no guarantee even that is the right way to slice the results.

I've also seen member functions of a class appearing when I use Icicles, and I'd like a way to turn them off more easily.

Tried reading the emacs wiki and an internet search, but I didn't have much luck just searching for "emacs icicles tags".

  • You say "I end up just turning off icicles for the tag lookup, and turning it back on". Would you be happy if Emacs simply did that for you automatically? Some advice around `find-tag` ought to do the trick. – phils Feb 19 '11 at 02:14
  • Well, sometimes the behavior of the icicles tag search is helpful, so I wouldn't want to turn it off all the time, and I like the way that icicles presents results better than how vanilla emacs presents them. So, in a perfect world, it would be good if icicles had two find tag commands, one that just searched for strict definitions, and one that searched for more relaxed notions of definition as icicles does today with 'M-.'. that being said, I'd be happy to get some advice around find-tag. – Peter Williamson Feb 19 '11 at 17:04

3 Answers3

1

If vanilla M-. does what you want, doesn't icicle-find-first-tag' also do what you want? (Notice the-first'.)

http://www.emacswiki.org/emacs/Icicles_-_Emacs_Tags_Enhancements#icicle-find-first-tag

Drew
  • 29,895
  • 7
  • 74
  • 104
0

I don't use icicles, so I don't know if this will actually work, but give it a whirl and let me know.

(defadvice find-tag (around my-thawed-find-tag)
  "Disable icicles when finding tags."
  (let ((icy-state icy-mode))
    (if (not (equal (icy-mode 0)))
        (progn
          (icy-mode 0)
          ad-do-it
          (icy-mode icy-state))
      ad-do-it)))
(ad-activate 'find-tag)
phils
  • 71,335
  • 11
  • 153
  • 198
0

The advice around find-tag wasn't really what I was looking for. Instead, what I need is a way to get the definition sometimes and references sometimes. I found that cscope and the xcscope.el plugin did what I needed (and CEDET also did something similar to solve my problem)