Hi,
This patch add a autocmd event called TagNotFound triggered when the requested
tag was not found. The motivation for this event is as follows: I usually add
the following to my vimrc in order to ensure my tags file is up-to-date:

  au BufWritePost * if filereadable('tags') | silent exe '!ctags -a %' | endif

However this seems wasteful since the majority of my writes don't include new
identifiers to be indexed. With this patch the command above could be replaced
with:

  au TagNotFound * if filereadable('tags') | silent exe '!ctags' | endif

Thus indexing would only be performed when a missing tag is requested. 

Another use-case for this new event would be to trigger a psearch when the tag
was not found:

  au TagNotFound * exe 'psearch /' . expand('<amatch>') . '/'

BTW: what's the recommended cinoptions for the Vim codebase?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 4de5b16..06f1578 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -284,6 +284,7 @@ Name			triggered by ~
 |SpellFileMissing|	a spell file is used but it can't be found
 |SourcePre|		before sourcing a Vim script
 |SourceCmd|		before sourcing a Vim script |Cmd-event|
+|TagNotFound|		the tag was not found in the tag file(s)
 
 |VimResized|		after the Vim window size changed
 |FocusGained|		Vim got input focus
@@ -879,6 +880,10 @@ TabEnter			Just after entering a tab page. |tab-page|
 TabLeave			Just before leaving a tab page. |tab-page|
 				A WinLeave event will have been triggered
 				first.
+							*TagNotFound*
+TagNotFound			When the requested tag was not found in the
+				tag file(s). The pattern is matched against
+				the tag name. <amatch> is the tag name.
 							*TermChanged*
 TermChanged			After the value of 'term' has changed.  Useful
 				for re-loading the syntax file to update the
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 8186678..55d8d97 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -820,7 +820,8 @@ Note: these are typed literally, they are not special keys!
 	<amatch>   When executing autocommands, is replaced with the match for
 		   which this autocommand was executed.  It differs from
 		   <afile> only when the file name isn't used to match with
-		   (for FileType, Syntax and SpellFileMissing events).
+		   (for FileType, Syntax, SpellFileMissing and TagNotFound
+		   events).
 	<sfile>    When executing a ":source" command, is replaced with the
 		   file name of the sourced file.  *E498*
 		   When executing a function, is replaced with:
diff --git a/src/Makefile b/src/Makefile
index 8fd59fb..1a65333 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -565,7 +565,7 @@ CClink = $(CC)
 # When using -g with some older versions of Linux you might get a
 # statically linked executable.
 # When not defined, configure will try to use -O2 -g for gcc and -O for cc.
-#CFLAGS = -g
+CFLAGS = -g -O0
 #CFLAGS = -O
 
 # Optimization limits - depends on the compiler.  Automatic check in configure
@@ -1108,7 +1108,7 @@ INSTALL_DATA_R	= cp -r
 
 ### Program to run on installed binary.  Use the second one to disable strip.
 #STRIP = strip
-#STRIP = /bin/true
+STRIP = /bin/true
 
 ### Permissions for binaries  {{{1
 BINMOD = 755
diff --git a/src/fileio.c b/src/fileio.c
index ecec757..fa2ec72 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7711,6 +7711,7 @@ static struct event_name
     {"Syntax",		EVENT_SYNTAX},
     {"TabEnter",	EVENT_TABENTER},
     {"TabLeave",	EVENT_TABLEAVE},
+    {"TagNotFound",	EVENT_TAGNOTFOUND},
     {"TermChanged",	EVENT_TERMCHANGED},
     {"TermResponse",	EVENT_TERMRESPONSE},
     {"TextChanged",	EVENT_TEXTCHANGED},
@@ -9357,6 +9358,7 @@ apply_autocmds_group(
 		|| event == EVENT_FUNCUNDEFINED
 		|| event == EVENT_REMOTEREPLY
 		|| event == EVENT_SPELLFILEMISSING
+		|| event == EVENT_TAGNOTFOUND
 		|| event == EVENT_QUICKFIXCMDPRE
 		|| event == EVENT_COLORSCHEME
 		|| event == EVENT_OPTIONSET
diff --git a/src/tag.c b/src/tag.c
index d2fdee6..b24212e 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -569,6 +569,10 @@ do_tag(
 
 	if (num_matches <= 0)
 	{
+#ifdef FEAT_AUTOCMD
+	    apply_autocmds(EVENT_TAGNOTFOUND, name, curbuf->b_fname,
+			   FALSE, curbuf);
+#endif
 	    if (verbose)
 		EMSG2(_("E426: tag not found: %s"), name);
 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
diff --git a/src/vim.h b/src/vim.h
index 18610f5..80491d0 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1314,6 +1314,7 @@ enum auto_event
     EVENT_TEXTCHANGEDI,		/* text was modified in Insert mode*/
     EVENT_CMDUNDEFINED,		/* command undefined */
     EVENT_OPTIONSET,		/* option was set */
+    EVENT_TAGNOTFOUND,		/* tag not found */
     NUM_EVENTS			/* MUST be the last one */
 };
 

Raspunde prin e-mail lui