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 3/3] lisp/progmodes/etags.el improve match by string trimming Date: Sat, 16 Mar 2019 04:53:14 +0300 Message-ID: <20190316015314.2335-3-Hi-Angel@yandex.ru> References: <20190316015314.2335-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="51401"; 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 02:54:28 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 1h4yWp-000DIN-R5 for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 02:54:27 +0100 Original-Received: from localhost ([127.0.0.1]:35588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4yWo-0008GD-SS for ged-emacs-devel@m.gmane.org; Fri, 15 Mar 2019 21:54:26 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4yVx-0008FV-BV for emacs-devel@gnu.org; Fri, 15 Mar 2019 21:53:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4yVw-0001Kh-EL for emacs-devel@gnu.org; Fri, 15 Mar 2019 21:53:33 -0400 Original-Received: from forward104j.mail.yandex.net ([2a02:6b8:0:801:2::107]:50605) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4yVv-0001Jz-Q6 for emacs-devel@gnu.org; Fri, 15 Mar 2019 21:53:32 -0400 Original-Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 5A45C4A0F05 for ; Sat, 16 Mar 2019 04:53:29 +0300 (MSK) Original-Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GViviZf43N-rTx4rCWR; Sat, 16 Mar 2019 04:53:29 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1552701209; bh=KIHQ/pMbKz7CZn6nG8mLyNqUV6foUtGadDqmbxuEu7g=; h=In-Reply-To:Subject:To:From:References:Date:Message-Id; b=St/9o/f7rV9ZgFVreC7ivLcsXg/yJdWIPcZ8ftj8IqHcBx14TCotih25ZsmAuJ6xO bP9bWk2eAIm4KC78aZmLcFghlmqxozf34odBoIUgWU6OsdkFCXl02Tmhtx3LIlJXSS uwqBtFwGk6sHtfpUORHRKPEu/vQx9tdChdCLD4z8= Authentication-Results: mxback2o.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id hzxBGO16Wk-rSXGkP4e; Sat, 16 Mar 2019 04:53:28 +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-1-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:801:2::107 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:234196 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 --- lisp/progmodes/etags.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 62637414ef8..e8b67cf10f4 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 @@ -1386,8 +1387,7 @@ etags-goto-tag-location (setq startpos (point-min))) =20 (goto-char startpos) - (or (looking-at pat) ; Is tag at the specified location? - (while (progn + (or (while (progn (goto-char (- startpos offset)) (and (not (bobp)) (not (re-search-forward pat (+ startpos offset) = t)))) --=20 2.21.0