Mercurial > hg > xemacs-beta
changeset 2067:0750eca4d23a
[xemacs-hg @ 2004-05-10 06:26:31 by stephent]
better support for exuberant ctags <874qqo4x52.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 10 May 2004 06:26:31 +0000 |
parents | a17a1610470d |
children | 7dc50bbd7a39 |
files | lisp/ChangeLog lisp/etags.el |
diffstat | 2 files changed, 54 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun May 09 21:50:18 2004 +0000 +++ b/lisp/ChangeLog Mon May 10 06:26:31 2004 +0000 @@ -1,3 +1,18 @@ +2004-05-08 Sven Grundmann <sven@xemacs.org> + + * etags.el: + * etags.el (tags-exuberant-ctags-optimization-p): Enable optimization + only for use with exuberant ctags. This will also enable building of + completion tables with exuberant ctags. This will not work with + xemacs ctags. New. + * etags.el (get-tag-table-buffer): New function for creating of + completion table is used if tags-exuberant-ctags-optimization-p ist t + * etags.el (add-to-tag-completion-table-exuberant-ctags): Defun for + building tag completion table with exuberant ctags. New. + * etags.el (find-tag-internal): Improve exact tag matching for tags + with name fields. Before the patch return types of functions or + function parameters (with exuberant ctags) were found as matches. + 2004-04-20 Malcolm Purvis <malcolmpurvis@optushome.com.au> * gtk-marshal.el: Return type for INT is gint, not guint.
--- a/lisp/etags.el Sun May 09 21:50:18 2004 +0000 +++ b/lisp/etags.el Mon May 10 06:26:31 2004 +0000 @@ -177,6 +177,19 @@ :type 'boolean :group 'etags) +(defcustom tags-exuberant-ctags-optimization-p nil + "*If this variable is nil (the default), then exact tag search is able +to find tag names in the name part of the tagtable (enclosed by ^?..^A) +and in the sourceline part of the tagtable ( enclosed by ^..^?). +This is needed by xemacs etags as not every tag has a name field. +It is slower for large tables and less precise than the other option. + +If it is non-nil, then exact tag will only search tag names in the name +part (enclosed by ^?..^A). This is faster and more precise than the other +option. This is only usable with exuberant etags, as it has a name field +entry for every tag." +:type 'boolean +:group 'etags) ;; Buffer tag tables. @@ -347,7 +360,9 @@ ;; The user wants to build the table: (condition-case nil (progn - (add-to-tag-completion-table) + (if tags-exuberant-ctags-optimization-p + (add-to-tag-completion-table-exuberant-ctags) + (add-to-tag-completion-table)) (setq tag-table-completion-status t)) ;; Allow user to C-g out correctly (quit @@ -507,6 +522,24 @@ tags-explicit-name-pattern)) (defconst tags-file-pattern "^\f\n\\(.+\\),[0-9]+\n") +(defun add-to-tag-completion-table-exuberant-ctags () + "Sucks the current buffer (a TAGS table) into the completion-table. +This is a version which is optimized for exuberant etags and will not +work with xemacs etags." + (message "Adding %s to tags completion table..." buffer-file-name) + (goto-char (point-min)) + (let ((tag-table-symbol (intern buffer-file-name tag-completion-table)) + ;; tag-table-symbol is used by intern-tag-symbol + name tag-symbol + tag-symbol-tables + (case-fold-search nil)) + (while (re-search-forward tags-explicit-name-pattern nil t) + ;; no need to check the mode here + (setq name (match-string 2)) + (intern-tag-symbol name))) + (message "Adding %s to tags completion table...done" buffer-file-name)) + + ;; #### Should make it work with the `include' directive! (defun add-to-tag-completion-table () "Sucks the current buffer (a TAGS table) into the completion-table." @@ -675,7 +708,11 @@ (t (setq tag-table-currently-matching-exact t))) ;; \_ in the tagname is used to indicate a symbol boundary. - (setq exact-tagname (format "\C-?\\_%s\\_\C-a\\|\\_%s\\_" tagname tagname)) + (if tags-exuberant-ctags-optimization-p + (setq exact-tagname (format "\C-?%s\C-a" tagname)) + (setq exact-tagname (format "\C-?%s\C-a\\|\ +\\_%s.?\C-?[0-9]*,[0-9]*$" tagname tagname)) + ) (while (string-match "\\\\_" exact-tagname) (aset exact-tagname (1- (match-end 0)) ?b)) (save-excursion