Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ctags targets #1032

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ include $(CFG_SRC_DIR)/mk/autodep.mk
include $(CFG_SRC_DIR)/mk/tools.mk
include $(CFG_SRC_DIR)/mk/docs.mk


######################################################################
# Secondary makefiles, conditionalized for speed
######################################################################
Expand Down Expand Up @@ -378,4 +377,10 @@ endif
ifneq ($(findstring install,$(MAKECMDGOALS)),)
CFG_INFO := $(info cfg: including install rules)
include $(CFG_SRC_DIR)/mk/install.mk
endif
endif

ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
$(findstring TAGS.vi,$(MAKECMDGOALS))),)
CFG_INFO := $(info cfg: including ctags rules)
include $(CFG_SRC_DIR)/mk/ctags.mk
endif
12 changes: 12 additions & 0 deletions mk/ctags.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
######################################################################
# TAGS file creation. No dependency tracking, just do it on demand.
# Requires Exuberant Ctags: http://ctags.sourceforge.net/index.html
######################################################################

CTAGS_OPTS=--options=${CFG_SRC_DIR}/src/etc/ctags.rust -R ${CFG_SRC_DIR}/src

TAGS.emacs:
ctags -e -f $@ ${CTAGS_OPTS}

TAGS.vi:
ctags -f $@ ${CTAGS_OPTS}
7 changes: 7 additions & 0 deletions src/etc/ctags.rust
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--langdef=rust
--langmap=rust:.rs
--regex-rust=/[ \t]*fn[ \t]+([a-zA-Z0-9_]+)/\1/f,function/
--regex-rust=/[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-rust=/[ \t]*tag[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-rust=/[ \t]*resource[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-rust=/[ \t]*mod[ \t]+([a-zA-Z0-9_]+)/\1/m,modules/