Mercurial > emacs
annotate lisp/cedet/srecode/el.el @ 112447:bcecab2ad22d
* nsterm.m (x_set_offset): Set dont_constrain to 0 so the call to
setFrameTopLeftPoint is constrained.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Sun, 23 Jan 2011 14:28:14 +0100 |
parents | ef719132ddfa |
children |
rev | line source |
---|---|
104498 | 1 ;;; srecode/el.el --- Emacs Lisp specific arguments |
2 | |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 ;; Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
104498 | 4 |
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation, either version 3 of the License, or | |
12 ;; (at your option) any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 ;;; Commentary: | |
23 ;; | |
24 ;; Emacs Lisp specific handlers. To use these handlers in your | |
25 ;; template, add the :name part to your template argument list. | |
26 ;; | |
27 ;; Error if not in a Emacs Lisp mode | |
28 | |
29 ;;; Code: | |
30 | |
31 (require 'srecode) | |
32 (require 'srecode/semantic) | |
33 | |
34 (declare-function semanticdb-brute-find-tags-by-class "semantic/db-find") | |
35 | |
36 ;;;###autoload | |
37 (defun srecode-semantic-handle-:el (dict) | |
38 "Add macros into the dictionary DICT based on the current Emacs Lisp file. | |
39 Adds the following: | |
40 PRENAME - The common name prefix of this file." | |
41 (let* ((names (append (semantic-find-tags-by-class 'function (current-buffer)) | |
42 (semantic-find-tags-by-class 'variable (current-buffer))) | |
43 ) | |
44 (common (try-completion "" names))) | |
45 | |
46 (srecode-dictionary-set-value dict "PRENAME" common) | |
47 )) | |
48 | |
49 ;;;###autoload | |
50 (defun srecode-semantic-handle-:el-custom (dict) | |
51 "Add macros into the dictionary DICT based on the current Emacs Lisp file. | |
52 Adds the following: | |
53 GROUP - The 'defgroup' name we guess you want for variables. | |
54 FACEGROUP - The `defgroup' name you might want for faces." | |
55 (require 'semantic/db-find) | |
56 (let ((groups (semanticdb-strip-find-results | |
57 (semanticdb-brute-find-tags-by-class 'customgroup))) | |
58 (varg nil) | |
59 (faceg nil) | |
60 ) | |
61 | |
62 ;; Pick the best group | |
63 (while groups | |
64 (cond ((string-match "face" (semantic-tag-name (car groups))) | |
65 (setq faceg (car groups))) | |
66 ((not varg) | |
67 (setq varg (car groups))) | |
68 (t | |
69 ;; What about other groups? | |
70 )) | |
71 (setq groups (cdr groups))) | |
72 | |
73 ;; Double check the facegroup. | |
74 (setq faceg (or faceg varg)) | |
75 | |
76 ;; Setup some variables | |
77 (srecode-dictionary-set-value dict "GROUP" (semantic-tag-name varg)) | |
78 (srecode-dictionary-set-value dict "FACEGROUP" (semantic-tag-name faceg)) | |
79 | |
80 )) | |
81 | |
82 (define-mode-local-override srecode-semantic-apply-tag-to-dict | |
83 emacs-lisp-mode (tagobj dict) | |
84 "Apply Emacs Lisp specific features from TAGOBJ into DICT. | |
85 Calls `srecode-semantic-apply-tag-to-dict-default' first." | |
86 (srecode-semantic-apply-tag-to-dict-default tagobj dict) | |
87 | |
88 ;; Pull out the tag for the individual pieces. | |
89 (let* ((tag (oref tagobj :prime)) | |
90 (doc (semantic-tag-docstring tag))) | |
91 | |
92 ;; It is much more common to have doc on ELisp. | |
93 (srecode-dictionary-set-value dict "DOC" doc) | |
94 | |
95 (cond | |
96 ;; | |
97 ;; FUNCTION | |
98 ;; | |
99 ((eq (semantic-tag-class tag) 'function) | |
100 (if (semantic-tag-get-attribute tag :user-visible-flag) | |
101 (srecode-dictionary-set-value dict "INTERACTIVE" " (interactive)\n ") | |
102 (srecode-dictionary-set-value dict "INTERACTIVE" "")))))) | |
103 | |
104 | |
105 (provide 'srecode/el) | |
106 | |
107 ;; Local variables: | |
108 ;; generated-autoload-file: "loaddefs.el" | |
109 ;; generated-autoload-load-name: "srecode/el" | |
110 ;; End: | |
111 | |
112 ;;; srecode/el.el ends here |