1 ;;; semantic/bovine/el.el --- Semantic details for Emacs Lisp
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
4 ;; 2009, 2010, 2011 Free Software Foundation, Inc.
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; Use the Semantic Bovinator for Emacs Lisp
28 (require 'semantic
/bovine
)
31 (require 'semantic
/ctxt
)
32 (require 'semantic
/format
)
39 (define-lex semantic-emacs-lisp-lexer
40 "A simple lexical analyzer for Emacs Lisp.
41 This lexer ignores comments and whitespace, and will return
42 syntax as specified by the syntax table."
43 semantic-lex-ignore-whitespace
44 semantic-lex-ignore-newline
46 semantic-lex-symbol-or-keyword
47 semantic-lex-charquote
48 semantic-lex-paren-or-list
49 semantic-lex-close-paren
51 semantic-lex-ignore-comments
52 semantic-lex-punctuation
53 semantic-lex-default-action
)
57 (defvar semantic--elisp-parse-table
60 ,(lambda (vals start end
)
61 (let ((tag (semantic-elisp-use-read (car vals
))))
63 ((and (listp tag
) (semantic-tag-p (car tag
)))
64 ;; We got a list of tags back. This list is
65 ;; returned here in the correct order, but this
66 ;; list gets reversed later, putting the correctly ordered
67 ;; items into reverse order later.
69 ((semantic--tag-expanded-p tag
)
70 ;; At this point, if `semantic-elisp-use-read' returned an
71 ;; already expanded tag (from definitions parsed inside an
72 ;; eval and compile wrapper), just pass it!
75 ;; We got the basics of a single tag.
76 (append tag
(list start end
))))))))
78 "Top level bovination table for elisp.")
80 (defun semantic-elisp-desymbolify (arglist)
81 "Convert symbols to strings for ARGLIST."
86 (if (symbolp (car arglist
))
87 (symbol-name (car arglist
))
88 (if (and (listp (car arglist
))
89 (symbolp (car (car arglist
))))
90 (symbol-name (car (car arglist
)))
91 (format "%S" (car arglist
))))
93 arglist
(cdr arglist
)))
96 (defun semantic-elisp-desymbolify-args (arglist)
97 "Convert symbols to strings for ARGLIST."
98 (let ((in (semantic-elisp-desymbolify arglist
))
101 (when (not (string-match "^&" T
))
105 (defun semantic-elisp-clos-slot-property-string (slot property
)
106 "For SLOT, a string representing PROPERTY."
107 (let ((p (member property slot
)))
114 ((or (symbolp (car p
))
117 (format "%S" (car p
)))
120 (defun semantic-elisp-clos-args-to-semantic (partlist)
121 "Convert a list of CLOS class slot PARTLIST to `variable' tags."
124 (setq part
(car partlist
)
125 partlist
(cdr partlist
)
126 v
(semantic-tag-new-variable
127 (symbol-name (car part
))
128 (semantic-elisp-clos-slot-property-string part
:type
)
129 (semantic-elisp-clos-slot-property-string part
:initform
)
131 :protection
(semantic-elisp-clos-slot-property-string
133 :static-flag
(equal (semantic-elisp-clos-slot-property-string
136 :documentation
(semantic-elisp-clos-slot-property-string
137 part
:documentation
))
141 (defun semantic-elisp-form-to-doc-string (form)
142 "After reading a form FORM, convert it to a doc string.
143 For Emacs Lisp, sometimes that string is non-existent.
144 Sometimes it is a form which is evaluated at compile time, permitting
146 (cond ((stringp form
) form
)
147 ((and (listp form
) (eq (car form
) 'concat
)
148 (stringp (nth 1 form
)))
152 (defvar semantic-elisp-store-documentation-in-tag nil
153 "*When non-nil, store documentation strings in the created tags.")
155 (defun semantic-elisp-do-doc (str)
156 "Return STR as a documentation string IF they are enabled."
157 (when semantic-elisp-store-documentation-in-tag
158 (semantic-elisp-form-to-doc-string str
)))
160 (defmacro semantic-elisp-setup-form-parser
(parser &rest symbols
)
161 "Install the function PARSER as the form parser for SYMBOLS.
162 SYMBOLS is a list of symbols identifying the forms to parse.
163 PARSER is called on every forms whose first element (car FORM) is
164 found in SYMBOLS. It is passed the parameters FORM, START, END,
167 - FORM is an Elisp form read from the current buffer.
168 - START and END are the beginning and end location of the
169 corresponding data in the current buffer."
170 (let ((sym (make-symbol "sym")))
171 `(dolist (,sym
',symbols
)
172 (put ,sym
'semantic-elisp-form-parser
#',parser
))))
173 (put 'semantic-elisp-setup-form-parser
'lisp-indent-function
1)
175 (defmacro semantic-elisp-reuse-form-parser
(symbol &rest symbols
)
176 "Reuse the form parser of SYMBOL for forms identified by SYMBOLS.
177 See also `semantic-elisp-setup-form-parser'."
178 (let ((parser (make-symbol "parser"))
179 (sym (make-symbol "sym")))
180 `(let ((,parser
(get ',symbol
'semantic-elisp-form-parser
)))
182 (signal 'wrong-type-argument
183 '(semantic-elisp-form-parser ,symbol
)))
184 (dolist (,sym
',symbols
)
185 (put ,sym
'semantic-elisp-form-parser
,parser
)))))
187 (defun semantic-elisp-use-read (sl)
188 "Use `read' on the semantic list SL.
189 Return a bovination list to use."
190 (let* ((start (car sl
))
192 (form (read (buffer-substring-no-properties start end
))))
194 ;; If the first elt is a list, then it is some arbitrary code.
196 (semantic-tag-new-code "anonymous" nil
)
198 ;; A special form parser is provided, use it.
199 ((and (car form
) (symbolp (car form
))
200 (get (car form
) 'semantic-elisp-form-parser
))
201 (funcall (get (car form
) 'semantic-elisp-form-parser
)
203 ;; Produce a generic code tag by default.
205 (semantic-tag-new-code (format "%S" (car form
)) nil
)
210 (semantic-elisp-setup-form-parser
211 (lambda (form start end
)
212 (semantic-tag-new-function
213 (symbol-name (nth 2 form
))
215 '("form" "start" "end")
218 semantic-elisp-setup-form-parser
)
220 (semantic-elisp-setup-form-parser
221 (lambda (form start end
)
224 (semantic-parse-region start end nil
1)
225 (error (message "MUNGE: %S" foo
)
227 (if (semantic-tag-p (car-safe tags
))
229 (semantic-tag-new-code (format "%S" (car form
)) nil
))))
234 (semantic-elisp-setup-form-parser
235 (lambda (form start end
)
236 (semantic-tag-new-function
237 (symbol-name (nth 1 form
))
239 (semantic-elisp-desymbolify-args (nth 2 form
))
240 :user-visible-flag
(eq (car-safe (nth 4 form
)) 'interactive
)
241 :documentation
(semantic-elisp-do-doc (nth 3 form
))
242 :overloadable
(or (eq (car form
) 'define-overload
)
243 (eq (car form
) 'define-overloadable-function
))
249 define-overload
;; @todo - remove after cleaning up semantic.
250 define-overloadable-function
253 (semantic-elisp-setup-form-parser
254 (lambda (form start end
)
255 (let ((doc (semantic-elisp-form-to-doc-string (nth 3 form
))))
256 (semantic-tag-new-variable
257 (symbol-name (nth 1 form
))
260 :user-visible-flag
(and doc
263 :constant-flag
(eq (car form
) 'defconst
)
264 :documentation
(semantic-elisp-do-doc doc
)
271 (semantic-elisp-setup-form-parser
272 (lambda (form start end
)
273 (let ((doc (semantic-elisp-form-to-doc-string (nth 3 form
))))
274 (semantic-tag-new-variable
275 (symbol-name (nth 1 form
))
278 :user-visible-flag
(and doc
281 :documentation
(semantic-elisp-do-doc doc
)
287 (semantic-elisp-setup-form-parser
288 (lambda (form start end
)
289 (let ((doc (semantic-elisp-form-to-doc-string (nth 3 form
))))
290 (semantic-tag-new-variable
291 (symbol-name (nth 1 form
))
294 :user-visible-flag
(and doc
297 :documentation
(semantic-elisp-do-doc doc
)
304 (semantic-elisp-setup-form-parser
305 (lambda (form start end
)
306 (let ((doc (semantic-elisp-form-to-doc-string (nth 3 form
))))
308 (symbol-name (nth 1 form
))
312 :documentation
(semantic-elisp-do-doc doc
)
318 (semantic-elisp-setup-form-parser
319 (lambda (form start end
)
320 (semantic-tag-new-function
321 (symbol-name (cadr (cadr form
)))
323 :user-visible-flag
(and (nth 4 form
)
324 (not (eq (nth 4 form
) 'nil
)))
326 :documentation
(semantic-elisp-do-doc (nth 3 form
))))
330 (semantic-elisp-setup-form-parser
331 (lambda (form start end
)
332 (let* ((a2 (nth 2 form
))
334 (args (if (listp a2
) a2 a3
))
335 (doc (nth (if (listp a2
) 3 4) form
)))
336 (semantic-tag-new-function
337 (symbol-name (nth 1 form
))
339 (if (listp (car args
))
340 (cons (symbol-name (caar args
))
341 (semantic-elisp-desymbolify-args (cdr args
)))
342 (semantic-elisp-desymbolify-args (cdr args
)))
343 :parent
(if (listp (car args
)) (symbol-name (cadr (car args
))) nil
)
344 :documentation
(semantic-elisp-do-doc doc
)
350 (semantic-elisp-setup-form-parser
351 (lambda (form start end
)
352 (semantic-tag-new-function
353 (symbol-name (nth 1 form
))
355 (semantic-elisp-desymbolify (nth 2 form
))
360 (semantic-elisp-setup-form-parser
361 (lambda (form start end
)
362 (let ((docpart (nthcdr 4 form
)))
363 (semantic-tag-new-type
364 (symbol-name (nth 1 form
))
366 (semantic-elisp-clos-args-to-semantic (nth 3 form
))
367 (semantic-elisp-desymbolify (nth 2 form
))
368 :typemodifiers
(semantic-elisp-desymbolify
369 (unless (stringp (car docpart
)) docpart
))
370 :documentation
(semantic-elisp-do-doc
371 (if (stringp (car docpart
))
373 (cadr (member :documentation docpart
))))
378 (semantic-elisp-setup-form-parser
379 (lambda (form start end
)
380 (let ((slots (nthcdr 2 form
)))
381 ;; Skip doc string if present.
382 (and (stringp (car slots
))
383 (setq slots
(cdr slots
)))
384 (semantic-tag-new-type
385 (symbol-name (if (consp (nth 1 form
))
389 (semantic-elisp-desymbolify slots
)
395 (semantic-elisp-setup-form-parser
396 (lambda (form start end
)
397 (semantic-tag-new-function
398 (symbol-name (nth 1 form
))
400 :lexical-analyzer-flag t
401 :documentation
(semantic-elisp-do-doc (nth 2 form
))
406 (semantic-elisp-setup-form-parser
407 (lambda (form start end
)
408 (let ((args (nth 3 form
)))
409 (semantic-tag-new-function
410 (symbol-name (nth 1 form
))
412 (and (listp args
) (semantic-elisp-desymbolify args
))
413 :override-function-flag t
414 :parent
(symbol-name (nth 2 form
))
415 :documentation
(semantic-elisp-do-doc (nth 4 form
))
417 define-mode-overload-implementation
;; obsoleted
418 define-mode-local-override
421 (semantic-elisp-setup-form-parser
422 (lambda (form start end
)
423 (semantic-tag-new-variable
424 (symbol-name (nth 2 form
))
426 (nth 3 form
) ; default value
427 :override-variable-flag t
428 :parent
(symbol-name (nth 1 form
))
429 :documentation
(semantic-elisp-do-doc (nth 4 form
))
434 (semantic-elisp-setup-form-parser
435 (lambda (form start end
)
436 (let ((name (nth 1 form
)))
437 (semantic-tag-new-include
438 (symbol-name (if (eq (car-safe name
) 'quote
)
442 :directory
(nth 2 form
))))
446 (semantic-elisp-setup-form-parser
447 (lambda (form start end
)
448 (let ((name (nth 1 form
)))
449 (semantic-tag-new-package
450 (symbol-name (if (eq (car-safe name
) 'quote
)
459 (define-mode-local-override semantic-dependency-tag-file
460 emacs-lisp-mode
(tag)
461 "Find the file BUFFER depends on described by TAG."
462 (if (fboundp 'find-library-name
)
464 ;; Try an Emacs 22 fcn. This throws errors.
465 (find-library-name (semantic-tag-name tag
))
467 (message "semantic: connot find source file %s"
468 (semantic-tag-name tag
))))
469 ;; No handy function available. (Older Emacsen)
470 (let* ((lib (locate-library (semantic-tag-name tag
)))
471 (name (if lib
(file-name-sans-extension lib
) nil
))
472 (nameel (concat name
".el")))
474 ((and name
(file-exists-p nameel
)) nameel
)
475 ((and name
(file-exists-p (concat name
".el.gz")))
476 ;; This is the linux distro case.
477 (concat name
".el.gz"))
478 ;; source file does not exists
480 (message "semantic: cannot find source file %s" (concat name
".el")))
486 (defun semantic-emacs-lisp-overridable-doc (tag)
487 "Return the documentation string generated for overloadable functions.
488 Fetch the item for TAG. Only returns info about what symbols can be
489 used to perform the override."
490 (if (and (eq (semantic-tag-class tag
) 'function
)
491 (semantic-tag-get-attribute tag
:overloadable
))
492 ;; Calc the doc to use for the overloadable symbols.
493 (overload-docstring-extension (intern (semantic-tag-name tag
)))
496 (defun semantic-emacs-lisp-obsoleted-doc (tag)
497 "Indicate that TAG is a new name that has obsoleted some old name.
498 Unfortunately, this requires that the tag in question has been loaded
499 into Emacs Lisp's memory."
500 (let ((obsoletethis (intern-soft (semantic-tag-name tag
)))
502 ;; This asks if our tag is available in the Emacs name space for querying.
504 (mapatoms (lambda (a)
505 (let ((oi (get a
'byte-obsolete-info
)))
506 (if (and oi
(eq (car oi
) obsoletethis
))
507 (setq obsoletor a
)))))
509 (format "\n@obsolete{%s,%s}" obsoletor
(semantic-tag-name tag
))
512 (define-mode-local-override semantic-documentation-for-tag
513 emacs-lisp-mode
(tag &optional nosnarf
)
514 "Return the documentation string for TAG.
515 Optional argument NOSNARF is ignored."
516 (let ((d (semantic-tag-docstring tag
)))
518 (cond ((semantic-tag-with-position-p tag
)
519 ;; Doc isn't in the tag itself. Lets pull it out of the
521 (let ((semantic-elisp-store-documentation-in-tag t
))
522 (setq tag
(with-current-buffer (semantic-tag-buffer tag
)
523 (goto-char (semantic-tag-start tag
))
524 (semantic-elisp-use-read
525 ;; concoct a lexical token.
526 (cons (semantic-tag-start tag
)
527 (semantic-tag-end tag
))))
528 d
(semantic-tag-docstring tag
))))
529 ;; The tag may be the result of a system search.
530 ((intern-soft (semantic-tag-name tag
))
531 (let ((sym (intern-soft (semantic-tag-name tag
))))
532 ;; Query into the global table o stuff.
533 (cond ((eq (semantic-tag-class tag
) 'function
)
534 (setq d
(documentation sym
)))
536 (setq d
(documentation-property
537 sym
'variable-documentation
)))))
538 ;; Label it as system doc.. perhaps just for debugging
540 (if d
(setq d
(concat "Sytem Doc: \n" d
)))
546 (substitute-command-keys
547 (if (and (> (length d
) 0) (= (aref d
0) ?
*))
550 (semantic-emacs-lisp-overridable-doc tag
)
551 (semantic-emacs-lisp-obsoleted-doc tag
)))))
555 (define-mode-local-override semantic-tag-include-filename emacs-lisp-mode
557 "Return the name of the tag with .el appended.
558 If there is a detail, prepend that directory."
559 (let ((name (semantic-tag-name tag
))
560 (detail (semantic-tag-get-attribute tag
:directory
)))
561 (concat (expand-file-name name detail
) ".el")))
563 (define-mode-local-override semantic-insert-foreign-tag
564 emacs-lisp-mode
(tag)
565 "Insert TAG at point.
566 Attempts a simple prototype for calling or using TAG."
567 (cond ((semantic-tag-of-class-p tag
'function
)
568 (insert "(" (semantic-tag-name tag
) " )")
571 (insert (semantic-tag-name tag
)))))
573 (define-mode-local-override semantic-tag-protection
574 emacs-lisp-mode
(tag &optional parent
)
575 "Return the protection of TAG in PARENT.
576 Override function for `semantic-tag-protection'."
577 (let ((prot (semantic-tag-get-attribute tag
:protection
)))
579 ;; If a protection is not specified, AND there is a parent
580 ;; data type, then it is public.
581 ((and (not prot
) parent
) 'public
)
582 ((string= prot
":public") 'public
)
583 ((string= prot
"public") 'public
)
584 ((string= prot
":private") 'private
)
585 ((string= prot
"private") 'private
)
586 ((string= prot
":protected") 'protected
)
587 ((string= prot
"protected") 'protected
))))
589 (define-mode-local-override semantic-tag-static-p
590 emacs-lisp-mode
(tag &optional parent
)
591 "Return non-nil if TAG is static in PARENT class.
592 Overrides `semantic-nonterminal-static'."
593 ;; This can only be true (theoretically) in a class where it is assigned.
594 (semantic-tag-get-attribute tag
:static-flag
))
598 ;; Emacs lisp is very different from C,C++ which most context parsing
599 ;; functions are written. Support them here.
600 (define-mode-local-override semantic-up-context emacs-lisp-mode
601 (&optional point bounds-type
)
602 "Move up one context in an Emacs Lisp function.
603 A Context in many languages is a block with its own local variables.
604 In Emacs, we will move up lists and stop when one starts with one of
605 the following context specifiers:
606 `let', `let*', `defun', `with-slots'
607 Returns non-nil it is not possible to go up a context."
608 (let ((last-up (semantic-up-context-default)))
610 (and (not (looking-at
611 "(\\(let\\*?\\|def\\(un\\|method\\|generic\\|\
612 define-mode-overload\\)\
615 (setq last-up
(semantic-up-context-default)))
619 (define-mode-local-override semantic-ctxt-current-function emacs-lisp-mode
620 (&optional point same-as-symbol-return
)
621 "Return a string which is the current function being called."
623 (if point
(goto-char point
) (setq point
(point)))
624 ;; (semantic-beginning-of-command)
625 (if (condition-case nil
631 (looking-at "(let")))
633 ;; This is really a let statement, not a function.
635 (let ((fun (condition-case nil
639 (buffer-substring-no-properties
640 (point) (progn (forward-sexp 1)
645 ;; Do not return FUN IFF the cursor is on FUN.
646 ;; Huh? Thats because if cursor is on fun, it is
647 ;; the current symbol, and not the current function.
650 (progn (forward-sexp -
1)
652 (looking-at (regexp-quote fun
))
653 (<= point
(+ (point) (length fun
))))
656 ;; Go up and try again.
657 same-as-symbol-return
658 ;; We are ok, so get it.
664 (define-mode-local-override semantic-get-local-variables emacs-lisp-mode
666 "Return a list of local variables for POINT.
667 Scan backwards from point at each successive function. For all occurrences
668 of `let' or `let*', grab those variable names."
672 (while (setq fn
(car (semantic-ctxt-current-function-emacs-lisp-mode
677 ((member fn
'("let" "let*" "with-slots"))
682 (skip-chars-forward "* \t\n")
683 (let ((varlst (read (buffer-substring-no-properties
689 (let* ((oneelt (car varlst
))
690 (name (if (symbolp oneelt
)
693 (setq vars
(cons (semantic-tag-new-variable
697 (setq varlst
(cdr varlst
)))
699 ((string= fn
"lambda")
704 (skip-chars-forward "* \t\n")
705 (let ((arglst (read (buffer-substring-no-properties
711 (let* ((name (car arglst
)))
712 (when (/= ?
& (aref (symbol-name name
) 0))
713 (setq vars
(cons (semantic-tag-new-variable
717 (setq arglst
(cdr arglst
)))
723 (define-mode-local-override semantic-end-of-command emacs-lisp-mode
725 "Move cursor to the end of the current command.
726 In Emacs Lisp this is easily defined by parenthesis bounding."
731 (define-mode-local-override semantic-beginning-of-command emacs-lisp-mode
733 "Move cursor to the beginning of the current command.
734 In Emacs Lisp this is easily defined by parenthesis bounding."
741 (define-mode-local-override semantic-ctxt-current-symbol emacs-lisp-mode
743 "List the symbol under point."
745 (if point
(goto-char point
))
747 (let ((sym (thing-at-point 'symbol
)))
752 (define-mode-local-override semantic-ctxt-current-assignment emacs-lisp-mode
754 "What is the variable being assigned into at POINT?"
756 (if point
(goto-char point
))
757 (let ((fn (semantic-ctxt-current-function point
))
759 ;; We should never get lists from here.
760 (if fn
(setq fn
(car fn
)))
763 ((and fn
(or (string= fn
"setq") (string= fn
"set")))
772 ;; Skip over sexp until we pass point.
773 (while (< (point) point
)
774 (setq count
(1+ count
))
778 (if (= (% count
2) 1)
780 (buffer-substring-no-properties start
(point))))
782 (if lastodd
(list lastodd
))
785 ;; This obscure thing finds let statements.
793 (looking-at "(let")))
796 (semantic-beginning-of-command)
797 ;; Use func finding code, since it is the same format.
798 (semantic-ctxt-current-symbol)))
804 (define-mode-local-override semantic-ctxt-current-argument emacs-lisp-mode
806 "Return the index into the argument the cursor is in, or nil."
808 (if point
(goto-char point
))
809 (if (looking-at "\\<\\w")
812 (while (condition-case nil
817 (setq count
(1+ count
)))
823 (define-mode-local-override semantic-ctxt-current-class-list emacs-lisp-mode
825 "Return a list of tag classes allowed at POINT.
826 Emacs Lisp knows much more about the class of the tag needed to perform
827 completion than some languages. We distincly know if we are to be a
828 function name, variable name, or any type of symbol. We could identify
829 fields and such to, but that is for some other day."
831 (if point
(goto-char point
))
837 (while (< (point) point
)
838 (setq count
(1+ count
))
849 (define-mode-local-override semantic-format-tag-abbreviate emacs-lisp-mode
850 (tag &optional parent color
)
851 "Return an abbreviated string describing tag."
852 (let ((class (semantic-tag-class tag
))
853 (name (semantic-format-tag-name tag parent color
))
856 ((eq class
'function
)
857 (concat "(" name
")"))
859 (semantic-format-tag-abbreviate-default tag parent color
)))))
861 (define-mode-local-override semantic-format-tag-prototype emacs-lisp-mode
862 (tag &optional parent color
)
863 "Return a prototype string describing tag.
864 In Emacs Lisp, a prototype for something may start (autoload ...).
865 This is certainly not expected if this is used to display a summary.
866 Make up something else. When we go to write something that needs
867 a real Emacs Lisp protype, we can fix it then."
868 (let ((class (semantic-tag-class tag
))
869 (name (semantic-format-tag-name tag parent color
))
872 ((eq class
'function
)
873 (let* ((args (semantic-tag-function-arguments tag
))
874 (argstr (semantic--format-tag-arguments args
877 (concat "(" name
(if args
" " "")
881 (semantic-format-tag-prototype-default tag parent color
)))))
883 (define-mode-local-override semantic-format-tag-concise-prototype emacs-lisp-mode
884 (tag &optional parent color
)
885 "Return a concise prototype string describing tag.
886 See `semantic-format-tag-prototype' for Emacs Lisp for more details."
887 (semantic-format-tag-prototype tag parent color
))
889 (define-mode-local-override semantic-format-tag-uml-prototype emacs-lisp-mode
890 (tag &optional parent color
)
891 "Return a uml prototype string describing tag.
892 See `semantic-format-tag-prototype' for Emacs Lisp for more details."
893 (semantic-format-tag-prototype tag parent color
))
897 (define-mode-local-override semantic-ia-insert-tag
898 emacs-lisp-mode
(tag)
899 "Insert TAG into the current buffer based on completion."
900 ;; This function by David <de_bb@...> is a tweaked version of the original.
901 (insert (semantic-tag-name tag
))
902 (let ((tt (semantic-tag-class tag
))
903 (args (semantic-tag-function-arguments tag
)))
904 (cond ((eq tt
'function
)
910 ;;; Lexical features and setup
912 (defvar-mode-local emacs-lisp-mode semantic-lex-analyzer
913 'semantic-emacs-lisp-lexer
)
915 (defvar-mode-local emacs-lisp-mode semantic--parse-table
916 semantic--elisp-parse-table
)
918 (defvar-mode-local emacs-lisp-mode semantic-function-argument-separator
921 (defvar-mode-local emacs-lisp-mode semantic-function-argument-separation-character
924 (defvar-mode-local emacs-lisp-mode semantic-symbol-
>name-assoc-list
927 (variable .
"Variables")
928 (function .
"Defuns")
929 (include .
"Requires")
930 (package .
"Provides")
933 (defvar-mode-local emacs-lisp-mode imenu-create-index-function
934 'semantic-create-imenu-index
)
936 (defvar-mode-local emacs-lisp-mode semantic-stickyfunc-sticky-classes
937 '(function type variable
)
939 ELisp variables can be pretty long, so track this one too.")
941 (define-child-mode lisp-mode emacs-lisp-mode
942 "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.")
944 (defun semantic-default-elisp-setup ()
945 "Setup hook function for Emacs Lisp files and Semantic."
948 (add-hook 'emacs-lisp-mode-hook
'semantic-default-elisp-setup
)
952 ;; @TODO: Lisp supports syntaxes that Emacs Lisp does not.
953 ;; Write a Lisp only parser someday.
956 ;; (defun foo () /#A)
958 (add-hook 'lisp-mode-hook
'semantic-default-elisp-setup
)
960 (eval-after-load "semanticdb"
961 '(require 'semantic
/db-el
)
964 (provide 'semantic
/bovine
/el
)
966 ;; arch-tag: d634cbab-9610-4510-9fce-048ae1eb7aa6
967 ;;; semantic/bovine/el.el ends here