annotate lisp/cedet/semantic/texi.el @ 111191:ed5bac97776a

* term/ns-win.el (ns-new-frame, ns-show-prefs): Don't add to global map. * term/common-win.el (x-setup-function-keys): Remove most of the keymappings. Comment on the remaining ones.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Tue, 26 Oct 2010 16:20:00 +0300
parents a5ad4f188e19
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
1 ;;; semantic/texi.el --- Semantic details for Texinfo files
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105804
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104520
diff changeset
4 ;; Free Software Foundation, Inc.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; (at your option) any later version.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;; Commentary:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; Parse Texinfo buffers using regular expressions. The core parser
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; engine is the function `semantic-texi-parse-headings'. The
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; parser plug-in is the function `semantic-texi-parse-region' that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; overrides `semantic-parse-region'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 (require 'semantic)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 (require 'semantic/format)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'texinfo)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 (eval-when-compile
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 (require 'semantic/db)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 (require 'semantic/db-find)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (require 'semantic/ctxt)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
38 (require 'semantic/find)
104520
403fc49fd1a3 Minor comment tweak.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
39 (require 'semantic/doc))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40
104455
d66016869489 lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag): Require
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
41 (defvar ede-minor-mode)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
42 (declare-function lookup-words "ispell")
104455
d66016869489 lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag): Require
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
43 (declare-function ede-current-project "ede")
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
44
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (defvar semantic-texi-super-regex
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 "^@\\(top\\|chapter\\|\\(sub\\)*section\\|unnumbered\\(\\(sub\\)*sec\\)?\\|\
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 \\(chap\\|\\(sub\\)+\\|major\\)?heading\\|appendix\\(\\(sub\\)*sec\\)?\\|\
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 centerchap\\|def\\(var\\|un\\|fn\\|opt\\)x?\\)"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 "Regular expression used to find special sections in a Texinfo file.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 (defvar semantic-texi-name-field-list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 '( ("defvar" . 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 ("defvarx" . 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ("defun" . 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ("defunx" . 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ("defopt" . 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 ("deffn" . 2)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 ("deffnx" . 2)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 "List of definition commands, and the field position.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 The field position is the field number (based at 1) where the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 name of this section is.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 ;;; Code:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 (defun semantic-texi-parse-region (&rest ignore)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 "Parse the current texinfo buffer for semantic tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 IGNORE any arguments, always parse the whole buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 Each tag returned is of the form:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 (\"NAME\" section (:members CHILDREN))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 or
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 (\"NAME\" def)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 It is an override of 'parse-region and must be installed by the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 function `semantic-install-function-overrides'."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 (mapcar 'semantic-texi-expand-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 (semantic-texi-parse-headings)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 (defun semantic-texi-parse-changes ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 "Parse changes in the current texinfo buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; NOTE: For now, just schedule a full reparse.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 ;; To be implemented later.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (semantic-parse-tree-set-needs-rebuild))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (defun semantic-texi-expand-tag (tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 "Expand the texinfo tag TAG."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 (let ((chil (semantic-tag-components tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (if chil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (semantic-tag-put-attribute
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 tag :members (mapcar 'semantic-texi-expand-tag chil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (car (semantic--tag-expand tag))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (defun semantic-texi-parse-headings ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 "Parse the current texinfo buffer for all semantic tags now."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (let ((pass1 nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; First search and snarf.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (goto-char (point-min))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (let ((semantic--progress-reporter
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (make-progress-reporter
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (format "Parsing %s..."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (file-name-nondirectory buffer-file-name))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (point-min) (point-max))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (while (re-search-forward semantic-texi-super-regex nil t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (setq pass1 (cons (match-beginning 0) pass1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (progress-reporter-update semantic--progress-reporter (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (progress-reporter-done semantic--progress-reporter)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (setq pass1 (nreverse pass1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 ;; Now, make some tags while creating a set of children.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (car (semantic-texi-recursive-combobulate-list pass1 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (defsubst semantic-texi-new-section-tag (name members start end)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 "Create a semantic tag of class section.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 NAME is the name of this section.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 MEMBERS is a list of semantic tags representing the elements that make
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 up this section.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 START and END define the location of data described by the tag."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (append (semantic-tag name 'section :members members)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (list start end)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (defsubst semantic-texi-new-def-tag (name start end)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 "Create a semantic tag of class def.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 NAME is the name of this definition.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 START and END define the location of data described by the tag."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (append (semantic-tag name 'def)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (list start end)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (defun semantic-texi-set-endpoint (metataglist pnt)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 "Set the end point of the first section tag in METATAGLIST to PNT.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 METATAGLIST is a list of tags in the intermediate tag format used by the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 texinfo parser. PNT is the new point to set."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (let ((metatag nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (while (and metataglist
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (not (eq (semantic-tag-class (car metataglist)) 'section)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (setq metataglist (cdr metataglist)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 (setq metatag (car metataglist))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (when metatag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (setcar (nthcdr (1- (length metatag)) metatag) pnt)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 metatag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 (defun semantic-texi-recursive-combobulate-list (sectionlist level)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 "Rearrange SECTIONLIST to be a hierarchical tag list starting at LEVEL.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 Return the rearranged new list, with all remaining tags from
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 SECTIONLIST starting at ELT 2. Sections not are not dealt with as soon as a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 tag with greater section value than LEVEL is found."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (let ((newl nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (oldl sectionlist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (catch 'level-jump
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (while oldl
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (goto-char (car oldl))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (if (looking-at "@\\(\\w+\\)")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (let* ((word (match-string 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (levelmatch (assoc word texinfo-section-list))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 text begin tmp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 ;; Set begin to the right location
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (setq begin (point))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 ;; Get out of here if there if we made it that far.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (if (and levelmatch (<= (car (cdr levelmatch)) level))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 (when newl
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (semantic-texi-set-endpoint newl begin))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 (throw 'level-jump t)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 ;; Recombobulate
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (if levelmatch
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (let ((end (match-end 1)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 ;; Levels sometimes have a @node just in front.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 ;; That node statement should be included in the space
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 ;; for this entry.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 (skip-chars-backward "\n \t")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (beginning-of-line)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (when (looking-at "@node\\>")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (setq begin (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 ;; When there is a match, the descriptive text
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 ;; consists of the rest of the line.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (goto-char end)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (skip-chars-forward " \t")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 (setq text (buffer-substring-no-properties
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (progn (end-of-line) (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 ;; Next, recurse into the body to find the end.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (setq tmp (semantic-texi-recursive-combobulate-list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (cdr oldl) (car (cdr levelmatch))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 ;; Build a tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (setq tag (semantic-texi-new-section-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 text (car tmp) begin (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 ;; Before appending the newtag, update the previous tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 ;; if it is a section tag.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (when newl
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (semantic-texi-set-endpoint newl begin))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 ;; Append new tag to our master list.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (setq newl (cons tag newl))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 ;; continue
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (setq oldl (cdr tmp))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 ;; No match means we have a def*, so get the name from
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 ;; it based on the type of thingy we found.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 (setq levelmatch (assoc word semantic-texi-name-field-list)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 tmp (or (cdr levelmatch) 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (forward-sexp tmp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (skip-chars-forward " \t")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (setq text (buffer-substring-no-properties
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (progn (forward-sexp 1) (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 ;; Seek the end of this definition
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (goto-char begin)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (semantic-texi-forward-deffn)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (setq tag (semantic-texi-new-def-tag text begin (point))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 newl (cons tag newl))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 ;; continue
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (setq oldl (cdr oldl)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 (error "Problem finding section in semantic/texi parser"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 ;; (setq oldl (cdr oldl))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 ;; When oldl runs out, force a new endpoint as point-max
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (when (not oldl)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (semantic-texi-set-endpoint newl (point-max)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (cons (nreverse newl) oldl)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (defun semantic-texi-forward-deffn ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 "Move forward over one deffn type definition.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 The cursor should be on the @ sign."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (when (looking-at "@\\(\\w+\\)")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (let* ((type (match-string 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (seek (concat "^@end\\s-+" (regexp-quote type))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (re-search-forward seek nil t))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (define-mode-local-override semantic-tag-components
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 texinfo-mode (tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 "Return components belonging to TAG."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (semantic-tag-get-attribute tag :members))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 ;;; Overrides: Context Parsing
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 ;; How to treat texi as a language?
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (defvar semantic-texi-environment-regexp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 (if (string-match texinfo-environment-regexp "@menu")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;; Make sure our Emacs has menus in it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 texinfo-environment-regexp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 ;; If no menus, then merge in the menu concept.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (when (string-match "cartouche" texinfo-environment-regexp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (concat (substring texinfo-environment-regexp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 0 (match-beginning 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 "menu\\|"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (substring texinfo-environment-regexp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (match-beginning 0)))))
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104520
diff changeset
255 "Regular expression for matching texinfo environments.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 uses `texinfo-environment-regexp', but makes sure that it
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 can handle the @menu environment.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (define-mode-local-override semantic-up-context texinfo-mode ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 "Handle texinfo constructs which do not use parenthetical nesting."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (let ((done nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (let ((parenthetical (semantic-up-context-default))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 (when (not parenthetical)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 ;; We are in parenthises. Are they the types of parens
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 ;; belonging to a texinfo construct?
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (forward-word -1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (when (looking-at "@\\w+{")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (setq done (point))))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 ;; If we are not in a parenthetical node, then find a block instead.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 ;; Use the texinfo support to find block start/end constructs.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (while (and (not done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 (re-search-backward semantic-texi-environment-regexp nil t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 ;; For any hit, if we find an @end foo, then jump to the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 ;; matching @foo. If it is not an end, then we win!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (if (not (looking-at "@end\\s-+\\(\\w+\\)"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (setq done (point))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 ;; Skip over this block
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (let ((env (match-string 1)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 (re-search-backward (concat "@" env))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 ;; All over, post what we find.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (if done
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 ;; We found something, so use it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (progn (goto-char done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 t)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (define-mode-local-override semantic-beginning-of-context texinfo-mode (&optional point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 "Move to the beginning of the context surrounding POINT."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (if (semantic-up-context point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 ;; If we can't go up, we can't do this either.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 ;; We moved, so now we need to skip into whatever this thing is.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (forward-word 1) ;; skip the command
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (if (looking-at "\\s-*{")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 ;; In a short command. Go in.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 (down-list 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 ;; An environment. Go to the next line.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (end-of-line)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 (forward-char 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (define-mode-local-override semantic-ctxt-current-class-list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 texinfo-mode (&optional point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 "Determine the class of tags that can be used at POINT.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 For texinfo, there two possibilities returned.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 1) 'function - for a call to a texinfo function
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 2) 'word - indicates an english word.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 It would be nice to know function arguments too, but not today."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 (let ((sym (semantic-ctxt-current-symbol)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 (if (and sym (= (aref (car sym) 0) ?@))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 '(function)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 '(word))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 ;;; Overrides : Formatting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 ;; Various override to better format texi tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (define-mode-local-override semantic-format-tag-abbreviate
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 texinfo-mode (tag &optional parent color)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 "Texinfo tags abbreviation."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (let ((class (semantic-tag-class tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (name (semantic-format-tag-name tag parent color))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (cond ((eq class 'function)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (concat name "{ }"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (t (semantic-format-tag-abbreviate-default tag parent color)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (define-mode-local-override semantic-format-tag-prototype
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 texinfo-mode (tag &optional parent color)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 "Texinfo tags abbreviation."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (semantic-format-tag-abbreviate tag parent color))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 ;;; Texi Unique Features
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (defun semantic-tag-texi-section-text-bounds (tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 "Get the bounds to the text of TAG.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 The text bounds is the text belonging to this node excluding
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 the text of any child nodes, but including any defuns."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (let ((memb (semantic-tag-components tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 ;; Members.. if one is a section, check it out.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 (while (and memb (not (semantic-tag-of-class-p (car memb) 'section)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (setq memb (cdr memb)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 ;; No members? ... then a simple problem!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (if (not memb)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (semantic-tag-bounds tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 ;; Our end is their beginning...
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (list (semantic-tag-start tag) (semantic-tag-start (car memb))))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 (defun semantic-texi-current-environment (&optional point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 "Return as a string the type of the current environment.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 Optional argument POINT is where to look for the environment."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (when point (goto-char (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (while (and (or (not (looking-at semantic-texi-environment-regexp))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (looking-at "@end"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (not (semantic-up-context)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (when (looking-at semantic-texi-environment-regexp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 (match-string 1))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 ;;; Analyzer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (eval-when-compile
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (require 'semantic/analyze))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 (define-mode-local-override semantic-analyze-current-context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 texinfo-mode (point)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 "Analysis context makes no sense for texinfo. Return nil."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 (let* ((prefixandbounds (semantic-ctxt-current-symbol-and-bounds (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (prefix (car prefixandbounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (bounds (nth 2 prefixandbounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 (prefixclass (semantic-ctxt-current-class-list))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 (when prefix
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
384 (require 'semantic/analyze)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 (semantic-analyze-context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 "Context-for-texinfo"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 :buffer (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 :scope nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 :bounds bounds
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 :prefix prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 :prefixtypes nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 :prefixclass prefixclass)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (defvar semantic-texi-command-completion-list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (append (mapcar (lambda (a) (car a)) texinfo-section-list)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 texinfo-environments
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 (error
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 ;; XEmacs doesn't use the above. Split up its regexp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (split-string texinfo-environment-regexp "\\\\|\\|\\^@\\\\(\\|\\\\)")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 ;; Is there a better list somewhere? Here are few
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 ;; of the top of my head.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 "anchor" "asis"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 "bullet"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 "code" "copyright"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 "defun" "deffn" "defoption" "defvar" "dfn"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 "emph" "end"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 "ifinfo" "iftex" "inforef" "item" "itemx"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 "kdb"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 "node"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 "ref"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 "set" "setfilename" "settitle"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 "value" "var"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 "xref"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 "List of commands that we might bother completing.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 (define-mode-local-override semantic-analyze-possible-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 texinfo-mode (context)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 "List smart completions at point.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 Since texinfo is not a programming language the default version is not
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 useful. Insted, look at the current symbol. If it is a command
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 do primitive texinfo built ins. If not, use ispell to lookup words
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 that start with that symbol."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 (let ((prefix (car (oref context :prefix)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 (cond ((member 'function (oref context :prefixclass))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 ;; Do completion for texinfo commands
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 (let* ((cmd (substring prefix 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (lst (all-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 cmd semantic-texi-command-completion-list)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (mapcar (lambda (f) (semantic-tag (concat "@" f) 'function))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 lst))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 ((member 'word (oref context :prefixclass))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 ;; Do completion for words via ispell.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (require 'ispell)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (let ((word-list (lookup-words prefix)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 (mapcar (lambda (f) (semantic-tag f 'word)) word-list))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (t nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 ;;; Parser Setup
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 ;;
105804
91f3ea36baf8 Suppress harmless warnings about setting up semantic-imenu (not part
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
450 ;; In semantic-imenu.el, not part of Emacs.
91f3ea36baf8 Suppress harmless warnings about setting up semantic-imenu (not part
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
451 (defvar semantic-imenu-expandable-tag-classes)
91f3ea36baf8 Suppress harmless warnings about setting up semantic-imenu (not part
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
452 (defvar semantic-imenu-bucketize-file)
91f3ea36baf8 Suppress harmless warnings about setting up semantic-imenu (not part
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
453 (defvar semantic-imenu-bucketize-type-members)
91f3ea36baf8 Suppress harmless warnings about setting up semantic-imenu (not part
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
454
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 (defun semantic-default-texi-setup ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 "Set up a buffer for parsing of Texinfo files."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 ;; This will use our parser.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (semantic-install-function-overrides
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 '((parse-region . semantic-texi-parse-region)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (parse-changes . semantic-texi-parse-changes)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (setq semantic-parser-name "TEXI"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 ;; Setup a dummy parser table to enable parsing!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 semantic--parse-table t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 imenu-create-index-function 'semantic-create-imenu-index
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 semantic-command-separation-character "@"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 semantic-type-relation-separator-character '(":")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 semantic-symbol->name-assoc-list '((section . "Section")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 (def . "Definition")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 semantic-imenu-expandable-tag-classes '(section)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 semantic-imenu-bucketize-file nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 semantic-imenu-bucketize-type-members nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 senator-step-at-start-end-tag-classes '(section)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 semantic-stickyfunc-sticky-classes '(section)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 )
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
476 ;; (local-set-key [(f9)] 'semantic-texi-update-doc-from-texi)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 (add-hook 'texinfo-mode-hook 'semantic-default-texi-setup)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 ;;; Special features of Texinfo tag streams
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 ;; This section provides specialized access into texinfo files.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 ;; Because texinfo files often directly refer to functions and programs
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 ;; it is useful to access the texinfo file from the C code for document
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 ;; maintainance.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 (defun semantic-texi-associated-files (&optional buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 "Find texinfo files associated with BUFFER."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (if buffer (set-buffer buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (cond ((and (fboundp 'ede-documentation-files)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 ede-minor-mode (ede-current-project))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 ;; When EDE is active, ask it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 (ede-documentation-files)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 )
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
497 ((and (featurep 'semantic/db) (semanticdb-minor-mode-p))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 ;; See what texinfo files we have loaded in the database
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (let ((tabs (semanticdb-get-database-tables
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 semanticdb-current-database))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (r nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (while tabs
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 (if (eq (oref (car tabs) major-mode) 'texinfo-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 (setq r (cons (oref (car tabs) file) r)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (setq tabs (cdr tabs)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 r))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 (directory-files default-directory nil "\\.texi$"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 ;; Turns out this might not be useful.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 ;; Delete later if that is true.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 (defun semantic-texi-find-documentation (name &optional type)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 "Find the function or variable NAME of TYPE in the texinfo source.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 NAME is a string representing some functional symbol.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 TYPE is a string, such as \"variable\" or \"Command\" used to find
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 the correct definition in case NAME qualifies as several things.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 When this function exists, POINT is at the definition.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 If the doc was not found, an error is thrown.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 Note: TYPE not yet implemented."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 (let ((f (semantic-texi-associated-files))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 stream match)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (while (and f (not match))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (unless stream
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (with-current-buffer (find-file-noselect (car f))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (setq stream (semantic-fetch-tags))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (setq match (semantic-find-first-tag-by-name name stream))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 (when match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 (set-buffer (semantic-tag-buffer match))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (goto-char (semantic-tag-start match)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 (setq f (cdr f)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
533 ;; (defun semantic-texi-update-doc-from-texi (&optional tag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
534 ;; "Update the documentation in the texinfo deffn class tag TAG.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
535 ;; The current buffer must be a texinfo file containing TAG.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
536 ;; If TAG is nil, determine a tag based on the current position."
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
537 ;; (interactive)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
538 ;; (unless (or (featurep 'semantic/db)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
539 ;; (require 'semantic/db-mode)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
540 ;; (semanticdb-minor-mode-p))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
541 ;; (error "Texinfo updating only works when `semanticdb' is being used"))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
542 ;; (semantic-fetch-tags)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
543 ;; (unless tag
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
544 ;; (beginning-of-line)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
545 ;; (setq tag (semantic-current-tag)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
546 ;; (unless (semantic-tag-of-class-p tag 'def)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
547 ;; (error "Only deffns (or defun or defvar) can be updated"))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
548 ;; (let* ((name (semantic-tag-name tag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
549 ;; (tags (semanticdb-strip-find-results
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
550 ;; (semanticdb-with-match-any-mode
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
551 ;; (semanticdb-brute-deep-find-tags-by-name name))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
552 ;; 'name))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
553 ;; (docstring nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
554 ;; (docstringproto nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
555 ;; (docstringvar nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
556 ;; (doctag nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
557 ;; (doctagproto nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
558 ;; (doctagvar nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
559 ;; )
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
560 ;; (save-excursion
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
561 ;; (while (and tags (not docstring))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
562 ;; (let ((sourcetag (car tags)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
563 ;; ;; There could be more than one! Come up with a better
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
564 ;; ;; solution someday.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
565 ;; (when (semantic-tag-buffer sourcetag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
566 ;; (set-buffer (semantic-tag-buffer sourcetag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
567 ;; (unless (eq major-mode 'texinfo-mode)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
568 ;; (cond ((semantic-tag-get-attribute sourcetag :prototype-flag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
569 ;; ;; If we found a match with doc that is a prototype, then store
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
570 ;; ;; that, but don't exit till we find the real deal.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
571 ;; (setq docstringproto (semantic-documentation-for-tag sourcetag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
572 ;; doctagproto sourcetag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
573 ;; ((eq (semantic-tag-class sourcetag) 'variable)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
574 ;; (setq docstringvar (semantic-documentation-for-tag sourcetag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
575 ;; doctagvar sourcetag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
576 ;; ((semantic-tag-get-attribute sourcetag :override-function-flag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
577 ;; nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
578 ;; (t
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
579 ;; (setq docstring (semantic-documentation-for-tag sourcetag))))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
580 ;; (setq doctag (if docstring sourcetag nil))))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
581 ;; (setq tags (cdr tags)))))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
582 ;; ;; If we found a prototype of the function that has some doc, but not the
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
583 ;; ;; actual function, lets make due with that.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
584 ;; (if (not docstring)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
585 ;; (cond ((stringp docstringvar)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
586 ;; (setq docstring docstringvar
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
587 ;; doctag doctagvar))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
588 ;; ((stringp docstringproto)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
589 ;; (setq docstring docstringproto
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
590 ;; doctag doctagproto))))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
591 ;; ;; Test for doc string
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
592 ;; (unless docstring
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
593 ;; (error "Could not find documentation for %s" (semantic-tag-name tag)))
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
594 ;;
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
595 ;; (require 'srecode)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
596 ;; (require 'srecode-texi)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
597 ;;
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
598 ;; ;; If we have a string, do the replacement.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
599 ;; (delete-region (semantic-tag-start tag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
600 ;; (semantic-tag-end tag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
601 ;; ;; Use useful functions from the docaument library.
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
602 ;; (srecode-texi-insert-tag-as-doc doctag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
603 ;; ;(semantic-insert-foreign-tag doctag)
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
604 ;; ))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
606 ;; (defun semantic-texi-update-doc-from-source (&optional tag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
607 ;; "Update the documentation for the source TAG.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
608 ;; The current buffer must be a non-texinfo source file containing TAG.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
609 ;; If TAG is nil, determine the tag based on the current position.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
610 ;; The current buffer must include TAG."
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
611 ;; (interactive)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
612 ;; (when (eq major-mode 'texinfo-mode)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
613 ;; (error "Not a source file"))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
614 ;; (semantic-fetch-tags)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
615 ;; (unless tag
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
616 ;; (setq tag (semantic-current-tag)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
617 ;; (unless (semantic-documentation-for-tag tag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
618 ;; (error "Cannot find interesting documentation to use for %s"
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
619 ;; (semantic-tag-name tag)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
620 ;; (let* ((name (semantic-tag-name tag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
621 ;; (texi (semantic-texi-associated-files))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
622 ;; (doctag nil)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
623 ;; (docbuff nil))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
624 ;; (while (and texi (not doctag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
625 ;; (set-buffer (find-file-noselect (car texi)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
626 ;; (setq doctag (car (semantic-deep-find-tags-by-name
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
627 ;; name (semantic-fetch-tags)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
628 ;; docbuff (if doctag (current-buffer) nil))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
629 ;; (setq texi (cdr texi)))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
630 ;; (unless doctag
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
631 ;; (error "Tag %s is not yet documented. Use the `document' command"
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
632 ;; name))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
633 ;; ;; Ok, we should have everything we need. Do the deed.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
634 ;; (if (get-buffer-window docbuff)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
635 ;; (set-buffer docbuff)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
636 ;; (switch-to-buffer docbuff))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
637 ;; (goto-char (semantic-tag-start doctag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
638 ;; (delete-region (semantic-tag-start doctag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
639 ;; (semantic-tag-end doctag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
640 ;; ;; Use useful functions from the document library.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
641 ;; (require 'document)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
642 ;; (document-insert-texinfo tag (semantic-tag-buffer tag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
643 ;; ))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
645 ;; (defun semantic-texi-update-doc (&optional tag)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
646 ;; "Update the documentation for TAG.
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
647 ;; If the current buffer is a texinfo file, then find the source doc, and
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
648 ;; update it. If the current buffer is a source file, then get the
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
649 ;; documentation for this item, find the existing doc in the associated
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
650 ;; manual, and update that."
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
651 ;; (interactive)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
652 ;; (cond ;;((eq major-mode 'texinfo-mode)
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
653 ;; ;; (semantic-texi-update-doc-from-texi tag))
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
654 ;; (t
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
655 ;; (semantic-texi-update-doc-from-source tag))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 (defun semantic-texi-goto-source (&optional tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 "Jump to the source for the definition in the texinfo file TAG.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 If TAG is nil, it is derived from the deffn under POINT."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 (interactive)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
661 (unless (or (featurep 'semantic/db) (semanticdb-minor-mode-p))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (error "Texinfo updating only works when `semanticdb' is being used"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (semantic-fetch-tags)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (unless tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 (beginning-of-line)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 (setq tag (semantic-current-tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 (unless (semantic-tag-of-class-p tag 'def)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 (error "Only deffns (or defun or defvar) can be updated"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (let* ((name (semantic-tag-name tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 (tags (semanticdb-fast-strip-find-results
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 (semanticdb-with-match-any-mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (semanticdb-brute-deep-find-tags-by-name name nil 'name))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (done nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 (while (and tags (not done))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (set-buffer (semantic-tag-buffer (car tags)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (unless (eq major-mode 'texinfo-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 (switch-to-buffer (semantic-tag-buffer (car tags)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (goto-char (semantic-tag-start (car tags)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (setq done t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (setq tags (cdr tags)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (if (not done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 (error "Could not find tag for %s" (semantic-tag-name tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 (provide 'semantic/texi)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105340
diff changeset
691 ;; arch-tag: a8649049-46da-407b-a620-d175c1fedca6
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104439
diff changeset
692 ;;; semantic/texi.el ends here