]> git.eshelyaron.com Git - emacs.git/commitdiff
Make 't' in bs-mode be more defensive
authorJuanma Barranquero <lekktu@gmail.com>
Thu, 10 Nov 2022 00:31:22 +0000 (01:31 +0100)
committerJuanma Barranquero <lekktu@gmail.com>
Thu, 10 Nov 2022 00:31:22 +0000 (01:31 +0100)
* 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

index aabc2dc5583f6bc95edfd4b90eaeae9354899844..060bae6fdd82f62f5dd4d3d7b7bf97a91f384662 100644 (file)
@@ -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."