开发者

When using Icicles in emacs, how do I get *just* the definition with a tag lookup?

开发者 https://www.devze.com 2023-02-12 12:20 出处:网络
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.

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 theor开发者_如何学Cy 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".


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


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)


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号