emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ef3627508a: Make 't' in bs-mode be more defensive


From: Juanma Barranquero
Subject: master ef3627508a: Make 't' in bs-mode be more defensive
Date: Wed, 9 Nov 2022 19:32:53 -0500 (EST)

branch: master
commit ef3627508a65ee750054622fc4557c42c6589e89
Author: Juanma Barranquero <lekktu@gmail.com>
Commit: Juanma Barranquero <lekktu@gmail.com>

    Make 't' in bs-mode be more defensive
    
    * lisp/bs.el (bs-visit-tags-table): Verify that the
    buffer holds a tags-table file before using it as
    such. This is identical to bug#54133 affecting
    Buffer-menu, and this fix is copied from the one
    by Eli Zaretskii in commit 794fbd1c07 of 2022-02-24.
    Thanks to Bob Rogers <rogers@rgrjr.com> for noticing.
---
 lisp/bs.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/bs.el b/lisp/bs.el
index aabc2dc558..060bae6fdd 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -823,10 +823,14 @@ Leave Buffer Selection Menu."
   "Visit the tags table in the buffer on this line.
 See `visit-tags-table'."
   (interactive)
-  (let ((file (buffer-file-name (bs--current-buffer))))
-    (if file
-       (visit-tags-table file)
-      (error "Specified buffer has no file"))))
+  (let* ((buf (bs--current-buffer))
+         (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 bs-toggle-current-to-show ()
   "Toggle status of showing flag for buffer in current line."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]