From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#20629: 25.0.50; Regression: TAGS broken, can't find anything in C++ files. Date: Thu, 28 May 2015 14:54:49 +0300 Message-ID: <55670209.9080608@yandex.ru> References: <555EC552.5010600@swipnet.se> <55606A8F.1020109@swipnet.se> <55606CC7.3010401@yandex.ru> <55606F70.10605@swipnet.se> <83twv31jzg.fsf@gnu.org> <83pp5r1hdx.fsf@gnu.org> <83mw0v1e5n.fsf@gnu.org> <83lhgczo16.fsf@gnu.org> <55639175.9090005@yandex.ru> <83fv6kysjf.fsf@gnu.org> <556447EF.3050103@yandex.ru> <83bnh7z8c5.fsf@gnu.org> <5564C2C7.5050909@yandex.ru> <837frvywfn.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1432814128 28569 80.91.229.3 (28 May 2015 11:55:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 May 2015 11:55:28 +0000 (UTC) Cc: 20629@debbugs.gnu.org To: Stefan Monnier , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 28 13:55:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YxwP3-0002Oh-RD for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 May 2015 13:55:14 +0200 Original-Received: from localhost ([::1]:57985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwP3-0000Ch-3P for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 May 2015 07:55:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwOx-00008d-5F for bug-gnu-emacs@gnu.org; Thu, 28 May 2015 07:55:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwOt-00066A-5A for bug-gnu-emacs@gnu.org; Thu, 28 May 2015 07:55:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwOt-00065W-25 for bug-gnu-emacs@gnu.org; Thu, 28 May 2015 07:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YxwOs-0002dc-HC for bug-gnu-emacs@gnu.org; Thu, 28 May 2015 07:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 May 2015 11:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20629-submit@debbugs.gnu.org id=B20629.143281410010130 (code B ref 20629); Thu, 28 May 2015 11:55:02 +0000 Original-Received: (at 20629) by debbugs.gnu.org; 28 May 2015 11:55:00 +0000 Original-Received: from localhost ([127.0.0.1]:59036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxwOp-0002dJ-Bn for submit@debbugs.gnu.org; Thu, 28 May 2015 07:55:00 -0400 Original-Received: from mail-wg0-f43.google.com ([74.125.82.43]:34611) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxwOn-0002d3-GR for 20629@debbugs.gnu.org; Thu, 28 May 2015 07:54:58 -0400 Original-Received: by wgv5 with SMTP id 5so34155404wgv.1 for <20629@debbugs.gnu.org>; Thu, 28 May 2015 04:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=0Aw9y3NQQSmvf0ZuPTAWsnHdPrixub+xvJrtOcnE2xM=; b=KN0zhEpu57Fzu/0j0NoADiNFz/yZry2mUssy3HkIIjuJMUc2gl+m2EDb0LK+5ftKM0 hXZot7Nwz/sNPZtLm7S7UjEDAaMe0rD0nkK0i3/7dOwBIcgm5sjiUOjgJtxeKNV23Kms 8Za3+BoAjo2Qv6ZdzI26EoN64bAB03fGCkY1Yjj0na9hcqq6awkgQmAwU/g5GleR07Ah uKWVFmc1jHruCquWcZC6CwZEQth8B/IAyDq1mU1XOotJNi7+bwt5RWB8+KuD2kJVuRoH vDGCufySXKXYyqgnaJ37Pg3WzbLgJuwqgPJ8ht5QHX7LutBfAXOisUXsYytyn5V30vLe OPIw== X-Received: by 10.194.6.229 with SMTP id e5mr838901wja.158.1432814091700; Thu, 28 May 2015 04:54:51 -0700 (PDT) Original-Received: from [192.168.0.185] (static-nbl2-118.cytanet.com.cy. [212.31.107.118]) by mx.google.com with ESMTPSA id wv3sm3033771wjc.0.2015.05.28.04.54.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 04:54:51 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103254 Archived-At: On 05/27/2015 12:01 AM, Stefan Monnier wrote: > BTW, it might be worthwhile to try and replace the obarray with > a function which directly searches the corresponding tags buffers. > Searching those buffers might not be significantly slower than searching > the obarray, with the advantage that we avoid the "building the > completion table" step. Having the table always up-to-date would be nice. But here's some numbers with a rough patch. The project is of moderate size: Linux kernel. TAGS is 159097 lines long. Pre-built tags-completion-table: Build it -> 1.34 seconds (all-completions "" (tags-completion-table)) after that -> 0.02 seconds Dynamic completion table: (all-completions "" (tags-completion-table)) -> 0.78 seconds ^-- same with any longer prefix, in this implementation Patch: diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 9ff164e..19de126 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -753,31 +753,18 @@ Assumes the tags table is the current buffer." (setq tags-included-tables (funcall tags-included-tables-function)))) (defun tags-completion-table () - "Build `tags-completion-table' on demand. + "Return tags completion table. The tags included in the completion table are those in the current tags table and its (recursively) included tags tables." - (or tags-completion-table - ;; No cached value for this buffer. - (condition-case () - (let (current-table combined-table) - (message "Making tags completion table for %s..." buffer-file-name) - (save-excursion - ;; Iterate over the current list of tags tables. - (while (visit-tags-table-buffer (and combined-table t)) - ;; Find possible completions in this table. - (setq current-table (funcall tags-completion-table-function)) - ;; Merge this buffer's completions into the combined table. - (if combined-table - (mapatoms - (lambda (sym) (intern (symbol-name sym) combined-table)) - current-table) - (setq combined-table current-table)))) - (message "Making tags completion table for %s...done" - buffer-file-name) - ;; Cache the result in a buffer-local variable. - (setq tags-completion-table combined-table)) - (quit (message "Tags completion table construction aborted.") - (setq tags-completion-table nil))))) + (completion-table-with-cache + (lambda (_string) + (let (cont tables) + (save-excursion + ;; Iterate over the current list of tags tables. + (while (visit-tags-table-buffer (or cont (progn (setq cont t) nil))) + ;; Find possible completions in this table. + (push (funcall tags-completion-table-function) tables))) + (nreverse (apply #'nconc tables)))))) ;;;###autoload (defun tags-lazy-completion-table () @@ -1256,11 +1243,7 @@ buffer-local values of tags table format variables." (defun etags-tags-completion-table () ; Doc string? - (let ((table (make-vector 511 0)) - (progress-reporter - (make-progress-reporter - (format "Making tags completion table for %s..." buffer-file-name) - (point-min) (point-max)))) + (let ((table nil)) (save-excursion (goto-char (point-min)) ;; This monster regexp matches an etags tag line. @@ -1276,12 +1259,11 @@ buffer-local values of tags table format variables." \\([-a-zA-Z0-9_+*$?:]+\\)[^-a-zA-Z0-9_+*$?:\177]*\\)\177\ \\(\\([^\n\001]+\\)\001\\)?\\([0-9]+\\)?,\\([0-9]+\\)?\n" nil t) - (intern (prog1 (if (match-beginning 5) + (push (prog1 (if (match-beginning 5) ;; There is an explicit tag name. (buffer-substring (match-beginning 5) (match-end 5)) ;; No explicit tag name. Best guess. - (buffer-substring (match-beginning 3) (match-end 3))) - (progress-reporter-update progress-reporter (point))) + (buffer-substring (match-beginning 3) (match-end 3)))) table))) table))