;;; semantic/db-javascript.el --- Semantic database extensions for javascript
-;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;;; Free Software Foundation, Inc.
+;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
;; Author: Joakim Verona
(eval-when-compile
;; For generic function searching.
(require 'eieio)
- (require 'eieio-opt)
- )
+ (require 'eieio-opt))
+
;;; Code:
(defvar semanticdb-javascript-tags
'(("eval" function
(("uriComponent" variable nil nil nil)))
nil nil))
"Hard-coded list of javascript tags for semanticdb.
-See bottom of this file for instruction on managing this list.")
+See bottom of this file for instructions on managing this list.")
;;; Classes:
(defclass semanticdb-table-javascript (semanticdb-search-results-table)
(defclass semanticdb-project-database-javascript
(semanticdb-project-database
- eieio-singleton ;this db is for js globals, so singleton is apropriate
+ eieio-singleton ;this db is for js globals, so singleton is appropriate
)
((new-table-class :initform semanticdb-table-javascript
:type class
(defvar-mode-local javascript-mode semanticdb-find-default-throttle
'(project omniscience)
"Search project files, then search this omniscience database.
-It is not necessary to to system or recursive searching because of
+It is not necessary to do system or recursive searching because of
the omniscience database.")
;;; Filename based methods
(defmethod semanticdb-get-tags ((table semanticdb-table-javascript ))
"Return the list of tags belonging to TABLE."
- ;; NOTE: Omniscient databases probably don't want to keep large tabes
+ ;; NOTE: Omniscient databases probably don't want to keep large tables
;; lolly-gagging about. Keep internal Emacs tables empty and
;; refer to alternate databases when you need something.
semanticdb-javascript-tags)
(defmethod semanticdb-equivalent-mode ((table semanticdb-table-javascript) &optional buffer)
"Return non-nil if TABLE's mode is equivalent to BUFFER.
-Equivalent modes are specified by by `semantic-equivalent-major-modes'
+Equivalent modes are specified by the `semantic-equivalent-major-modes'
local variable."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(eq (or mode-local-active-mode major-mode) 'javascript-mode)))
;;; Usage
;;
-;; Unlike other tables, an omniscent database does not need to
+;; Unlike other tables, an omniscient database does not need to
;; be associated with a path. Use this routine to always add ourselves
;; to a search list.
(define-mode-local-override semanticdb-find-translate-path javascript-mode
(path brutish)
- "Return a list of semanticdb tables asociated with PATH.
+ "Return a list of semanticdb tables associated with PATH.
If brutish, do the default action.
If not brutish, do the default action, and append the system
database (if available.)"
(defmethod semanticdb-find-tags-for-completion-method
((table semanticdb-table-javascript) prefix &optional tags)
- "In TABLE, find all occurances of tags matching PREFIX.
+ "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."
(if tags (call-next-method)
(defmethod semanticdb-find-tags-by-class-method
((table semanticdb-table-javascript) class &optional tags)
- "In TABLE, find all occurances of tags of CLASS.
+ "In TABLE, find all occurrences of tags of CLASS.
Optional argument TAGS is a list of tags to search.
Returns a table of all matching tags."
(if tags (call-next-method)
(defmethod semanticdb-deep-find-tags-by-name-method
((table semanticdb-table-javascript) name &optional tags)
"Find all tags name NAME in TABLE.
-Optional argument TAGS is a list of tags t
+Optional argument TAGS is a list of tags to search.
Like `semanticdb-find-tags-by-name-method' for javascript."
(semanticdb-find-tags-by-name-method table name tags))
(defmethod semanticdb-deep-find-tags-for-completion-method
((table semanticdb-table-javascript) prefix &optional tags)
- "In TABLE, find all occurances of tags matching PREFIX.
+ "In TABLE, find all occurrences of tags matching PREFIX.
Optional argument TAGS is a list of tags to search.
Like `semanticdb-find-tags-for-completion-method' for javascript."
(semanticdb-find-tags-for-completion-method table prefix tags))
;;
(defmethod semanticdb-find-tags-external-children-of-type-method
((table semanticdb-table-javascript) type &optional tags)
- "Find all nonterminals which are child elements of TYPE
+ "Find all nonterminals which are child elements of TYPE.
Optional argument TAGS is a list of tags to search.
Return a list of tags."
(if tags (call-next-method)