2010-05-31 31 views
1

我正在尝试编写一个宏,它调用cscope-find-functions-calling-this-function缓冲区中显示的文件中的每个标记(由list-tags命令创建)。 这应该创建一个缓冲区,其中包含调用某个文件中定义的一组函数的所有函数的列表。如何让emacs宏等待cscope查询结果?

我只是在标记列表缓冲区中的第一个标记的开始位置,然后运行下面的键盘宏来执行此操作。这是按键的键盘宏序列:

 
1. <f11>    ;; cscope-find-functions-calling-this-function                           
2. RET    ;; newline  [shows results of cscope in a split window] 
3. C-x C-p   ;; mark-page 
4. C-x C-x   ;; icicle-exchange-point-and-mark 
5. <up>    ;; previous-line 
6. <end>    ;; end-of-line    [region to copy has been marked] 
7. <f7>    ;; append-results-to-buffer 
8. C-x ESC O   ;;     [move back to split window on the right] 
9. C-x b    ;; icicle-buffer  [Switch back to *Tags List* buffer] 
10. *Tags    ;; self-insert-command * 5 
11. SPC    ;; self-insert-command 
12. List*    ;; self-insert-command * 5 
13. RET    ;; newline 
14 . <down>   ;; next-line  [Position point on next tag in the list] 

问题: 我得到缓冲区没有结果,我发现这是因为步骤3-7执行之前也 cscope的打印结果在步骤1-2中进行查询。

我可以通过使用C-x q在宏中插入一个暂停,但我宁愿让宏在步骤2之后等待,直到cscope返回结果并自动继续。我怀疑这是不可能通过一个宏,也许是一个LISP函数......我自己不是一个口齿不清的专家。有人可以帮忙吗?谢谢!


详情:

  • 我已经安装了Icicles因此通过 默认我当前缓冲区小缓冲区中输入得到的点字。
  • F11势必 cscope-find-functions-calling-this-function
  • windmove安装和C-X <右>(C-X ESC -O - 如下所示)将转至 右侧窗口。
  • F7势必 append-results-to-buffer这是 定义为:
 
(defun append-results-to-buffer() 
    (interactive) 
    (append-to-buffer (get-buffer-create "c1") (point) (mark))) 

该函数只是追加当前标记区域到名为“C1”的缓冲区。

回答

2

CEDET套件在cedet-cscope.el中支持cscope,它同步调用cscope。你可以借用一些东西从键盘宏中使用。或者,您可以使用CEDET的symref工具(semantic-symref-symbol)来完成CScope之上的繁重工作。它也可以使用GNU Global或IDUtils。

+0

感谢提示Eric!我想我需要做一些挖掘。好东西是我爱这整个LISP业务。 – Sudhanshu 2010-06-01 17:44:50