- 论坛徽章:
- 0
|
在emacs里可以用etags命令生成emacs专用的tags文件,有了此文件之后便可以使用一些emacs tags的命令,比如对于编辑C/C++程序的人员可以方便的定位一个函数的定义,或者
对函数名进行自动补齐:
find -name "*.[ch]" -exec etags -a {} \;
#!/bin/sh
trap "rm -f /tmp/$$" 0 1 2 3 15
rm -f ./TAGS
find `pwd`/ -type f -name "*.[chyl]" -print | \
xargs etags --append -o TAGS
find . -type d -print | \
while read DIR; do
[ "$DIR" != "." ] && ln -f -s `pwd`/TAGS $DIR
done
#!/usr/bin/env python
#使用方法 比如要生成一个TAGS文件包括当前目录下的include和src目录以及子目录下所有的.c .h文件
#命令行: python ezetags -d./include:./src -e.h,.c
import sys
from os import path
from getopt import *
from popen2 import *
def usage():
sys.stdout.write("usage: ezetags \n")
def parse_opt():
opts,args = getopt(sys.argv[1:], "hd:e:", ["help"])
dlist = None
elist = None
for f,v in opts:
if f in ("-h", "--help"):
usage()
sys.exit()
if f=="-e":
elist = v.split(',')
if f=="-d":
dlist = v.split(':')
return dlist,elist
def visit(arg, dirname, names):
for n in names:
nm,e = path.splitext(n)
if e in arg[1]:
p = path.join(dirname,n)
p+="\n"
arg[0].write(p)
sys.stdout.write(p)
def main():
dlist,elist = parse_opt()
if dlist==None or elist==None:
usage()
sys.exit()
sys.stdout.write("dlist="+str(dlist)+" elist="+str(elist)+"\n")
fout,fin = popen2("etags -")
for d in dlist:
path.walk(d, visit, (fin,elist))
sys.stdout.write("Done.\n")
sys.exit()
if __name__ == "__main__":main()
cscope
C-c s A cscope-unset-initial-directory
C-c s B cscope-display-buffer-toggle
C-c s C cscope-find-called-functions
C-c s D cscope-dired-directory
C-c s E cscope-edit-list-of-files-to-index
C-c s G cscope-find-global-definition-no-prompting
C-c s I cscope-index-files
C-c s L cscope-create-list-of-files-to-index
C-c s N cscope-next-file
C-c s P cscope-prev-file
C-c s W cscope-tell-user-about-directory
C-c s a cscope-set-initial-directory
C-c s b cscope-display-buffer
C-c s c cscope-find-functions-calling-this-function
C-c s d cscope-find-global-definition //找所有定义symbol以及用的地方
C-c s e cscope-find-egrep-pattern
C-c s f cscope-find-this-file
C-c s g cscope-find-global-definition //找所有定义symbol
C-c s i cscope-find-files-including-file
C-c s n cscope-next-symbol
C-c s p cscope-prev-symbol
C-c s s cscope-find-this-symbol
C-c s t cscope-find-this-text-string
C-c s u cscope-pop-mark
C-c s S .. C-c s T cscope-tell-user-about-directory
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/57669/showart_1947020.html |
|