emacs-diffs
[Top][All Lists]
Advanced

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

master 3968b36ae06: Fix Semantic tag discovery when loading of unloaded


From: Po Lu
Subject: master 3968b36ae06: Fix Semantic tag discovery when loading of unloaded files is suppressed
Date: Thu, 4 Apr 2024 22:50:12 -0400 (EDT)

branch: master
commit 3968b36ae0641e929426991028b49ce66a15af5f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix Semantic tag discovery when loading of unloaded files is suppressed
    
    * lisp/cedet/semantic/db-find.el
    (semanticdb-find-tags-by-name-method)
    (semanticdb-find-tags-by-name-regexp-method)
    (semanticdb-find-tags-for-completion-method)
    (semanticdb-find-tags-by-class-method)
    (semanticdb-find-tags-external-children-of-type-method)
    (semanticdb-find-tags-subclasses-of-type-method)
    (semanticdb-deep-find-tags-by-name-method)
    (semanticdb-deep-find-tags-by-name-regexp-method)
    (semanticdb-deep-find-tags-for-completion-method): Verify that
    tags is bound before accessing it; this slot is unbound in
    tables created for unloaded files when the `unloaded' throttle
    is disabled.
---
 lisp/cedet/semantic/db-find.el | 44 ++++++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el
index 6d42c3125c0..551f86a792e 100644
--- a/lisp/cedet/semantic/db-find.el
+++ b/lisp/cedet/semantic/db-find.el
@@ -1307,19 +1307,25 @@ associated with that tag should be loaded into a 
buffer."
   "In TABLE, find all occurrences of tags with NAME.
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
-  (semantic-find-tags-by-name name (or tags (semanticdb-get-tags table))))
+  (semantic-find-tags-by-name name
+                              (or tags (and (slot-boundp table 'tags)
+                                            (semanticdb-get-tags table)))))
 
 (cl-defmethod semanticdb-find-tags-by-name-regexp-method ((table 
semanticdb-abstract-table) regexp &optional tags)
   "In TABLE, find all occurrences of tags matching REGEXP.
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
-  (semantic-find-tags-by-name-regexp regexp (or tags (semanticdb-get-tags 
table))))
+  (semantic-find-tags-by-name-regexp regexp
+                                     (or tags (and (slot-boundp table 'tags)
+                                                   (semanticdb-get-tags 
table)))))
 
 (cl-defmethod semanticdb-find-tags-for-completion-method ((table 
semanticdb-abstract-table) prefix &optional tags)
   "In TABLE, find all occurrences of tags matching PREFIX.
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
-  (semantic-find-tags-for-completion prefix (or tags (semanticdb-get-tags 
table))))
+  (semantic-find-tags-for-completion prefix
+                                     (or tags (and (slot-boundp table 'tags)
+                                                   (semanticdb-get-tags 
table)))))
 
 (cl-defmethod semanticdb-find-tags-by-class-method ((table 
semanticdb-abstract-table) class &optional tags)
   "In TABLE, find all occurrences of tags of CLASS.
@@ -1329,8 +1335,12 @@ Returns a table of all matching tags."
   ;; `semantic-find-tags-included', which by default will just call
   ;; `semantic-find-tags-by-class'.
   (if (eq class 'include)
-      (semantic-find-tags-included (or tags (semanticdb-get-tags table)))
-    (semantic-find-tags-by-class class (or tags (semanticdb-get-tags table)))))
+      (semantic-find-tags-included
+       (or tags (and (slot-boundp table 'tags)
+                     (semanticdb-get-tags table))))
+    (semantic-find-tags-by-class class
+                                 (or tags (and (slot-boundp table 'tags)
+                                               (semanticdb-get-tags table))))))
 
 (declare-function semantic-find-tags-external-children-of-type
                  "semantic/find" (type &optional table))
@@ -1340,7 +1350,9 @@ Returns a table of all matching tags."
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
    (require 'semantic/find)
-   (semantic-find-tags-external-children-of-type parent (or tags 
(semanticdb-get-tags table))))
+   (semantic-find-tags-external-children-of-type
+    parent (or tags (and (slot-boundp table 'tags)
+                         (semanticdb-get-tags table)))))
 
 (declare-function semantic-find-tags-subclasses-of-type
                  "semantic/find" (type &optional table))
@@ -1350,7 +1362,9 @@ Returns a table of all matching tags."
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
    (require 'semantic/find)
-   (semantic-find-tags-subclasses-of-type parent (or tags (semanticdb-get-tags 
table))))
+   (semantic-find-tags-subclasses-of-type
+    parent (or tags (and (slot-boundp table 'tags)
+                         (semanticdb-get-tags table)))))
 
 ;;; Deep Searches
 (cl-defmethod semanticdb-deep-find-tags-by-name-method ((table 
semanticdb-abstract-table) name &optional tags)
@@ -1359,7 +1373,10 @@ Search in all tags in TABLE, and all components of top 
level tags in
 TABLE.
 Optional argument TAGS is a list of tags to search.
 Return a table of all matching tags."
-  (semantic-find-tags-by-name name (semantic-flatten-tags-table (or tags 
(semanticdb-get-tags table)))))
+  (semantic-find-tags-by-name
+   name (semantic-flatten-tags-table
+         (or tags (and (slot-boundp table 'tags)
+                       (semanticdb-get-tags table))))))
 
 (cl-defmethod semanticdb-deep-find-tags-by-name-regexp-method ((table 
semanticdb-abstract-table) regexp &optional tags)
   "In TABLE, find all occurrences of tags matching REGEXP.
@@ -1367,7 +1384,10 @@ Search in all tags in TABLE, and all components of top 
level tags in
 TABLE.
 Optional argument TAGS is a list of tags to search.
 Return a table of all matching tags."
-  (semantic-find-tags-by-name-regexp regexp (semantic-flatten-tags-table (or 
tags (semanticdb-get-tags table)))))
+  (semantic-find-tags-by-name-regexp
+   regexp (semantic-flatten-tags-table
+           (or tags (and (slot-boundp table 'tags)
+                         (semanticdb-get-tags table))))))
 
 (cl-defmethod semanticdb-deep-find-tags-for-completion-method ((table 
semanticdb-abstract-table) prefix &optional tags)
   "In TABLE, find all occurrences of tags matching PREFIX.
@@ -1375,7 +1395,11 @@ Search in all tags in TABLE, and all components of top 
level tags in
 TABLE.
 Optional argument TAGS is a list of tags to search.
 Return a table of all matching tags."
-  (semantic-find-tags-for-completion prefix (semantic-flatten-tags-table (or 
tags (semanticdb-get-tags table)))))
+  (semantic-find-tags-for-completion
+   prefix
+   (semantic-flatten-tags-table
+           (or tags (and (slot-boundp table 'tags)
+                         (semanticdb-get-tags table))))))
 
 (provide 'semantic/db-find)
 



reply via email to

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