From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: Bob Rogers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Feb 2022 21:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 54133@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164565223827677 (code B ref -1); Wed, 23 Feb 2022 21:38:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2022 21:37:18 +0000 Received: from localhost ([127.0.0.1]:46726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMzK2-0007CL-84 for submit@debbugs.gnu.org; Wed, 23 Feb 2022 16:37:18 -0500 Received: from lists.gnu.org ([209.51.188.17]:53194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMzK0-0007CC-8h for submit@debbugs.gnu.org; Wed, 23 Feb 2022 16:37:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMzK0-00035T-3B for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 16:37:16 -0500 Received: from [2607:f8b0:4864:20::72b] (port=36481 helo=mail-qk1-x72b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMzJy-00011a-2U for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 16:37:15 -0500 Received: by mail-qk1-x72b.google.com with SMTP id g24so243825qkl.3 for ; Wed, 23 Feb 2022 13:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rgrjr-com.20210112.gappssmtp.com; s=20210112; h=from:mime-version:content-transfer-encoding:message-id:date:to :subject; bh=1VFQ61LWoKI+zmWTC+i5ePp+uttCVwA0t65Y1SfnAe0=; b=yNZNGQBYIFP1m+p6juBp/DDNgSBc+L7TgGGj+BRMTTqxQ9x4c0ru80obZeJ/Cc6Z70 8TfDDPUPD11Nkp/qoy+izqdlOSAgJtYEHdzaf8/VSUcRBd0RVt9o7lGwQPX8zRLK2c2t JKjnAqTIRsjUd5BHyQCl4IrMHNYXs2L+I7FqgQUkxQaN79YeuEFEcJJ2l80R04C55ZMs p62N05PlKQBgzcWCeRHrWfSbn7kJOpKPS6xpSrbss9cLa4o8A4ttnqNSN/KDCWLb8H15 FAS0xtQtnv9mvc/31j+gSBW54/B/SEdNCQfYfk7jdXjeDaaVgGk6vRHjGOVTN8UtCpmr SSiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:content-transfer-encoding :message-id:date:to:subject; bh=1VFQ61LWoKI+zmWTC+i5ePp+uttCVwA0t65Y1SfnAe0=; b=0VHYyTD6qvcUyT5lpBMhJnD0ZdNd9KOJ+/pIyCTogs8Qy9bwyo92lxofjnI7c92XAl wLHrMas3M4WkMrmWG3USxHvdAwibFE/uoau3oPH560JWSQPAKXGGEPFNtDuFJljZEa5e jbkN4un3R7GbkDEa4yQLyOGoWW2Go5G5+CeFHschf5UAF0FsdOYgJPhGjgiYAIHtrHgQ IL5D05S44oAHh4A2+8RwsDm98E+6neAXDyMYJplj6dKvny0qxh8bp6/jeCY38WPo6Vr4 VBMwQ8nEDfU3xe+3VsTrAyWZqQTdm2l+1gSIWAFtUQrQ9b7O/rRM16qw0o/jwEcIY5L3 NQIg== X-Gm-Message-State: AOAM530H3xwu13mVALtZutYrldgK83Nglb81Vl9e33yaUTGpa82cFgcu 4IK+23N5F6DMBEo7EI2SuZx9iIp5IFzFqRpx X-Google-Smtp-Source: ABdhPJz3kp60cjt1uvaoaShyce2tOU4dWOLri9F4a1bYAGsipyOIv7Mlbdo1ABUzYB+OCewSW0L29Q== X-Received: by 2002:a05:620a:48d:b0:47e:17f5:a33f with SMTP id 13-20020a05620a048d00b0047e17f5a33fmr1155998qkr.727.1645652232837; Wed, 23 Feb 2022 13:37:12 -0800 (PST) Received: from orion.rgrjr.com ([2601:19c:4600:3270::c]) by smtp.gmail.com with ESMTPSA id k5sm357947qkk.82.2022.02.23.13.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 13:37:12 -0800 (PST) From: Bob Rogers MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rKtjf8ESkA" Content-Transfer-Encoding: 7bit Message-ID: <25110.43271.146078.920965@orion.rgrjr.com> Date: Wed, 23 Feb 2022 16:37:11 -0500 X-Mailer: VM 7.19 under Emacs 29.0.50 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::72b (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::72b; envelope-from=rogers@rgrjr.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --rKtjf8ESkA Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-02-19 built on orion Repository revision: 563bb08c5998f82e034a0aa1b48dce29fb9bc375 Repository branch: rgr-smtpmail-env-from Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 System Description: openSUSE Leap 15.3 Configured using: 'configure --with-dbus=no --with-gsettings=no --with-gif=ifavailable --with-tiff=no --with-gnutls=yes --with-gconf=no' Configured features: ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB To reproduce: In master ecaedf2117cb015ad4028e4d6fc7058608c98096: 1. "emacs -Q &" 2. Visit pretty much any random file that is NOT a tags file; for this purpose, lisp/abbrev.el from the source tree will do nicely. 3. Type "C-x C-b" to get the "*Buffer List*" window to appear. 4. Type "C-x o" to move the to the buffer list, then move to the abbrev.el line, and type "t" to invoke Buffer-menu-visit-tags-table on it (which I seem to do accidentally more often than I care to admit). This produces the error message: user-error: File /scratch/rogers/emacs/lisp/abbrev.el is not a valid tags table but the abbrev.el buffer is left in tags-table-mode, and any undo information is thrown away. The attached patch addresses the problem in a straightforward way by making Buffer-menu-visit-tags-table prompt the user for buffers not already in tags-table-mode. The real problem is that visit-tags-table assumes that the user knows what they're doing, and makes these irreversible changes before being sure of having a valid tags table. That would be a harder thing to fix, though -- and might not deal as well with my buffer-menu typos. ;-} -- Bob Rogers http://www.rgrjr.com/ --rKtjf8ESkA Content-Type: text/x-patch Content-Description: Content-Disposition: inline; filename="0001-Make-Buffer-menu-visit-tags-table-more-circumspect.patch" Content-Transfer-Encoding: quoted-printable =46rom 05d2d1855cddc8d5c310d718c07d91ae861b8436 Mon Sep 17 00:00:00 2001 From: Bob Rogers Date: Wed, 23 Feb 2022 16:23:17 -0500 Subject: [PATCH] Make Buffer-menu-visit-tags-table more circumspect * lisp/buff-menu.el: + (Buffer-menu-visit-tags-table): Ask before visit-tags-table on a buffer not already in tags-table-mode, lest it destroy state. --- lisp/buff-menu.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 50c2c155ca..0bed539008 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -530,10 +530,21 @@ Buffer-menu-multi-occur (defun Buffer-menu-visit-tags-table () "Visit the tags table in the buffer on this line. See `visit-tags-t= able'." (interactive nil Buffer-menu-mode) - (let ((file (buffer-file-name (Buffer-menu-buffer t)))) - (if file -=09(visit-tags-table file) - (error "Specified buffer has no file")))) + (let* ((buffer (Buffer-menu-buffer t)) + (file (buffer-file-name buffer))) + (or file + (error "Specified buffer has no file")) + ;; Ensure that it's really a tags file buffer (or the user at + ;; least believes it should be). Otherwise, visit-tags-table will= + ;; change the mode and discard any undo information. + (if (not (or (eq (with-current-buffer buffer + major-mode) + 'tags-table-mode) + (yes-or-no-p + (format "%s is not a tags table; visit as such anywa= y=3F " + buffer)))) + (error "Aborted.")) + (visit-tags-table file))) =20 (defun Buffer-menu-1-window () "Select this line's buffer, alone, in full frame." --=20 2.34.1 --rKtjf8ESkA-- From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 09:20:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Bob Rogers , 54133@debbugs.gnu.org Received: via spool by 54133-submit@debbugs.gnu.org id=B54133.16456943804472 (code B ref 54133); Thu, 24 Feb 2022 09:20:04 +0000 Received: (at 54133) by debbugs.gnu.org; 24 Feb 2022 09:19:40 +0000 Received: from localhost ([127.0.0.1]:47519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNAHk-0001A3-25 for submit@debbugs.gnu.org; Thu, 24 Feb 2022 04:19:40 -0500 Received: from mout.gmx.net ([212.227.17.20]:53093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNAHi-00019q-Ou for 54133@debbugs.gnu.org; Thu, 24 Feb 2022 04:19:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645694372; bh=R7JQjYW71JoDtYWGITg7Cvwm4DrQyvjsx7o0rxWBENY=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=Mln/bGBpjg5AO5D+uAifN5UlOiDofrlbJI+SG6IiPlv5N2PT2mOHoAj44tagg/U0M 6YOs4zAyI2uffeBNKa2R7vV8FAQJBsy1mPwwg9mQe3H+UN5OcffAb/8g2FBgTCS+G8 gGffGMQnceaxud55g7haPV0q9QdcoanGKqHgyOR8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([212.95.5.227]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Msq6C-1oGDmO1zr6-00tEEF; Thu, 24 Feb 2022 10:19:32 +0100 Message-ID: Date: Thu, 24 Feb 2022 10:19:31 +0100 MIME-Version: 1.0 Content-Language: en-US References: <25110.43271.146078.920965@orion.rgrjr.com> From: martin rudalics In-Reply-To: <25110.43271.146078.920965@orion.rgrjr.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:j0LQ8YV0Hqy60kdlrjyGEl/C5gPx2fPl/UhsBg14pbPhRKOInmA 8bSV0AQa45RoXXYQlYDCeQ9+uX43oO6kawUqt6S6H2yeckjw22R6vM8oSLxAtEYXAkEbbC2 bdMfBOaXcEMwmA/euVJ8QAU3xxWnVtRmxAwxTcNW6WmtnYlcnbuOY+2/BpMPolZ4O3vM85J a5Gko7BfYvuPKX5hOcpGg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:moLjfRSXScw=:Rvxgggnv0MAGm5gT5urbkb Jnxf+lh9pBdZMkeqYnszFCDxGsQzcGdvYlDfZy9bQmtqa/YMQdxhJBthTQkd+agTM56ni7FcH E9SufWFt4/L6YqCXexhpLoIgIIQ8xinTbg67F6XEI3GNWpGvkkQL7icdLMhRLcqTkNEbYMdJj F5InJ3irmoM7bwGV6vj7Ol1A+TaHap1PMPJFWHswJd4dh9y02d3j/NsgC9T3V0HUUH0oa/ERk yPoPdl4NliC+y1D3yeG3wiKM/fnjyAxv01XESpAIMbmWNtqVKpZc9bFfgnjF+9C8axYFzqZMw VJ8myEuCQ29iqV/cisGakbdLtf9shHh1pS5NYSmXWrTVH1ceJHuZ024SWHlZnMo7ApLhRGtKh yFC6zPzxN0vJZ9KkZ95kloXRQHUEdwqGtxPc/a0vOtaGpkToUe9nLGiw4XoK7InIyetgMXgXv NOZF7mZHIC6zJpLmkOjMBJJMyjY9TGq2ALQ5VoDXKis1w5NigktKgZtL6zKUbghngSBYpG+VV LdTm+B2rSaemSt63MoF6xZvUNssBwLZW+nlD9G8v6hRDsH7BBXkoHzWzEhhEl5lzu0jq0GX7k JjpPD883gaPKDiUt645+YsrxVO+hT+G+juDw4wbwGimnC8IkjQoLDYRxTfHTY3SNOxCiHPYCN z+GT3wGt+EZK3JjZX3tw0U52Mt+8wOG7UbA1Rwc8+fUUpCQZ1KGOYrYPcusZvf/VIqHt1IPc+ Wq7fY9YJ2k+YuYGg6YRkdi2S1Awe8SZdn8E2NkWfxECqyxbk6/uawQ4m1jdAj8R9WFbGLGhuv 69mspYGHwC4qNTyP9gtcGRTSiGPTihTao9FiKiDxhl/VXUevr/kuTX6qRMTfxofaxczXdkZEP +37lXt1R4fHrMHUuJhYTqN7AIJFd5/QTYUJONFuD1nJCPLkvIQsF2NDVa7694bviTcC+cBT5q fAAcOTVPwY36IW747kvqa8q6xYXsruKG9rLY3b9tRkXi+UnoxuH2jgtXiM2HiBJeFjv+TopzJ iA5ko9GMu+FEWKYVtXSUQeZ74MvFXvSayxIIY+vW4jUN2Ejk2W7aA6XBsot/mGjwF/HwQc2xt S0wh8fU/oOARoA= X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) ID4gICAgIFRoZSByZWFsIHByb2JsZW0gaXMgdGhhdCB2aXNpdC10YWdzLXRhYmxlIGFzc3Vt ZXMgdGhhdCB0aGUgdXNlciBrbm93cw0KID4gd2hhdCB0aGV5J3JlIGRvaW5nLCBhbmQgbWFr ZXMgdGhlc2UgaXJyZXZlcnNpYmxlIGNoYW5nZXMgYmVmb3JlIGJlaW5nDQogPiBzdXJlIG9m IGhhdmluZyBhIHZhbGlkIHRhZ3MgdGFibGUuICBUaGF0IHdvdWxkIGJlIGEgaGFyZGVyIHRo aW5nIHRvIGZpeCwNCiA+IHRob3VnaCAtLSBhbmQgbWlnaHQgbm90IGRlYWwgYXMgd2VsbCB3 aXRoIG15IGJ1ZmZlci1tZW51IHR5cG9zLiAgOy19DQoNCklJVUMgdGhlIHByb2JsZW0gaXMg dGhhdCDigJh0YWdzLXZlcmlmeS10YWJsZScgY2FsbHMgJ3RhZ3MtdGFibGUtbW9kZScNCmZp cnN0IGFuZCAndmVyaWZ5LXRhZ3MtdGFibGUtZnVuY3Rpb24nIGFmdGVyd2FyZHMuDQoNCm1h cnRpbg0KDQoNCg0KDQo= From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 15:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Bob Rogers Cc: 54133@debbugs.gnu.org Received: via spool by 54133-submit@debbugs.gnu.org id=B54133.16457157522352 (code B ref 54133); Thu, 24 Feb 2022 15:16:02 +0000 Received: (at 54133) by debbugs.gnu.org; 24 Feb 2022 15:15:52 +0000 Received: from localhost ([127.0.0.1]:50149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNFqS-0000bs-Ay for submit@debbugs.gnu.org; Thu, 24 Feb 2022 10:15:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNFqQ-0000bd-QH for 54133@debbugs.gnu.org; Thu, 24 Feb 2022 10:15:51 -0500 Received: from [2001:470:142:3::e] (port=43426 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNFqL-0003sn-DM; Thu, 24 Feb 2022 10:15:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DOOXMWjsm5WQAhdeEMezLt5St37wEUpx3FHW9BTt19A=; b=FOppDSudY7hn nYU10+5FKeWtOUMOPYcFSXQa6obpc5ZeUvyRgaNN7pnjeNpcJWZnUJsM/ugS73qOBV0LTS4h/64qo YLA91u6Xp/2hMBNwwwuOWXbOE8Pnv5DjxB/2kQxmBte7pJlyZ3gTaflAr+jArTJkYW7Uzgp1T3SO4 t/Q/vDUSQAVRlivzbj2XpbcUGmW0f2jFOVniE/PSwPSeOBuxrvjznh0UdhophHdlmu7m7h8R4Agn5 feKIBmZliLy6TxN1fFyPFOw2dOMHwcVXSTOhAkDiXhz0C3CrOjsRIrfUk7I8wgY4h4pN8dxJCVCBt TYDY1HNJXQ3OvhRkSLLJ/Q==; Received: from [87.69.77.57] (port=2090 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNFqI-0001yl-08; Thu, 24 Feb 2022 10:15:45 -0500 Date: Thu, 24 Feb 2022 17:15:54 +0200 Message-Id: <8335k8s3bp.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <25110.43271.146078.920965@orion.rgrjr.com> (message from Bob Rogers on Wed, 23 Feb 2022 16:37:11 -0500) References: <25110.43271.146078.920965@orion.rgrjr.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Bob Rogers > Date: Wed, 23 Feb 2022 16:37:11 -0500 > > 1. "emacs -Q &" > > 2. Visit pretty much any random file that is NOT a tags file; for > this purpose, lisp/abbrev.el from the source tree will do nicely. > > 3. Type "C-x C-b" to get the "*Buffer List*" window to appear. > > 4. Type "C-x o" to move the to the buffer list, then move to the > abbrev.el line, and type "t" to invoke Buffer-menu-visit-tags-table on > it (which I seem to do accidentally more often than I care to admit). > This produces the error message: > > user-error: File /scratch/rogers/emacs/lisp/abbrev.el is not a valid tags table > > but the abbrev.el buffer is left in tags-table-mode, and any undo > information is thrown away. > > The attached patch addresses the problem in a straightforward way by > making Buffer-menu-visit-tags-table prompt the user for buffers not > already in tags-table-mode. > > The real problem is that visit-tags-table assumes that the user knows > what they're doing, and makes these irreversible changes before being > sure of having a valid tags table. That would be a harder thing to fix, > though -- and might not deal as well with my buffer-menu typos. ;-} Does the alternative patch below give good results? diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 50c2c15..179cc54 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -527,13 +527,18 @@ Buffer-menu-multi-occur (multi-occur (Buffer-menu-marked-buffers) regexp nlines)) +(autoload 'etags-verify-tags-table "etags") (defun Buffer-menu-visit-tags-table () "Visit the tags table in the buffer on this line. See `visit-tags-table'." (interactive nil Buffer-menu-mode) - (let ((file (buffer-file-name (Buffer-menu-buffer t)))) - (if file - (visit-tags-table file) - (error "Specified buffer has no file")))) + (let* ((buf (Buffer-menu-buffer t)) + (file (buffer-file-name buf))) + (cond + ((not file) (error "Specified buffer has no file")) + ((and buf (with-current-buffer buf + (etags-verify-tags-table))) + (visit-tags-table file)) + (t (error "Specified buffer is not a tags-table"))))) (defun Buffer-menu-1-window () "Select this line's buffer, alone, in full frame." From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: Bob Rogers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 17:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 54133@debbugs.gnu.org Received: via spool by 54133-submit@debbugs.gnu.org id=B54133.164572386217397 (code B ref 54133); Thu, 24 Feb 2022 17:32:01 +0000 Received: (at 54133) by debbugs.gnu.org; 24 Feb 2022 17:31:02 +0000 Received: from localhost ([127.0.0.1]:50272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNHxG-0004WW-2k for submit@debbugs.gnu.org; Thu, 24 Feb 2022 12:31:02 -0500 Received: from mail-qk1-f181.google.com ([209.85.222.181]:43621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNHxE-0004W2-DA for 54133@debbugs.gnu.org; Thu, 24 Feb 2022 12:31:00 -0500 Received: by mail-qk1-f181.google.com with SMTP id z66so2395746qke.10 for <54133@debbugs.gnu.org>; Thu, 24 Feb 2022 09:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rgrjr-com.20210112.gappssmtp.com; s=20210112; h=from:mime-version:content-transfer-encoding:message-id:date:to:cc :subject:in-reply-to:references; bh=ab9rJA4CtRELjo2XTRLyvHNd9vUNHph3XkcirUBWk+w=; b=4pVqVTlR4dJlzGsH96RtZO4YLiP7Fmx47LHpg/G/DiOXNEPmo6/H2Kl6VgovzqjdOv ozeT2UN4coaQm4PwkOguXwC272zIycswWpXdugToupeFf1V6NNwHfzFZOuHVM7/30xqM UF4CK5CawOdim6YzZqc/LRRbR/vSOg1XSdgvUmIgohrxN+Bwqv/kwt2ts3OtL8szR8f9 SHfJGi/tsuBaBuGcmIFsJhD2Ql3tSs6Vnzr0ekkC2fm9VHzLtALO6I5kgci9jTMrqGKV 1l3zyAsw4+0JFb830Vul0spHV928rThtnmBxPY5AB5v/gRH+1vnVk1pze7HbwUZeG8pl V/yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:content-transfer-encoding :message-id:date:to:cc:subject:in-reply-to:references; bh=ab9rJA4CtRELjo2XTRLyvHNd9vUNHph3XkcirUBWk+w=; b=kmgElyb3QCAnzIg0o1dcbxKpc+9qBVFJyxU6Wd6HblkznxKeTeQtvkW2e+qcVur0Ne 9S9taJ41Z1XR13eTaOTv6EHpeso1LjzHSALY8vTt4Z4ZmtlWRX0NaMDTCt/6gE6QKdwS Ais32PG1Ui0wVhIX/cPn/XHKxovDGZ7KMCdixzG+ObwIuYf+A7c5+ABg82Ncn7kXhJsp SjqYaYHOLlfeMooZR31PE7Z+JsyJPpk0h+wiIS1NWUBbViyqkGJKE9gnArbSswqDyExR UUYOlGXUpIte8HfC8jyzq/h322FhlNWjc26LCfpItQpnogvPs6qpaULEEbKpuqRsNX+z 19YA== X-Gm-Message-State: AOAM530P3cxh5fR2qlCG50QSwI+cm1kNWCR460gizck9UXD8yprVFek6 pBQdfijQcLhQT0fOjVhK3FEBCeopPo/Gru5X X-Google-Smtp-Source: ABdhPJwgdZzXd8E/LxkMWtbiIUVXTBZ+YlrYx3eA48aVLv2z+TTzfr4E5AFGw5tlxnygZb07A35CvA== X-Received: by 2002:a05:620a:148d:b0:47d:8d4b:5070 with SMTP id w13-20020a05620a148d00b0047d8d4b5070mr2429113qkj.726.1645723854757; Thu, 24 Feb 2022 09:30:54 -0800 (PST) Received: from orion.rgrjr.com ([2601:19c:4600:3270::c]) by smtp.gmail.com with ESMTPSA id u12sm2067131qta.76.2022.02.24.09.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 09:30:54 -0800 (PST) From: Bob Rogers MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <25111.49357.417530.307552@orion.rgrjr.com> Date: Thu, 24 Feb 2022 12:30:53 -0500 In-Reply-To: <8335k8s3bp.fsf@gnu.org> References: <25110.43271.146078.920965@orion.rgrjr.com> <8335k8s3bp.fsf@gnu.org> X-Mailer: VM 7.19 under Emacs 29.0.50 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) From: Eli Zaretskii Date: Thu, 24 Feb 2022 17:15:54 +0200 > From: Bob Rogers > Date: Wed, 23 Feb 2022 16:37:11 -0500 > > . . . > > The real problem is that visit-tags-table assumes that the user knows > what they're doing, and makes these irreversible changes before being > sure of having a valid tags table. That would be a harder thing to fix, > though -- and might not deal as well with my buffer-menu typos. ;-} Does the alternative patch below give good results? This does ineed work, and I had considered something similar, but was concerned that it would not be as robust. etags-verify-tags-table is called from etags-recognize-tags-table, which is only a part of the tags-table-format-functions extension mechanism used by initialize-new-tags-table. So to avoid breaking this mechanism I would either have had to call initialize-new-tags-table and have it possibly set unwanted local variables, or delve more deeply into the internals by running tags-table-format-functions myself. In short, I thought checking the major mode was the better choice, since the file was already present in a buffer. -- Bob From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 17:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Bob Rogers Cc: 54133@debbugs.gnu.org Received: via spool by 54133-submit@debbugs.gnu.org id=B54133.164572452918594 (code B ref 54133); Thu, 24 Feb 2022 17:43:02 +0000 Received: (at 54133) by debbugs.gnu.org; 24 Feb 2022 17:42:09 +0000 Received: from localhost ([127.0.0.1]:50323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNI81-0004pq-03 for submit@debbugs.gnu.org; Thu, 24 Feb 2022 12:42:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNI7y-0004pK-UR for 54133@debbugs.gnu.org; Thu, 24 Feb 2022 12:42:07 -0500 Received: from [2001:470:142:3::e] (port=47764 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNI7t-0001tn-Hu; Thu, 24 Feb 2022 12:42:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KvzJFq2qcSSQQEV48164od5D7zaANd2UTVUz2SkygWI=; b=LJRx8Qpiq4aP YCsTnwprLDqWmCDPipIIK6hFIRO8/pFF7Mz9mcTgc6qE1F0yoni0s3QyFp+U1AXzgUfa+Jyrk3TDw OUPLIxB2Xl7L3in7uLyGDdqkKBYL5g+VOaiCp3sxCCRpU4mWGJICNe0L/gi/TcD+fBVTSrblxVgFt w8Cxptsup82jqr7Iu6UWD1NJxIS79yyuiC/khbsbemQX9uhw3NKMeIui+2tgebkZ0nz7LwK58ynWH MwhorcOqrMjiBGBsnzOvIzzce+KQE1h0Ag5JDDN2XVPB8J/t/nKbcMBBjls5VcqpsUoKdPD044wfz v8BPdePlAn0Kyvb7gTW1Qw==; Received: from [87.69.77.57] (port=3262 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNI7t-0007Zc-0u; Thu, 24 Feb 2022 12:42:01 -0500 Date: Thu, 24 Feb 2022 19:42:14 +0200 Message-Id: <83zgmgqhzd.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <25111.49357.417530.307552@orion.rgrjr.com> (message from Bob Rogers on Thu, 24 Feb 2022 12:30:53 -0500) References: <25110.43271.146078.920965@orion.rgrjr.com> <8335k8s3bp.fsf@gnu.org> <25111.49357.417530.307552@orion.rgrjr.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Bob Rogers > Date: Thu, 24 Feb 2022 12:30:53 -0500 > Cc: 54133@debbugs.gnu.org > > From: Eli Zaretskii > Date: Thu, 24 Feb 2022 17:15:54 +0200 > > > From: Bob Rogers > > Date: Wed, 23 Feb 2022 16:37:11 -0500 > > > > . . . > > > > The real problem is that visit-tags-table assumes that the user knows > > what they're doing, and makes these irreversible changes before being > > sure of having a valid tags table. That would be a harder thing to fix, > > though -- and might not deal as well with my buffer-menu typos. ;-} > > Does the alternative patch below give good results? > > This does ineed work, and I had considered something similar, but was > concerned that it would not be as robust. etags-verify-tags-table is > called from etags-recognize-tags-table, which is only a part of the > tags-table-format-functions extension mechanism used by > initialize-new-tags-table. So to avoid breaking this mechanism I would > either have had to call initialize-new-tags-table and have it possibly > set unwanted local variables, or delve more deeply into the internals by > running tags-table-format-functions myself. Maybe we should have a more thorough implementation in etags-verify-tags-table, then. But that function's purpose is to do what we need here. > In short, I thought checking the major mode was the better choice, > since the file was already present in a buffer. But what if the file is already in a buffer, but not under the right major-mode? E.g., what if the file was visited literally? From unknown Sun Jun 22 07:51:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers Resent-From: Bob Rogers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 18:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 54133@debbugs.gnu.org Received: via spool by 54133-submit@debbugs.gnu.org id=B54133.164572576920595 (code B ref 54133); Thu, 24 Feb 2022 18:03:01 +0000 Received: (at 54133) by debbugs.gnu.org; 24 Feb 2022 18:02:49 +0000 Received: from localhost ([127.0.0.1]:50339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNIS0-0005M7-L9 for submit@debbugs.gnu.org; Thu, 24 Feb 2022 13:02:48 -0500 Received: from mail-qt1-f181.google.com ([209.85.160.181]:40820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNIRy-0005Lt-N2 for 54133@debbugs.gnu.org; Thu, 24 Feb 2022 13:02:47 -0500 Received: by mail-qt1-f181.google.com with SMTP id t28so191134qtc.7 for <54133@debbugs.gnu.org>; Thu, 24 Feb 2022 10:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rgrjr-com.20210112.gappssmtp.com; s=20210112; h=from:mime-version:content-transfer-encoding:message-id:date:to:cc :subject:in-reply-to:references; bh=2VZ62R9Yq4w9cpBDcruX6XOjpK0HCrKrsTDrCXTBNQc=; b=WrwYXhgfCOIhBeCaQOpXV+nXWcP+WwgZbqsmwu04rKhmCS/SJoC4ib6sMfjEtCqzxf T6b3r2qGiktgdrOjL2baZCC3RBWNJQR3JDAXL4fV83cH0hbKCqoS6k4O1jtUrpQf7nMA El/y9KE3B0ZSfK+FvnCqDyxP8zs7tlP+/TOZJFVXFkCugWlB8lZYhCC0+UxCogzJVlDl Jk23fKuJigpkFvU3aogTZfvoek4XwsdUL9+VV4ETFQwJ0VHoio3APqgrJoSmCHM2EI84 fulkWgsrlo04DzqZN6Zzb/f/XJikIZ23J/SaCMknGJtzQB59GMfql3iL6ZiiC5Bsy8yo 5y9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:content-transfer-encoding :message-id:date:to:cc:subject:in-reply-to:references; bh=2VZ62R9Yq4w9cpBDcruX6XOjpK0HCrKrsTDrCXTBNQc=; b=cgrCWXfaL+C+BENSeTD7qt/G1vQamJPLit1n/WtSTUXXP0BZft+Sx/ZEU+qej+APlr FTOaS8QeYHFnXQQvUhHRvCLHbLKTAf0rFdxP2ywpqVrAQgDLIht9BCqe63sYxtVZZ/d4 yenJwvDB9jcxMMyK9Oun/n/KWjgIGjf2JhE4Yy7jFC+8ULREPJNckk7t+RkBogQ5g2Ft rGT9rfRIB1Se2ocyy0crlUKG8xOTEFEXQYD4xZvgFZvoSLmvQoL0ME5aKZOOakJlIXjn pMw+bD2TyDzt4jo05zM4l3F3dRGmylhnZRY1OqY1G+1UJQRDRKEeLZnxbl2wf0pCggwt DaCQ== X-Gm-Message-State: AOAM532lzv3HE5bxTj1s30CC433E4TyzemOOWqbaa7YheBkbvlW44Glz qVIO2sGImy+kvmkF2kbJAibUlc+5+T3xmsQk X-Google-Smtp-Source: ABdhPJynvtCRiut665dBkdcZtGlNM67ntwqfhW0uHkwWMCdnf72/nTKtw7oTx4Lew80V5FS1qaI8dg== X-Received: by 2002:ac8:5bcc:0:b0:2dd:d673:e596 with SMTP id b12-20020ac85bcc000000b002ddd673e596mr3512781qtb.553.1645725761226; Thu, 24 Feb 2022 10:02:41 -0800 (PST) Received: from orion.rgrjr.com ([2601:19c:4600:3270::c]) by smtp.gmail.com with ESMTPSA id h11-20020a05620a21cb00b005089fdd033bsm148674qka.39.2022.02.24.10.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 10:02:40 -0800 (PST) From: Bob Rogers MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <25111.51264.11851.407727@orion.rgrjr.com> Date: Thu, 24 Feb 2022 13:02:40 -0500 In-Reply-To: <83zgmgqhzd.fsf@gnu.org> References: <25110.43271.146078.920965@orion.rgrjr.com> <8335k8s3bp.fsf@gnu.org> <25111.49357.417530.307552@orion.rgrjr.com> <83zgmgqhzd.fsf@gnu.org> X-Mailer: VM 7.19 under Emacs 29.0.50 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) From: Eli Zaretskii Date: Thu, 24 Feb 2022 19:42:14 +0200 > From: Bob Rogers > Date: Thu, 24 Feb 2022 12:30:53 -0500 > > . . . > > This does ineed work, and I had considered something similar, but > was concerned that it would not be as robust . . . Maybe we should have a more thorough implementation in etags-verify-tags-table, then. But that function's purpose is to do what we need here. That would require disentangling detection and initialization. Which shouldn't be all that hard; it just seemed like more work than necessary to scratch this particular itch. > In short, I thought checking the major mode was the better choice, > since the file was already present in a buffer. But what if the file is already in a buffer, but not under the right major-mode? E.g., what if the file was visited literally? Ah, so you mean that Buffer-menu-visit-tags-table is normally meant to introduce tags-table-mode in buffers not already there. I see now that is implied by "Visit the tags table ..." in the command documentation. In which case I withdraw my reservations. And maybe I'll have a look at cleaning up etags initialization when I get a chance . . . -- Bob From unknown Sun Jun 22 07:51:45 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Bob Rogers Subject: bug#54133: closed (Re: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers) Message-ID: References: <83v8x4qbkx.fsf@gnu.org> <25110.43271.146078.920965@orion.rgrjr.com> X-Gnu-PR-Message: they-closed 54133 X-Gnu-PR-Package: emacs Reply-To: 54133@debbugs.gnu.org Date: Thu, 24 Feb 2022 20:01:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1645732862-7972-1" This is a multi-part message in MIME format... ------------=_1645732862-7972-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 54133@debbugs.gnu.org. --=20 54133: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D54133 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1645732862-7972-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 54133-done) by debbugs.gnu.org; 24 Feb 2022 20:00:30 +0000 Received: from localhost ([127.0.0.1]:50479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNKHu-00023k-8b for submit@debbugs.gnu.org; Thu, 24 Feb 2022 15:00:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNKHs-00023X-Ry for 54133-done@debbugs.gnu.org; Thu, 24 Feb 2022 15:00:29 -0500 Received: from [2001:470:142:3::e] (port=50584 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNKHn-0000A7-F5; Thu, 24 Feb 2022 15:00:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Kg29+iTsC7afIfTbQ1EkQWzZTGbdU8fpeTe5Tuh8bM4=; b=Sij8ZNpzFwIQ b4fIAAYl/p9Tv7KlrxjogJAfKkmQNX4idjJokTDveZagD9fHXduIVwK5fmCVA16ENP/pdCBdO6tH9 23ALHktdVmdsCvmLMXCon6UoPTXdITOfo8+GYscbVf5OQKW4cCfy35FM0WLr2mljjj8j1gVpdYi8l Fe5JKrqfrYUhBdKbSqkHgQoIl75xbeyKwmYpx5czb+RD2RFj/BpC/hwuDQJw9h//0GKpHXnxh/8KX G/if+xjltGXFWyTmSfGt5qKZsPqBzQLgbeON4AjhmkHQ20WJHI9J9aV2BjmJtvmGP6vuy6+Ic8X8A qBzGdoTe/sD3ht7nSi0G+w==; Received: from [87.69.77.57] (port=3825 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNKHm-0005AO-Pw; Thu, 24 Feb 2022 15:00:23 -0500 Date: Thu, 24 Feb 2022 22:00:30 +0200 Message-Id: <83v8x4qbkx.fsf@gnu.org> From: Eli Zaretskii To: Bob Rogers In-Reply-To: <25111.51264.11851.407727@orion.rgrjr.com> (message from Bob Rogers on Thu, 24 Feb 2022 13:02:40 -0500) Subject: Re: bug#54133: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers References: <25110.43271.146078.920965@orion.rgrjr.com> <8335k8s3bp.fsf@gnu.org> <25111.49357.417530.307552@orion.rgrjr.com> <83zgmgqhzd.fsf@gnu.org> <25111.51264.11851.407727@orion.rgrjr.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54133-done Cc: 54133-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Bob Rogers > Date: Thu, 24 Feb 2022 13:02:40 -0500 > CC: 54133@debbugs.gnu.org > > Maybe we should have a more thorough implementation in > etags-verify-tags-table, then. But that function's purpose is to do > what we need here. > > That would require disentangling detection and initialization. Which > shouldn't be all that hard; it just seemed like more work than necessary > to scratch this particular itch. > > > In short, I thought checking the major mode was the better choice, > > since the file was already present in a buffer. > > But what if the file is already in a buffer, but not under the right > major-mode? E.g., what if the file was visited literally? > > Ah, so you mean that Buffer-menu-visit-tags-table is normally meant to > introduce tags-table-mode in buffers not already there. I see now that > is implied by "Visit the tags table ..." in the command documentation. > In which case I withdraw my reservations. Thanks, I installed the changes, and I'm marking this bug done. > And maybe I'll have a look at cleaning up etags initialization when I > get a chance . . . TIA. ------------=_1645732862-7972-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Feb 2022 21:37:18 +0000 Received: from localhost ([127.0.0.1]:46726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMzK2-0007CL-84 for submit@debbugs.gnu.org; Wed, 23 Feb 2022 16:37:18 -0500 Received: from lists.gnu.org ([209.51.188.17]:53194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMzK0-0007CC-8h for submit@debbugs.gnu.org; Wed, 23 Feb 2022 16:37:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMzK0-00035T-3B for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 16:37:16 -0500 Received: from [2607:f8b0:4864:20::72b] (port=36481 helo=mail-qk1-x72b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMzJy-00011a-2U for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 16:37:15 -0500 Received: by mail-qk1-x72b.google.com with SMTP id g24so243825qkl.3 for ; Wed, 23 Feb 2022 13:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rgrjr-com.20210112.gappssmtp.com; s=20210112; h=from:mime-version:content-transfer-encoding:message-id:date:to :subject; bh=1VFQ61LWoKI+zmWTC+i5ePp+uttCVwA0t65Y1SfnAe0=; b=yNZNGQBYIFP1m+p6juBp/DDNgSBc+L7TgGGj+BRMTTqxQ9x4c0ru80obZeJ/Cc6Z70 8TfDDPUPD11Nkp/qoy+izqdlOSAgJtYEHdzaf8/VSUcRBd0RVt9o7lGwQPX8zRLK2c2t JKjnAqTIRsjUd5BHyQCl4IrMHNYXs2L+I7FqgQUkxQaN79YeuEFEcJJ2l80R04C55ZMs p62N05PlKQBgzcWCeRHrWfSbn7kJOpKPS6xpSrbss9cLa4o8A4ttnqNSN/KDCWLb8H15 FAS0xtQtnv9mvc/31j+gSBW54/B/SEdNCQfYfk7jdXjeDaaVgGk6vRHjGOVTN8UtCpmr SSiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:content-transfer-encoding :message-id:date:to:subject; bh=1VFQ61LWoKI+zmWTC+i5ePp+uttCVwA0t65Y1SfnAe0=; b=0VHYyTD6qvcUyT5lpBMhJnD0ZdNd9KOJ+/pIyCTogs8Qy9bwyo92lxofjnI7c92XAl wLHrMas3M4WkMrmWG3USxHvdAwibFE/uoau3oPH560JWSQPAKXGGEPFNtDuFJljZEa5e jbkN4un3R7GbkDEa4yQLyOGoWW2Go5G5+CeFHschf5UAF0FsdOYgJPhGjgiYAIHtrHgQ IL5D05S44oAHh4A2+8RwsDm98E+6neAXDyMYJplj6dKvny0qxh8bp6/jeCY38WPo6Vr4 VBMwQ8nEDfU3xe+3VsTrAyWZqQTdm2l+1gSIWAFtUQrQ9b7O/rRM16qw0o/jwEcIY5L3 NQIg== X-Gm-Message-State: AOAM530H3xwu13mVALtZutYrldgK83Nglb81Vl9e33yaUTGpa82cFgcu 4IK+23N5F6DMBEo7EI2SuZx9iIp5IFzFqRpx X-Google-Smtp-Source: ABdhPJz3kp60cjt1uvaoaShyce2tOU4dWOLri9F4a1bYAGsipyOIv7Mlbdo1ABUzYB+OCewSW0L29Q== X-Received: by 2002:a05:620a:48d:b0:47e:17f5:a33f with SMTP id 13-20020a05620a048d00b0047e17f5a33fmr1155998qkr.727.1645652232837; Wed, 23 Feb 2022 13:37:12 -0800 (PST) Received: from orion.rgrjr.com ([2601:19c:4600:3270::c]) by smtp.gmail.com with ESMTPSA id k5sm357947qkk.82.2022.02.23.13.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 13:37:12 -0800 (PST) From: Bob Rogers MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rKtjf8ESkA" Content-Transfer-Encoding: 7bit Message-ID: <25110.43271.146078.920965@orion.rgrjr.com> Date: Wed, 23 Feb 2022 16:37:11 -0500 To: bug-gnu-emacs@gnu.org Subject: 29.0.50; Buffer-menu-visit-tags-table disrupts non-tags buffers X-Mailer: VM 7.19 under Emacs 29.0.50 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::72b (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::72b; envelope-from=rogers@rgrjr.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --rKtjf8ESkA Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-02-19 built on orion Repository revision: 563bb08c5998f82e034a0aa1b48dce29fb9bc375 Repository branch: rgr-smtpmail-env-from Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 System Description: openSUSE Leap 15.3 Configured using: 'configure --with-dbus=no --with-gsettings=no --with-gif=ifavailable --with-tiff=no --with-gnutls=yes --with-gconf=no' Configured features: ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB To reproduce: In master ecaedf2117cb015ad4028e4d6fc7058608c98096: 1. "emacs -Q &" 2. Visit pretty much any random file that is NOT a tags file; for this purpose, lisp/abbrev.el from the source tree will do nicely. 3. Type "C-x C-b" to get the "*Buffer List*" window to appear. 4. Type "C-x o" to move the to the buffer list, then move to the abbrev.el line, and type "t" to invoke Buffer-menu-visit-tags-table on it (which I seem to do accidentally more often than I care to admit). This produces the error message: user-error: File /scratch/rogers/emacs/lisp/abbrev.el is not a valid tags table but the abbrev.el buffer is left in tags-table-mode, and any undo information is thrown away. The attached patch addresses the problem in a straightforward way by making Buffer-menu-visit-tags-table prompt the user for buffers not already in tags-table-mode. The real problem is that visit-tags-table assumes that the user knows what they're doing, and makes these irreversible changes before being sure of having a valid tags table. That would be a harder thing to fix, though -- and might not deal as well with my buffer-menu typos. ;-} -- Bob Rogers http://www.rgrjr.com/ --rKtjf8ESkA Content-Type: text/x-patch Content-Description: Content-Disposition: inline; filename="0001-Make-Buffer-menu-visit-tags-table-more-circumspect.patch" Content-Transfer-Encoding: quoted-printable =46rom 05d2d1855cddc8d5c310d718c07d91ae861b8436 Mon Sep 17 00:00:00 2001 From: Bob Rogers Date: Wed, 23 Feb 2022 16:23:17 -0500 Subject: [PATCH] Make Buffer-menu-visit-tags-table more circumspect * lisp/buff-menu.el: + (Buffer-menu-visit-tags-table): Ask before visit-tags-table on a buffer not already in tags-table-mode, lest it destroy state. --- lisp/buff-menu.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 50c2c155ca..0bed539008 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -530,10 +530,21 @@ Buffer-menu-multi-occur (defun Buffer-menu-visit-tags-table () "Visit the tags table in the buffer on this line. See `visit-tags-t= able'." (interactive nil Buffer-menu-mode) - (let ((file (buffer-file-name (Buffer-menu-buffer t)))) - (if file -=09(visit-tags-table file) - (error "Specified buffer has no file")))) + (let* ((buffer (Buffer-menu-buffer t)) + (file (buffer-file-name buffer))) + (or file + (error "Specified buffer has no file")) + ;; Ensure that it's really a tags file buffer (or the user at + ;; least believes it should be). Otherwise, visit-tags-table will= + ;; change the mode and discard any undo information. + (if (not (or (eq (with-current-buffer buffer + major-mode) + 'tags-table-mode) + (yes-or-no-p + (format "%s is not a tags table; visit as such anywa= y=3F " + buffer)))) + (error "Aborted.")) + (visit-tags-table file))) =20 (defun Buffer-menu-1-window () "Select this line's buffer, alone, in full frame." --=20 2.34.1 --rKtjf8ESkA-- ------------=_1645732862-7972-1--