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 1/3] lisp/progmodes/etags.el clean up code by removing a temporary Date: Sat, 16 Mar 2019 04:53:12 +0300 Message-ID: <20190316015314.2335-1-Hi-Angel@yandex.ru> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="48473"; 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:53:43 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 1h4yW6-000CTu-VL for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 02:53:43 +0100 Original-Received: from localhost ([127.0.0.1]:35586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4yW5-0008Fn-Qc for ged-emacs-devel@m.gmane.org; Fri, 15 Mar 2019 21:53:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4yVx-0008FX-Lv 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-0001Ko-G3 for emacs-devel@gnu.org; Fri, 15 Mar 2019 21:53:33 -0400 Original-Received: from forward101p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b7:101]:42777) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4yVv-0001Jp-Rk for emacs-devel@gnu.org; Fri, 15 Mar 2019 21:53:32 -0400 Original-Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward101p.mail.yandex.net (Yandex) with ESMTP id E1B2C3280A79 for ; Sat, 16 Mar 2019 04:53:27 +0300 (MSK) Original-Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ufvm14v6Tv-rR84dAu6; Sat, 16 Mar 2019 04:53:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1552701207; bh=9lUR9M7v/84CUlxU8AIbGnwehG61E87WqZrDVLFfUxw=; h=Subject:To:From:Date:Message-Id; b=cR4ddTBVi7cjxGy2BdlsfZay7qIJsRTPe4wu3D0tfYCkk3JI+OT4bWTHP2P4F6viW IRXzbmT0i1ZG2OT8CetPhAxh3oRwpqrAE2AZcNg8Vji6x1F+py5JUMdWdkW9Vlrpdy BCp53oDh95Wqx/lqu7cQ4oQ+xSSqeJe4k+Urq+IY= Authentication-Results: mxback15g.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id hzxBGO16Wk-rRXGBXOn; Sat, 16 Mar 2019 04:53:27 +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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:6b8:0:1472:2741:0:8b7:101 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:234195 Archived-At: --- lisp/progmodes/etags.el | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index c2715be5370..05dc7aa1baf 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1351,7 +1351,7 @@ etags-goto-tag-location hits the start of file." (let ((startpos (cdr (cdr tag-info))) (line (car (cdr tag-info))) - offset found pat) + offset pat) (if (eq (car tag-info) t) ;; Direct file tag. (cond (line (progn (goto-char (point-min)) @@ -1363,7 +1363,6 @@ etags-goto-tag-location ;; since just going around the loop once probably ;; costs about as much as searching 2000 chars. (setq offset 1000 - found nil pat (concat (if (eq selective-display t) "\\(^\\|\^m\\)" "^") (regexp-quote (car tag-info)))) @@ -1385,19 +1384,16 @@ etags-goto-tag-location (point))))) (or startpos (setq startpos (point-min))) - ;; First see if the tag is right at the specified location. + (goto-char startpos) - (setq found (looking-at pat)) - (while (and (not found) - (progn - (goto-char (- startpos offset)) - (not (bobp)))) - (setq found - (re-search-forward pat (+ startpos offset) t) - offset (* 3 offset))) ; expand search window - (or found - (re-search-forward pat nil t) - (user-error "Rerun etags: `%s' not found in %s" + (or (looking-at pat) ; Is tag at the specified location? + (while (progn + (goto-char (- startpos offset)) + (and (not (bobp)) + (not (re-search-forward pat (+ startpos offset) = t)))) + (setq offset (* 3 offset))) ; expand search window + (re-search-forward pat nil t) + (user-error "Rerun etags: `%s' not found in %s" pat buffer-file-name))) ;; Position point at the right place ;; if the search string matched an extra Ctrl-m at the beginning. --=20 2.21.0