;;; semantic/db.el --- Semantic tag database manager
-;; Copyright (C) 2000-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: tags
If the buffer is not in memory, load it with `find-file-noselect'."
nil)
+;; This generic method allows for sloppier coding. Many
+;; functions treat "table" as something that could be a buffer,
+;; file name, or other. This makes use of table more robust.
+(defmethod semanticdb-full-filename (buffer-or-string)
+ "Fetch the full filename that BUFFER-OR-STRING refers to.
+This uses semanticdb to get a better file name."
+ (cond ((bufferp buffer-or-string)
+ (with-current-buffer buffer-or-string
+ (semanticdb-full-filename semanticdb-current-table)))
+ ((and (stringp buffer-or-string) (file-exists-p buffer-or-string))
+ (expand-file-name buffer-or-string))))
+
(defmethod semanticdb-full-filename ((obj semanticdb-abstract-table))
"Fetch the full filename that OBJ refers to.
Abstract tables do not have file names associated with them."
(oref obj index)
(let ((idx nil))
(setq idx (funcall semanticdb-default-find-index-class
- (concat (object-name obj) " index")
+ (concat (eieio-object-name obj) " index")
;; Fill in the defaults
:table obj
))
(let ((cache (oref table cache))
(obj nil))
(while (and (not obj) cache)
- (if (eq (object-class-fast (car cache)) desired-class)
+ (if (eq (eieio-object-class (car cache)) desired-class)
(setq obj (car cache)))
(setq cache (cdr cache)))
(if obj
(let ((cache (oref db cache))
(obj nil))
(while (and (not obj) cache)
- (if (eq (object-class-fast (car cache)) desired-class)
+ (if (eq (eieio-object-class (car cache)) desired-class)
(setq obj (car cache)))
(setq cache (cdr cache)))
(if obj
;;
;; Already in a buffer, just do it.
((semanticdb-in-buffer-p obj)
- (semanticdb-set-buffer obj)
- (semantic-fetch-tags))
+ (save-excursion
+ (semanticdb-set-buffer obj)
+ (semantic-fetch-tags)))
;;
;; Not in a buffer. Forcing a load.
(force
(interactive)
(unless noninteractive
(message "Saving tag summaries..."))
- (let ((semanticdb--inhibit-make-directory nil))
+ (let ((semanticdb--inhibit-make-directory noninteractive))
(mapc 'semanticdb-save-db semanticdb-database-list))
(unless noninteractive
(message "Saving tag summaries...done")))
then load the tags for FILE, and create a new table object for it.
DONTLOAD does not affect the creation of new database objects."
;; (message "Object Translate: %s" file)
- (when (and file (file-exists-p file))
+ (when (and file (file-exists-p file) (file-regular-p file))
(let* ((default-directory (file-name-directory file))
(tab (semanticdb-file-table-object-from-hash file))
(fullfile nil))