Mercurial > emacs
annotate lisp/cedet/semantic/db-mode.el @ 107439:ed20cbe62401
Remove support for Solaris on PPC and for old versions.
* s/sol2-6.h: Add the contents of s/sol-2.3.h, s/sol-2.4.h, s/sol-2.5.h.
(LD_SWITCH_SYSTEM, USE_MMAP_FOR_BUFFERS): Remove #defines/#undef
that cancel each other.
* s/sol2-3.h:
* s/sol2-4.h:
* s/sol2-5.h: Remove.
* m/ibmrs6000.h: Remove code for USG5_4, this file is only used on AIX.
(NO_REMAP): Remove, unused.
(UNEXEC): Move definition ...
* s/aix4-2.h (UNEXEC): ... here.
* configure.in: Remove support for Solaris on PPC and for old versions.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 19 Mar 2010 22:52:55 -0700 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/db-mode.el --- Semanticdb Minor Mode |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; (at your option) any later version. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Major mode for managing Semantic Databases automatically. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;;; Code: |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104436
diff
changeset
|
27 |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104524
diff
changeset
|
28 (require 'semantic/db) |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104436
diff
changeset
|
29 |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104436
diff
changeset
|
30 (declare-function semantic-lex-spp-set-dynamic-table "semantic/lex-spp") |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;;; Start/Stop database use |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (defvar semanticdb-hooks |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104474
diff
changeset
|
35 '((semanticdb-semantic-init-hook-fcn semantic-init-db-hook) |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (semanticdb-synchronize-table semantic-after-toplevel-cache-change-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (semanticdb-partial-synchronize-table semantic-after-partial-cache-change-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (semanticdb-revert-hook before-revert-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (semanticdb-kill-hook kill-buffer-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (semanticdb-kill-hook change-major-mode-hook) ;; Not really a kill, but we need the same effect. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (semanticdb-kill-emacs-hook kill-emacs-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (semanticdb-save-all-db-idle auto-save-hook) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 "List of hooks and values to add/remove when configuring semanticdb.") |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;;; SEMANTICDB-MODE |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;; |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
48 ;;;###autoload |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (defun semanticdb-minor-mode-p () |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 "Return non-nil if `semanticdb-minor-mode' is active." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (member (car (car semanticdb-hooks)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (symbol-value (car (cdr (car semanticdb-hooks)))))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 |
104474
309eba6102e8
lisp/cedet/semantic/db-mode.el (global-semanticdb-minor-mode): Autoload.
Chong Yidong <cyd@stupidchicken.com>
parents:
104447
diff
changeset
|
54 ;;;###autoload |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
55 (define-minor-mode global-semanticdb-minor-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
56 "Toggle Semantic DB mode. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
57 With ARG, turn Semantic DB mode on if ARG is positive, off otherwise. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
58 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
59 In Semantic DB mode, Semantic parsers store results in a |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
60 database, which can be saved for future Emacs sessions." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
61 :global t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
62 :group 'semantic |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
63 (if global-semanticdb-minor-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
64 ;; Enable |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
65 (dolist (elt semanticdb-hooks) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
66 (add-hook (cadr elt) (car elt))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
67 ;; Disable |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
68 (dolist (elt semanticdb-hooks) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
69 (add-hook (cadr elt) (car elt))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
70 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
71 (defvaralias 'semanticdb-mode-hook 'global-semanticdb-minor-mode-hook) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
72 (defvaralias 'semanticdb-global-mode 'global-semanticdb-minor-mode) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
73 (semantic-varalias-obsolete 'semanticdb-mode-hooks |
105760
d0906291f75b
* cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
74 'global-semanticdb-minor-mode-hook "23.2") |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
75 |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (defun semanticdb-toggle-global-mode () |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 "Toggle use of the Semantic Database feature. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 Update the environment of Semantic enabled buffers accordingly." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (interactive) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (if (semanticdb-minor-mode-p) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 ;; Save databases before disabling semanticdb. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (semanticdb-save-all-db)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 ;; Toggle semanticdb minor mode. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (global-semanticdb-minor-mode)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 ;;; Hook Functions: |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 ;; |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ;; Functions used in hooks to keep SemanticDB operating. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ;; |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (defun semanticdb-semantic-init-hook-fcn () |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104474
diff
changeset
|
92 "Function saved in `semantic-init-db-hook'. |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 Sets up the semanticdb environment." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ;; Only initialize semanticdb if we have a file name. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ;; There is no reason to cache a tag table if there is no |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ;; way to load it back in later. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (when (buffer-file-name) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (let* ((ans (semanticdb-create-table-for-file (buffer-file-name))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (cdb (car ans)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (ctbl (cdr ans)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 ;; Get the current DB for this directory |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (setq semanticdb-current-database cdb) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 ;; We set the major mode because we know what it is. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (oset ctbl major-mode major-mode) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ;; Local state |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (setq semanticdb-current-table ctbl) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 ;; Try to swap in saved tags |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (if (or (not (slot-boundp ctbl 'tags)) (not (oref ctbl tags)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (/= (or (oref ctbl pointmax) 0) (point-max)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (semantic-clear-toplevel-cache) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ;; Unmatched syntax |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (condition-case nil |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (semantic-set-unmatched-syntax-cache |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (oref ctbl unmatched-syntax)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (unbound-slot |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 ;; Old version of the semanticdb table can miss the unmatched |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 ;; syntax slot. If so, just clear the unmatched syntax cache. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (semantic-clear-unmatched-syntax-cache) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 ;; Make sure it has a value. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (oset ctbl unmatched-syntax nil) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 )) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 ;; Keep lexical tables up to date. Don't load |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 ;; semantic-spp if it isn't needed. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (let ((lt (oref ctbl lexical-table))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (when lt |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (require 'semantic/lex-spp) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (semantic-lex-spp-set-dynamic-table lt))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 ;; Set the main tag cache. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 ;; This must happen after setting up buffer local variables |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;; since this will turn around and re-save those variables. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (semantic--set-buffer-cache (oref ctbl tags)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; Don't need it to be dirty. Set dirty due to hooks from above. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (oset ctbl dirty nil) ;; Special case here. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (oset ctbl buffer (current-buffer)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 ;; Bind into the buffer. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (semantic--tag-link-cache-to-buffer) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (defun semanticdb-revert-hook () |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 "Hook run before a revert buffer. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 We can't track incremental changes due to a revert, so just clear the cache. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 This will prevent the next batch of hooks from wasting time parsing things |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 that don't need to be parsed." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (if (and (semantic-active-p) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 semantic--buffer-cache |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 semanticdb-current-table) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (semantic-clear-toplevel-cache))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (defun semanticdb-kill-hook () |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 "Function run when a buffer is killed. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 If there is a semantic cache, slurp out the overlays, and store |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 it in our database. If that buffer has no cache, ignore it, we'll |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 handle it later if need be." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (when (and (semantic-active-p) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 semantic--buffer-cache |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 semanticdb-current-table) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 ;; Try to get a fast update. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (semantic-fetch-tags-fast) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 ;; If the buffer is in a bad state, don't save anything... |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (if (semantic-parse-tree-needs-rebuild-p) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 ;; If this is the case, don't save anything. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (progn |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (semantic-clear-toplevel-cache) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (oset semanticdb-current-table pointmax 0) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (oset semanticdb-current-table fsize 0) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (oset semanticdb-current-table lastmodtime nil) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 ;; We have a clean buffer, save it off. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (condition-case nil |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (progn |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (semantic--tag-unlink-cache-from-buffer) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 ;; Set pointmax only if we had some success in the unlink. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (oset semanticdb-current-table pointmax (point-max)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (let ((fattr (file-attributes |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (semanticdb-full-filename |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 semanticdb-current-table)))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (oset semanticdb-current-table fsize (nth 7 fattr)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (oset semanticdb-current-table lastmodtime (nth 5 fattr)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (oset semanticdb-current-table buffer nil) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 )) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; If this messes up, just clear the system |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (error |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (semantic-clear-toplevel-cache) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (message "semanticdb: Failed to deoverlay tag cache."))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 ) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 )) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (defun semanticdb-kill-emacs-hook () |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 "Function called when Emacs is killed. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 Save all the databases." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (semanticdb-save-all-db)) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ;;; SYNCHRONIZATION HOOKS |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 ;; |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (defun semanticdb-synchronize-table (new-table) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 "Function run after parsing. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 Argument NEW-TABLE is the new table of tags." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (when semanticdb-current-table |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (semanticdb-synchronize semanticdb-current-table new-table))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (defun semanticdb-partial-synchronize-table (new-table) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 "Function run after parsing. |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 Argument NEW-TABLE is the new table of tags." |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (when semanticdb-current-table |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (semanticdb-partial-synchronize semanticdb-current-table new-table))) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (provide 'semantic/db-mode) |
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
215 ;; Local variables: |
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
216 ;; generated-autoload-file: "loaddefs.el" |
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
217 ;; generated-autoload-load-name: "semantic/db-mode" |
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
218 ;; End: |
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
219 |
105377 | 220 ;; arch-tag: f5da903d-2d34-4adf-8572-e60340e1ad59 |
104436
b9b48267c7d3
cedet/semantic/db-mode.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ;;; semantic/db-mode.el ends here |