- Subject: Re: Customizing ctags Behaviour
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 12:17:11 -0500
Hagemann, Robert <rhagemann@xxxxxxxxxxxx> wrote:
>
>1. In several of our modes, the hyphen ('-') is part of a name, so I'd
>like to have
>ctags_popup_tag uses the complete name with all hyphen separated parts
>as default.
>Example:
> Cursor is at "PART-MP-CODE1",
> so ctags_popup_tag shouldn't use "PART" as default, but the whole
>"PART-MP-CODE1".
>
>2. I'd like to have the tags-file in a directory like
>$HOME/e/develop/tags.
>There is an environment variable pointing to the directory already at
>hand.
>
>How con I achieve both features in a clean manner?
You will need to patch ctags.sl. I have appended a patch that
addresses these issues. The patch modifies ctags.sl to use
the buffer-local variables Word_Chars and Tags_File when they exist
instead of global variables. Note also the patch changes the name of
the Tag_File global variable to Tags_File.
To use it, create a mode-specific hook that sets buffer-local
variables to the desired values. For example,
define c_mode_hook ()
{
.
.
if (path_basename (buffer_filename ()) == "/some/path")
{
create_blocal_var ("Word_Chars");
set_blocal_var ("Word_Chars", "-A-Za-z0-9");
create_blocal_var ("Tags_File");
set_blocal_var ("Tags_File", "/path/to/tags/file");
}
.
.
}
Let me know if this patch correctly addresses the problem. If so, I
will integrate it into the next release. Thanks, --John
Index: ctags.sl
===================================================================
--- ctags.sl (revision 40)
+++ ctags.sl (working copy)
@@ -14,9 +14,13 @@
%
% Public Variables:
%
-% Tag_file: The name of the tags file to use. The default is
+% Tags_file: The name of the tags file to use. The default is
% "tags".
-custom_variable ("Tag_File", "tags");
+%
+% Buffer Local Variables:
+% Tags_File: The name of the tag file to use
+% Word_Chars: The characters that make up a word
+custom_variable ("Tags_File", "tags");
private variable Position_Stack = NULL;
private variable Position_Stack_Ptr = NULL;
@@ -217,6 +221,14 @@
{
variable dir;
+ if (path_is_absolute (tags_file))
+ {
+ if (1 == file_status (tags_file))
+ return tags_file;
+
+ return NULL;
+ }
+
(,dir,,) = getbuf_info ();
forever
@@ -224,7 +236,7 @@
variable file = dircat (dir, tags_file);
if (1 == file_status (file))
return file;
-
+
% This may need modified for non-Unix systems...
#ifdef UNIX
dir = expand_filename (dircat (dir, "../"));
@@ -253,7 +265,8 @@
variable file, dir, dir1;
variable tbuf = " *tags*";
- file = locate_tags_file (Tag_File);
+ file = get_blocal_var("Tags_File", Tags_File);
+ file = locate_tags_file (file);
if (file == NULL)
error ("Unable to find a tags file");
@@ -300,6 +313,7 @@
#ifdef VMS
word_chars = strcat (word_chars, "$");
#endif
+ word_chars = get_blocal_var ("Word_Chars", word_chars);
return read_mini ("Find tag:", get_word_at_point (word_chars), "");
}
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]