unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: tags mode completion table doesn't work with multiple tables
       [not found] <200304252218.h3PMIca01992@julius.internal.avlsi.com>
@ 2003-04-26 13:45 ` Richard Stallman
  2003-04-28  7:32   ` Francesco Potorti`
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2003-04-26 13:45 UTC (permalink / raw)
  Cc: emacs-devel

I am not quite sure how etags.el handles multiple tags tables nowadays.
Will it search for your tag in all of them, or do you have to choose
one with visit-tags-table?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tags mode completion table doesn't work with multiple tables
  2003-04-26 13:45 ` tags mode completion table doesn't work with multiple tables Richard Stallman
@ 2003-04-28  7:32   ` Francesco Potorti`
  2003-04-29  5:38     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Francesco Potorti` @ 2003-04-28  7:32 UTC (permalink / raw)
  Cc: emacs-devel

>I am not quite sure how etags.el handles multiple tags tables nowadays.
>Will it search for your tag in all of them, or do you have to choose
>one with visit-tags-table?

I append the docs about this.  In short, you choose one table, but if
one is already chosen, you can add one more to the list.

================================================================

Selecting a Tags Table
----------------------

   Emacs has at any time one "selected" tags table, and all the commands
for working with tags tables use the selected one.  To select a tags
table, type `M-x visit-tags-table', which reads the tags table file
name as an argument.  The name `TAGS' in the default directory is used
as the default file name.

   All this command does is store the file name in the variable
`tags-file-name'.  Emacs does not actually read in the tags table
contents until you try to use them.  Setting this variable yourself is
just as good as using `visit-tags-table'.  The variable's initial value
is `nil'; that value tells all the commands for working with tags tables
that they must ask for a tags table file name to use.

   Using `visit-tags-table' when a tags table is already loaded gives
you a choice: you can add the new tags table to the current list of
tags tables, or start a new list.  The tags commands use all the tags
tables in the current list.  If you start a new list, the new tags table
is used _instead_ of others.  If you add the new table to the current
list, it is used _as well as_ the others.  When the tags commands scan
the list of tags tables, they don't always start at the beginning of
the list; they start with the first tags table (if any) that describes
the current file, proceed from there to the end of the list, and then
scan from the beginning of the list until they have covered all the
tables in the list.

   You can specify a precise list of tags tables by setting the variable
`tags-table-list' to a list of strings, like this:

     (setq tags-table-list
           '("~/emacs" "/usr/local/lib/emacs/src"))

This tells the tags commands to look at the `TAGS' files in your
`~/emacs' directory and in the `/usr/local/lib/emacs/src' directory.
The order depends on which file you are in and which tags table
mentions that file, as explained above.

   Do not set both `tags-file-name' and `tags-table-list'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tags mode completion table doesn't work with multiple tables
  2003-04-28  7:32   ` Francesco Potorti`
@ 2003-04-29  5:38     ` Richard Stallman
  2003-04-29 10:15       ` Francesco Potorti`
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2003-04-29  5:38 UTC (permalink / raw)
  Cc: emacs-devel

    >I am not quite sure how etags.el handles multiple tags tables nowadays.
    >Will it search for your tag in all of them, or do you have to choose
    >one with visit-tags-table?

    I append the docs about this.  In short, you choose one table, but if
    one is already chosen, you can add one more to the list.

Is the problem that, if you have put multiple tags tables in the
current list, completion fails to search them all?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tags mode completion table doesn't work with multiple tables
  2003-04-29  5:38     ` Richard Stallman
@ 2003-04-29 10:15       ` Francesco Potorti`
  0 siblings, 0 replies; 4+ messages in thread
From: Francesco Potorti` @ 2003-04-29 10:15 UTC (permalink / raw)
  Cc: emacs-devel

>Is the problem that, if you have put multiple tags tables in the
>current list, completion fails to search them all?

By reading the source, apparently yes.

In fact, this function:


;; Completion function for tags.  Does normal try-completion,
;; but builds tags-completion-table on demand.
(defun tags-complete-tag (string predicate what)
  (save-excursion
    ;; If we need to ask for the tag table, allow that.
    (let ((enable-recursive-minibuffers t))
      (visit-tags-table-buffer))
    (if (eq what t)
	(all-completions string (tags-completion-table) predicate)
      (try-completion string (tags-completion-table) predicate))))

which is the one that builds the completion table when necessary,
completely ignores tags-table-list.  

If tags-table-list is set, in fact, the above function ignores it
because it calls visit-tags-table-buffer, which sets the current buffer
to the first buffer in tags-table-list, ignoring the others.

Maybe the following substitution function will do the trick.  Frederik,
would you please try it?  To try it, put point (the cursor) after the
last close parenthesis, then hit C-x C-e.

(defun tags-complete-tag (string predicate what)
  (save-excursion
    ;; If we need to ask for the tag table, allow that.
    (let ((enable-recursive-minibuffers t))
      (visit-tags-table-buffer))
    (let ((table (tags-completion-table)))
      ;; Consider all possible tag tables in tags-table-list.
      (while (visit-tags-table-buffer t)
	(setq table (tags-completion-table)))
      (if (eq what t)
	  (all-completions string table predicate)
	(try-completion string table predicate)))))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-29 10:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200304252218.h3PMIca01992@julius.internal.avlsi.com>
2003-04-26 13:45 ` tags mode completion table doesn't work with multiple tables Richard Stallman
2003-04-28  7:32   ` Francesco Potorti`
2003-04-29  5:38     ` Richard Stallman
2003-04-29 10:15       ` Francesco Potorti`

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).