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 v3] lisp/progmodes/etags.el improve match by string trimming Date: Sun, 17 Mar 2019 05:38:34 +0300 Message-ID: <20190317023834.27564-1-Hi-Angel@yandex.ru> References: <20190316021333.8552-1-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="247946"; 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 Sun Mar 17 03:39:59 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 1h5LiQ-0012Ou-Oi for ged-emacs-devel@m.gmane.org; Sun, 17 Mar 2019 03:39:58 +0100 Original-Received: from localhost ([127.0.0.1]:49219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5LiP-00046R-Od for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 22:39:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5LhF-00044R-9a for emacs-devel@gnu.org; Sat, 16 Mar 2019 22:38:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5LhE-0004dZ-Bi for emacs-devel@gnu.org; Sat, 16 Mar 2019 22:38:45 -0400 Original-Received: from forward104j.mail.yandex.net ([5.45.198.247]:35996) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h5LhD-0004cS-Tl for emacs-devel@gnu.org; Sat, 16 Mar 2019 22:38:44 -0400 Original-Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward104j.mail.yandex.net (Yandex) with ESMTP id CC8BE4A0636 for ; Sun, 17 Mar 2019 05:38:39 +0300 (MSK) Original-Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rZFprh17L2-cd88VP5O; Sun, 17 Mar 2019 05:38:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1552790319; bh=csmxJ92k8+t/wIJGCZUWNFT26cu1EmvPEE6wNRrwgvQ=; h=In-Reply-To:Subject:To:From:References:Date:Message-Id; b=P7i1kpBgmt7SjwuvLV5RhF4q2wI6ch0wuiugHq3Gfel2a/L8O0OPiKIDUhSBVekR1 iPUD2m8SmJVAVqlha0+jeWA9maYCWRUajIH8AKijTBwlPNot93bNmmfMJ2EsqcroBI lh+WT9uv/Ym9oi3nJIl3p0BqmqpWNClB3eI4X8cQ= Authentication-Results: mxback1j.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id wmhNswg1NN-cdPil5tG; Sun, 17 Mar 2019 05:38:39 +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: <20190316021333.8552-1-Hi-Angel@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.45.198.247 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:234250 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 --- v3: swap regexp-quote and string-trim, that works faster 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..d5162f01e47 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 (regexp-quote (string-trim (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