From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.devel Subject: [PATCH v2] lisp/progmodes/etags.el improve match by string trimming Date: Sat, 16 Mar 2019 05:13:33 +0300 Message-ID: <20190316021333.8552-1-Hi-Angel@yandex.ru> References: <20190316015314.2335-3-Hi-Angel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="130635"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 16 03:14:37 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4yqK-000XqI-O1 for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 03:14:36 +0100 Original-Received: from localhost ([127.0.0.1]:35740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4yqJ-0005TN-Oq for ged-emacs-devel@m.gmane.org; Fri, 15 Mar 2019 22:14:35 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4ypb-0005Mm-MN for emacs-devel@gnu.org; Fri, 15 Mar 2019 22:13:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4ypa-0000mI-KS for emacs-devel@gnu.org; Fri, 15 Mar 2019 22:13:51 -0400 Original-Received: from forward101o.mail.yandex.net ([2a02:6b8:0:1a2d::601]:33967) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4ypZ-0000ko-Ul for emacs-devel@gnu.org; Fri, 15 Mar 2019 22:13:50 -0400 Original-Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward101o.mail.yandex.net (Yandex) with ESMTP id BDEBB3C00034 for ; Sat, 16 Mar 2019 05:13:41 +0300 (MSK) Original-Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id foAKEugDdD-DfwauP1h; Sat, 16 Mar 2019 05:13:41 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1552702421; bh=ai++inOaXfiDTZLyEtgw7YnVJdn1Eb1zdIMuhFapBQw=; h=In-Reply-To:Subject:To:From:References:Date:Message-Id; b=fupW5e/0IWb00GVTQOb6WMYyT5KVJGW06sjiApcA+vhvaSLDsG0LyUMZh5r7xVxpw cHDAcAT1tMa64cZMFeVbvAWQZwvZrnG5f97b8WtV7ZIhyQMy2KehER624AxmxcD+fD 49n3t9vZ8mWVn5+lwGewjJWfMd/T5XRA3G2jTsuE= Authentication-Results: mxback15j.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rlHaHwlgPb-DeAm6ltv; Sat, 16 Mar 2019 05:13:40 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190316015314.2335-3-Hi-Angel@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:6b8:0:1a2d::601 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234199 Archived-At: Not only this improves general usability, but also works around existing bug in anjuta-tags=C2=B9 1: https://gitlab.gnome.org/GNOME/anjuta/issues/8 --- Sorry, I didn't test the last change on (looking-at pat) removal, it still does matching. Fixed here. lisp/progmodes/etags.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 62637414ef8..0e0e649a5d5 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1363,9 +1363,10 @@ etags-goto-tag-location ;; since just going around the loop once probably ;; costs about as much as searching 2000 chars. (setq offset 1000 - pat (concat (if (eq selective-display t) - "\\(^\\|\^m\\)" "^") - (regexp-quote (car tag-info)))) + ;; Improve the match by trimming the pattern. It's + ;; impossible anyway that 2 tags would only differ by + ;; trailing whitespace. + pat (string-trim (regexp-quote (car tag-info)))) ;; The character position in the tags table is 0-origin and counts= CRs. ;; Convert it to a 1-origin Emacs character position. (when startpos --=20 2.21.0