annotate lisp/cedet/semantic/idle.el @ 110763:0fe64d68a522

Merge changes made in Gnus trunk. shr.el: Implement table rendering. shr.el (shr-make-table): Tweak table generation. shr.el (shr-make-table): Fix typo. nnimap.el (nnimap-open-connection): Allow tls as a synonym for ssl. gnus-util.el (gnus-emacs-completing-read): Mapcar collection to list, for XEmacs. nnimap.el (nnimap-close-server): Implement. gnus-salt.el: Remove all gnus-carpal stuff -- it's not useful. nnir.el (nnir-run-imap): Remove spurious space in search string. message.el (message-idna-to-ascii-rhs-1): Don't bug out on addresses without @ signs. gnus-sum.el (gnus-widen-article-window): New variable. shr.el (browse-url): Required. shr.el (shr-ensure-paragraph): Don't insert a new newline after empty-ish lines. shr.el (shr-show-alt-text, shr-browse-image): New commands. gravatar.el (gravatar-retrieved): kill buffer when retrieved. shr.el (shr-browse-url, shr-copy-url): New commands. shr.el (shr-render-td): Protect against too-wide text. spam-report.el (spam-report-url-ping-plain): Don't query about killing the process. nnimap.el (nnimap-finish-retrieve-group-infos): Message while waiting for data. shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. mml-smime.el: Fix gnus-completing-read usage. shr.el (shr-get-image-data): Ensure against the cache file missing. nnimap.el (nnimap-open-connection): Give an error if nnimap-stream is unknown.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Mon, 04 Oct 2010 22:26:51 +0000
parents b799d38f522a
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; idle.el --- Schedule parsing tasks in idle time
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: 106211
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105260
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 ;; Keywords: syntax
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; 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
12 ;; 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
13 ;; 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
14 ;; (at your option) any later version.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; 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
17 ;; 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
18 ;; 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
19 ;; GNU General Public License for more details.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; 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
22 ;; 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
23
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; Originally, `semantic-auto-parse-mode' handled refreshing the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; tags in a buffer in idle time. Other activities can be scheduled
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; in idle time, all of which require up-to-date tag tables.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; Having a specialized idle time scheduler that first refreshes
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; the tags buffer, and then enables other idle time tasks reduces
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; the amount of work needed. Any specialized idle tasks need not
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; ask for a fresh tags list.
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 ;; NOTE ON SEMANTIC_ANALYZE
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;; Some of the idle modes use the semantic analyzer. The analyzer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;; automatically caches the created context, so it is shared amongst
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 ;; all idle modes that will need it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
40 (require 'semantic)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
41 (require 'semantic/ctxt)
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
42 (require 'semantic/format)
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
43 (require 'semantic/tag)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (require 'timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
46 ;; For the semantic-find-tags-by-name macro.
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
47 (eval-when-compile (require 'semantic/find))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
48
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
49 (defvar eldoc-last-message)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
50 (declare-function eldoc-message "eldoc")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
51 (declare-function semantic-analyze-interesting-tag "semantic/analyze")
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
52 (declare-function semantic-analyze-unsplit-name "semantic/analyze/fcn")
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
53 (declare-function semantic-complete-analyze-inline-idle "semantic/complete")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
54 (declare-function semanticdb-deep-find-tags-by-name "semantic/db-find")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
55 (declare-function semanticdb-save-all-db-idle "semantic/db")
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
56 (declare-function semanticdb-typecache-refresh-for-buffer "semantic/db-typecache")
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
57 (declare-function semantic-decorate-flush-pending-decorations
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
58 "semantic/decorate/mode")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
59 (declare-function pulse-momentary-highlight-region "pulse")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
60 (declare-function pulse-momentary-highlight-overlay "pulse")
104454
e4842bf0f303 lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
61 (declare-function semantic-symref-hits-in-region "semantic/symref/filter")
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
62
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 ;;; Code:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 ;;; TIMER RELATED FUNCTIONS
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (defvar semantic-idle-scheduler-timer nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 "Timer used to schedule tasks in idle time.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 (defvar semantic-idle-scheduler-work-timer nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 "Timer used to schedule tasks in idle time that may take a while.")
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 (defcustom semantic-idle-scheduler-verbose-flag nil
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents: 104514
diff changeset
74 "Non-nil means that the idle scheduler should provide debug messages.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 Use this setting to debug idle activities."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 :type 'boolean)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents: 104514
diff changeset
79 (defcustom semantic-idle-scheduler-idle-time 1
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents: 104514
diff changeset
80 "Time in seconds of idle before scheduling events.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 This time should be short enough to ensure that idle-scheduler will be
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 run as soon as Emacs is idle."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 :type 'number
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 :set (lambda (sym val)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 (set-default sym val)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (when (timerp semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (cancel-timer semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (setq semantic-idle-scheduler-timer nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (semantic-idle-scheduler-setup-timers))))
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 (defcustom semantic-idle-scheduler-work-idle-time 60
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents: 104514
diff changeset
93 "Time in seconds of idle before scheduling big work.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 This time should be long enough that once any big work is started, it is
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 unlikely the user would be ready to type again right away."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 :type 'number
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 :set (lambda (sym val)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (set-default sym val)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (when (timerp semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (cancel-timer semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (setq semantic-idle-scheduler-timer nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (semantic-idle-scheduler-setup-timers))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (defun semantic-idle-scheduler-setup-timers ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 "Lazy initialization of the auto parse idle timer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 ;; REFRESH THIS FUNCTION for XEMACS FOIBLES
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (or (timerp semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (setq semantic-idle-scheduler-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (run-with-idle-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 semantic-idle-scheduler-idle-time t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 #'semantic-idle-scheduler-function)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (or (timerp semantic-idle-scheduler-work-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (setq semantic-idle-scheduler-work-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (run-with-idle-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 semantic-idle-scheduler-work-idle-time t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 #'semantic-idle-scheduler-work-function)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (defun semantic-idle-scheduler-kill-timer ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 "Kill the auto parse idle timer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (if (timerp semantic-idle-scheduler-timer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (cancel-timer semantic-idle-scheduler-timer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (setq semantic-idle-scheduler-timer nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ;;; MINOR MODE
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ;; The minor mode portion of this code just sets up the minor mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 ;; which does the initial scheduling of the idle timers.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (defcustom semantic-idle-scheduler-mode-hook nil
106150
269b53d49dd9 * cedet/cedet.el (cedet-menu-map): Re-order menu items.
Chong Yidong <cyd@stupidchicken.com>
parents: 106029
diff changeset
134 "Hook run at the end of the function `semantic-idle-scheduler-mode'."
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 :type 'hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (defvar semantic-idle-scheduler-mode nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 "Non-nil if idle-scheduler minor mode is enabled.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 Use the command `semantic-idle-scheduler-mode' to change this variable.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 (make-variable-buffer-local 'semantic-idle-scheduler-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (defcustom semantic-idle-scheduler-max-buffer-size 0
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 "*Maximum size in bytes of buffers where idle-scheduler is enabled.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 If this value is less than or equal to 0, idle-scheduler is enabled in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 all buffers regardless of their size."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 :type 'number)
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 (defsubst semantic-idle-scheduler-enabled-p ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 "Return non-nil if idle-scheduler is enabled for this buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 idle-scheduler is disabled when debugging or if the buffer size
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 exceeds the `semantic-idle-scheduler-max-buffer-size' threshold."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (and semantic-idle-scheduler-mode
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
155 (not (and (boundp 'semantic-debug-enabled)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104429
diff changeset
156 semantic-debug-enabled))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (not semantic-lex-debug)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (or (<= semantic-idle-scheduler-max-buffer-size 0)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (< (buffer-size) semantic-idle-scheduler-max-buffer-size))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160
104463
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
161 ;;;###autoload
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
162 (define-minor-mode semantic-idle-scheduler-mode
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 "Minor mode to auto parse buffer following a change.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 When this mode is off, a buffer is only rescanned for tokens when
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 some command requests the list of available tokens. When idle-scheduler
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 is enabled, Emacs periodically checks to see if the buffer is out of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 date, and reparses while the user is idle (not typing.)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 With prefix argument ARG, turn on if positive, otherwise off. The
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 minor mode can be turned on only if semantic feature is available and
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 the current buffer was set up for parsing. Return non-nil if the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 minor mode is enabled."
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
173 nil nil nil
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
174 (if semantic-idle-scheduler-mode
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
175 (if (not (and (featurep 'semantic) (semantic-active-p)))
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
176 (progn
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
177 ;; Disable minor mode if semantic stuff not available
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
178 (setq semantic-idle-scheduler-mode nil)
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
179 (error "Buffer %s was not set up idle time scheduling"
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
180 (buffer-name)))
108211
73a1ddc06d0e Use a mode-line spec rather than a static string in Semantic.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 108210
diff changeset
181 (semantic-idle-scheduler-setup-timers))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (semantic-add-minor-mode 'semantic-idle-scheduler-mode
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
184 "ARP")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 ;;; SERVICES services
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 ;; These are services for managing idle services.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (defvar semantic-idle-scheduler-queue nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 "List of functions to execute during idle time.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 These functions will be called in the current buffer after that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 buffer has had its tags made up to date. These functions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 will not be called if there are errors parsing the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 current buffer.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (defun semantic-idle-scheduler-add (function)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 "Schedule FUNCTION to occur during idle time."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (add-to-list 'semantic-idle-scheduler-queue function))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (defun semantic-idle-scheduler-remove (function)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 "Unschedule FUNCTION to occur during idle time."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (setq semantic-idle-scheduler-queue
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (delete function semantic-idle-scheduler-queue)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 ;;; IDLE Function
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (defun semantic-idle-core-handler ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 "Core idle function that handles reparsing.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 And also manages services that depend on tag values."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (message "IDLE: Core handler..."))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (semantic-exit-on-input 'idle-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 (let* ((inhibit-quit nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (buffers (delq (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (delq nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 (mapcar #'(lambda (b)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (and (buffer-file-name b)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 b))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (buffer-list)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 safe ;; This safe is not used, but could be.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 others
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (when (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 ;; First, reparse the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (setq mode major-mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 safe (semantic-safe "Idle Parse Error: %S"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 ;(error "Goofy error 1")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (semantic-idle-scheduler-refresh-tags)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 ;; Now loop over other buffers with same major mode, trying to
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 ;; update them as well. Stop on keypress.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (dolist (b buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (semantic-throw-on-input 'parsing-mode-buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (with-current-buffer b
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (if (eq major-mode mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (and (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (semantic-safe "Idle Parse Error: %S"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 ;(error "Goofy error")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (semantic-idle-scheduler-refresh-tags)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (push (current-buffer) others))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (setq buffers others))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;; If re-parse of current buffer completed, evaluate all other
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;; services. Stop on keypress.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 ;; NOTE ON COMMENTED SAFE HERE
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 ;; We used to not execute the services if the buffer wsa
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 ;; unparseable. We now assume that they are lexically
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 ;; safe to do, because we have marked the buffer unparseable
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 ;; if there was a problem.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 ;;(when safe
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (dolist (service semantic-idle-scheduler-queue)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 (semantic-throw-on-input 'idle-queue)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (message "IDLE: execture service %s..." service))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (semantic-safe (format "Idle Service Error %s: %%S" service)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (funcall service))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (message "IDLE: execture service %s...done" service))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 )))
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 ;; Finally loop over remaining buffers, trying to update them as
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 ;; well. Stop on keypress.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (dolist (b buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (semantic-throw-on-input 'parsing-other-buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (with-current-buffer b
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (and (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (semantic-idle-scheduler-refresh-tags)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 (message "IDLE: Core handler...done")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 (defun semantic-debug-idle-function ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 "Run the Semantic idle function with debugging turned on."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (let ((debug-on-error t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (semantic-idle-core-handler)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 ))
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 (defun semantic-idle-scheduler-function ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 "Function run when after `semantic-idle-scheduler-idle-time'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 This function will reparse the current buffer, and if successful,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 call additional functions registered with the timer calls."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (when (zerop (recursion-depth))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (let ((debug-on-error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 (save-match-data (semantic-idle-core-handler))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 ;;; WORK FUNCTION
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 ;; Unlike the shorter timer, the WORK timer will kick of tasks that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; may take a long time to complete.
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
298 (defcustom semantic-idle-work-parse-neighboring-files-flag nil
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 "*Non-nil means to parse files in the same dir as the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 Disable to prevent lots of excessive parsing in idle time."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 :type 'boolean)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
304 (defcustom semantic-idle-work-update-headers-flag nil
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
305 "*Non-nil means to parse through header files in idle time.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
306 Disable to prevent idle time parsing of many files. If completion
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
307 is called that work will be done then instead."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
308 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
309 :type 'boolean)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (defun semantic-idle-work-for-one-buffer (buffer)
106860
4cf58c2379f4 Mario Lang <mlang@delysid.org>: Remove some duplicated words.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
312 "Do long-processing work for BUFFER.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 Uses `semantic-safe' and returns the output.
106878
ba25499d625a (semantic-idle-work-for-one-buffer): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 106860
diff changeset
314 Returns t if all processing succeeded."
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105789
diff changeset
315 (with-current-buffer buffer
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 (not (and
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 ;; Just in case
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (semantic-safe "Idle Work Parse Error: %S"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (semantic-idle-scheduler-refresh-tags)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
322 ;; Option to disable this work.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
323 semantic-idle-work-update-headers-flag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
324
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 ;; Force all our include files to get read in so we
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 ;; are ready to provide good smart completion and idle
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 ;; summary information
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (semantic-safe "Idle Work Including Error: %S"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 ;; Get the include related path.
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
330 (when (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
331 (require 'semantic/db-find)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (semanticdb-find-translate-path buffer nil)
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 t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 ;; Pre-build the typecaches as needed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 (semantic-safe "Idle Work Typecaching Error: %S"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (when (featurep 'semantic/db-typecache)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (semanticdb-typecache-refresh-for-buffer buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 ))
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
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (defun semantic-idle-work-core-handler ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 "Core handler for idle work processing of long running tasks.
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106878
diff changeset
346 Visits Semantic controlled buffers, and makes sure all needed
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 include files have been parsed, and that the typecache is up to date.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 Uses `semantic-idle-work-for-on-buffer' to do the work."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 (let ((errbuf nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (interrupted
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 (semantic-exit-on-input 'idle-work-timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (let* ((inhibit-quit nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (cb (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 (buffers (delq (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (delq nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (mapcar #'(lambda (b)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 (and (buffer-file-name b)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 b))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (buffer-list)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 safe errbuf)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 ;; First, handle long tasks in the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (when (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (setq safe (semantic-idle-work-for-one-buffer (current-buffer))
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 (not safe) (push (current-buffer) errbuf))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 ;; Now loop over other buffers with same major mode, trying to
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 ;; update them as well. Stop on keypress.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (dolist (b buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 (semantic-throw-on-input 'parsing-mode-buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (with-current-buffer b
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (when (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (and (semantic-idle-scheduler-enabled-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 (unless (semantic-idle-work-for-one-buffer (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (push (current-buffer) errbuf)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
380 (when (and (featurep 'semantic/db) (semanticdb-minor-mode-p))
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
381 ;; Save everything.
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
382 (semanticdb-save-all-db-idle)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
384 ;; Parse up files near our active buffer
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
385 (when semantic-idle-work-parse-neighboring-files-flag
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
386 (semantic-safe "Idle Work Parse Neighboring Files: %S"
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 (set-buffer cb)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 (semantic-idle-scheduler-work-parse-neighboring-files))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 t)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
390
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
391 ;; Save everything... again
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
392 (semanticdb-save-all-db-idle)
104419
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 ;; Done w/ processing
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 nil))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 ;; Done
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (if interrupted
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 "Interrupted"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (cond ((not errbuf)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 "done")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ((not (cdr errbuf))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (format "done with 1 error in %s" (car errbuf)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (format "done with errors in %d buffers."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (length errbuf)))))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (defun semantic-debug-idle-work-function ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 "Run the Semantic idle work function with debugging turned on."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 (let ((debug-on-error t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (semantic-idle-work-core-handler)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 (defun semantic-idle-scheduler-work-function ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 "Function run when after `semantic-idle-scheduler-work-idle-time'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 This routine handles difficult tasks that require a lot of parsing, such as
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 parsing all the header files used by our active sources, or building up complex
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 datasets."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (message "Long Work Idle Timer..."))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 (let ((exit-type (save-match-data
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 (semantic-idle-work-core-handler))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 (message "Long Work Idle Timer...%s" exit-type)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (defun semantic-idle-scheduler-work-parse-neighboring-files ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 "Parse all the files in similar directories to buffers being edited."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 ;; Lets check to see if EDE matters.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 (let ((ede-auto-add-method 'never))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (dolist (a auto-mode-alist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (when (eq (cdr a) major-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (dolist (file (directory-files default-directory t (car a) t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (semantic-throw-on-input 'parsing-mode-buffers)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (semanticdb-file-table-object file)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 ;;; REPARSING
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 ;; Reparsing is installed as semantic idle service.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 ;; This part ALWAYS happens, and other services occur
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 ;; afterwards.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
449 (defvar semantic-before-idle-scheduler-reparse-hook nil
104514
c65d65798b34 Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents: 104513
diff changeset
450 "Hook run before option `semantic-idle-scheduler' begins parsing.
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
451 If any hook function throws an error, this variable is reset to nil.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 This hook is not protected from lexical errors.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
454 (defvar semantic-after-idle-scheduler-reparse-hook nil
104514
c65d65798b34 Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents: 104513
diff changeset
455 "Hook run after option `semantic-idle-scheduler' has parsed.
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
456 If any hook function throws an error, this variable is reset to nil.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 This hook is not protected from lexical errors.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458
104514
c65d65798b34 Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents: 104513
diff changeset
459 (semantic-varalias-obsolete 'semantic-before-idle-scheduler-reparse-hooks
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
460 'semantic-before-idle-scheduler-reparse-hook "23.2")
104514
c65d65798b34 Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents: 104513
diff changeset
461 (semantic-varalias-obsolete 'semantic-after-idle-scheduler-reparse-hooks
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
462 'semantic-after-idle-scheduler-reparse-hook "23.2")
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
463
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 (defun semantic-idle-scheduler-refresh-tags ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 "Refreshes the current buffer's tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 This is called by `semantic-idle-scheduler-function' to update the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 tags in the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 Return non-nil if the refresh was successful.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 Return nil if there is some sort of syntax error preventing a full
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 reparse.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 Does nothing if the current buffer doesn't need reparsing."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 (prog1
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 ;; These checks actually occur in `semantic-fetch-tags', but if we
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 ;; do them here, then all the bovination hooks are not run, and
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 ;; we save lots of time.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 ;; If the buffer was previously marked unparseable,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 ;; then don't waste our time.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 ((semantic-parse-tree-unparseable-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 ;; The parse tree is already ok.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 ((semantic-parse-tree-up-to-date-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 ;; If the buffer might need a reparse and it is safe to do so,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 ;; give it a try.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 (let* (;(semantic-working-type nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (inhibit-quit nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 ;; (working-use-echo-area-p
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 ;; (not semantic-idle-scheduler-working-in-modeline-flag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 ;; (working-status-dynamic-type
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 ;; (if semantic-idle-scheduler-no-working-message
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 ;; nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 ;; working-status-dynamic-type))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 ;; (working-status-percentage-type
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 ;; (if semantic-idle-scheduler-no-working-message
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 ;; nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 ;; working-status-percentage-type))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (lexically-safe t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 ;; Let people hook into this, but don't let them hose
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 ;; us over!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 (condition-case nil
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
507 (run-hooks 'semantic-before-idle-scheduler-reparse-hook)
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
508 (error (setq semantic-before-idle-scheduler-reparse-hook nil)))
104419
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 (unwind-protect
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 ;; Perform the parsing.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 (message "IDLE: reparse %s..." (buffer-name)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (when (semantic-lex-catch-errors idle-scheduler
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 (save-excursion (semantic-fetch-tags))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 ;; If we are here, it is because the lexical step failed,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 ;; proably due to unterminated lists or something like that.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 ;; We do nothing, and just wait for the next idle timer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 ;; to go off. In the meantime, remember this, and make sure
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 ;; no other idle services can get executed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (setq lexically-safe nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (when semantic-idle-scheduler-verbose-flag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (message "IDLE: reparse %s...done" (buffer-name))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 ;; Let people hook into this, but don't let them hose
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 ;; us over!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 (condition-case nil
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
530 (run-hooks 'semantic-after-idle-scheduler-reparse-hook)
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104508
diff changeset
531 (error (setq semantic-after-idle-scheduler-reparse-hook nil))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 ;; Return if we are lexically safe (from prog1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 lexically-safe)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 ;; After updating the tags, handle any pending decorations for this
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 ;; buffer.
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
537 (require 'semantic/decorate/mode)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (semantic-decorate-flush-pending-decorations (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 ;;; IDLE SERVICES
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 ;; Idle Services are minor modes which enable or disable a services in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 ;; the idle scheduler. Creating a new services only requires calling
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 ;; `semantic-create-idle-services' which does all the setup
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 ;; needed to create the minor mode that will enable or disable
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 ;; a services. The services must provide a single function.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
550 ;; FIXME doc is incomplete.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 (defmacro define-semantic-idle-service (name doc &rest forms)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 "Create a new idle services with NAME.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 DOC will be a documentation string describing FORMS.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 FORMS will be called during idle time after the current buffer's
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 semantic tag information has been updated.
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106878
diff changeset
556 This routine creates the following functions and variables:"
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (let ((global (intern (concat "global-" (symbol-name name) "-mode")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (mode (intern (concat (symbol-name name) "-mode")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (hook (intern (concat (symbol-name name) "-mode-hook")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 (map (intern (concat (symbol-name name) "-mode-map")))
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
561 (func (intern (concat (symbol-name name) "-idle-function"))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 `(eval-and-compile
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
564 (define-minor-mode ,global
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
565 ,(concat "Toggle " (symbol-name global) ".
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
566 With ARG, turn the minor mode on if ARG is positive, off otherwise.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
567
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
568 When this minor mode is enabled, `" (symbol-name mode) "' is
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
569 turned on in every Semantic-supported buffer.")
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
570 :global t
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 :group 'semantic-modes
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 :require 'semantic/idle
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
574 (semantic-toggle-minor-mode-globally
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
575 ',mode (if ,global 1 -1)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
577 ;; FIXME: Get rid of this when define-minor-mode does it for us.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 (defcustom ,hook nil
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
579 ,(concat "Hook run at the end of function `" (symbol-name mode) "'.")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 :type 'hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 (defvar ,map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (let ((km (make-sparse-keymap)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 km)
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
586 ,(concat "Keymap for `" (symbol-name mode) "'."))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
588 (define-minor-mode ,mode
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
589 ,doc
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
590 :keymap ,map
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 (if ,mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (if (not (and (featurep 'semantic) (semantic-active-p)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 ;; Disable minor mode if semantic stuff not available
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (setq ,mode nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 (error "Buffer %s was not set up for parsing"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 (buffer-name)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 ;; Enable the mode mode
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
599 (semantic-idle-scheduler-add #',func))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 ;; Disable the mode mode
108211
73a1ddc06d0e Use a mode-line spec rather than a static string in Semantic.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 108210
diff changeset
601 (semantic-idle-scheduler-remove #',func)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 (semantic-add-minor-mode ',mode
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
604 "") ; idle schedulers are quiet?
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 (defun ,func ()
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
607 ,(concat "Perform idle activity for the minor mode `"
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
608 (symbol-name mode) "'.")
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
609 ,@forms))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 (put 'define-semantic-idle-service 'lisp-indent-function 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 ;;; SUMMARY MODE
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 ;; A mode similar to eldoc using semantic
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
616 (defcustom semantic-idle-truncate-long-summaries t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
617 "Truncate summaries that are too long to fit in the minibuffer.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
618 This can prevent minibuffer resizing in idle time."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
619 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
620 :type 'boolean)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 (defcustom semantic-idle-summary-function
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 'semantic-format-tag-summarize-with-file
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
624 "Function to call when displaying tag information during idle time.
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
625 This function should take a single argument, a Semantic tag, and
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
626 return a string to display.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 Some useful functions are found in `semantic-format-tag-functions'."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 :type semantic-format-tag-custom-list)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 (defsubst semantic-idle-summary-find-current-symbol-tag (sym)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632 "Search for a semantic tag with name SYM in database tables.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 Return the tag found or nil if not found.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 If semanticdb is not in use, use the current buffer only."
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
635 (car (if (and (featurep 'semantic/db)
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
636 semanticdb-current-database
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
637 (require 'semantic/db-find))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 (cdar (semanticdb-deep-find-tags-by-name sym))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 (semantic-deep-find-tags-by-name sym (current-buffer)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 (defun semantic-idle-summary-current-symbol-info-brutish ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 "Return a string message describing the current context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 Gets a symbol with `semantic-ctxt-current-thing' and then
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
644 tries to find it with a deep targeted search."
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 ;; Try the current "thing".
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 (let ((sym (car (semantic-ctxt-current-thing))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 (when sym
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 (semantic-idle-summary-find-current-symbol-tag sym))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 (defun semantic-idle-summary-current-symbol-keyword ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 "Return a string message describing the current symbol.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 Returns a value only if it is a keyword."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 ;; Try the current "thing".
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 (let ((sym (car (semantic-ctxt-current-thing))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 (if (and sym (semantic-lex-keyword-p sym))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 (semantic-lex-keyword-get sym 'summary))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 (defun semantic-idle-summary-current-symbol-info-context ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 "Return a string message describing the current context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 Use the semantic analyzer to find the symbol information."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 (let ((analysis (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (semantic-analyze-current-context (point))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (error nil))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (when analysis
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
665 (require 'semantic/analyze)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 (semantic-analyze-interesting-tag analysis))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 (defun semantic-idle-summary-current-symbol-info-default ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 "Return a string message describing the current context.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
670 This function will disable loading of previously unloaded files
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 by semanticdb as a time-saving measure."
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
672 (semanticdb-without-unloaded-file-searches
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
673 (save-excursion
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
674 ;; use whichever has success first.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
675 (or
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
676 (semantic-idle-summary-current-symbol-keyword)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
678 (semantic-idle-summary-current-symbol-info-context)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
680 (semantic-idle-summary-current-symbol-info-brutish)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
681 ))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (defvar semantic-idle-summary-out-of-context-faces
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 '(
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 font-lock-comment-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 font-lock-string-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 font-lock-doc-string-face ; XEmacs.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 font-lock-doc-face ; Emacs 21 and later.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 "List of font-lock faces that indicate a useless summary context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 Those are generally faces used to highlight comments.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 It might be useful to override this variable to add comment faces
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 specific to a major mode. For example, in jde mode:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 \(defvar-mode-local jde-mode semantic-idle-summary-out-of-context-faces
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 (append (default-value 'semantic-idle-summary-out-of-context-faces)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 '(jde-java-font-lock-doc-tag-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 jde-java-font-lock-link-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 jde-java-font-lock-bold-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 jde-java-font-lock-underline-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 jde-java-font-lock-pre-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 jde-java-font-lock-code-face)))")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 (defun semantic-idle-summary-useful-context-p ()
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106878
diff changeset
706 "Non-nil if we should show a summary based on context."
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 (if (and (boundp 'font-lock-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
708 font-lock-mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709 (memq (get-text-property (point) 'face)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 semantic-idle-summary-out-of-context-faces))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 ;; The best I can think of at the moment is to disable
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 ;; in comments by detecting with font-lock.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (define-overloadable-function semantic-idle-summary-current-symbol-info ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717 "Return a string message describing the current context.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 (make-obsolete-overload 'semantic-eldoc-current-symbol-info
105789
6df5ff499103 * cedet/mode-local.el (make-obsolete-overload): Add `when' argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105760
diff changeset
720 'semantic-idle-summary-current-symbol-info
6df5ff499103 * cedet/mode-local.el (make-obsolete-overload): Add `when' argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105760
diff changeset
721 "23.2")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
723 (defcustom semantic-idle-summary-mode-hook nil
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
724 "Hook run at the end of `semantic-idle-summary'."
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
725 :group 'semantic
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
726 :type 'hook)
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
727
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
728 (defun semantic-idle-summary-idle-function ()
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 "Display a tag summary of the lexical token under the cursor.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 Call `semantic-idle-summary-current-symbol-info' for getting the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 current tag to display information."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 (or (eq major-mode 'emacs-lisp-mode)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 (not (semantic-idle-summary-useful-context-p))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (let* ((found (semantic-idle-summary-current-symbol-info))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 (str (cond ((stringp found) found)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 ((semantic-tag-p found)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 (funcall semantic-idle-summary-function
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
738 found nil t)))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739 ;; Show the message with eldoc functions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (unless (and str (boundp 'eldoc-echo-area-use-multiline-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 eldoc-echo-area-use-multiline-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742 (let ((w (1- (window-width (minibuffer-window)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 (if (> (length str) w)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 (setq str (substring str 0 w)))))
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
745 ;; I borrowed some bits from eldoc to shorten the
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
746 ;; message.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
747 (when semantic-idle-truncate-long-summaries
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
748 (let ((ea-width (1- (window-width (minibuffer-window))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
749 (strlen (length str)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
750 (when (> strlen ea-width)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
751 (setq str (substring str 0 ea-width)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
752 ;; Display it
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 (eldoc-message str))))
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
754
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
755 (define-minor-mode semantic-idle-summary-mode
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
756 "Toggle Semantic Idle Summary mode.
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
757 With ARG, turn Semantic Idle Summary mode on if ARG is positive,
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
758 off otherwise.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
759
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
760 When this minor mode is enabled, the echo area displays a summary
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
761 of the lexical token at point whenever Emacs is idle."
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
762 :group 'semantic
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
763 :group 'semantic-modes
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
764 (if semantic-idle-summary-mode
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
765 ;; Enable the mode
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
766 (progn
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
767 (unless (and (featurep 'semantic) (semantic-active-p))
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
768 ;; Disable minor mode if semantic stuff not available
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
769 (setq semantic-idle-summary-mode nil)
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
770 (error "Buffer %s was not set up for parsing"
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
771 (buffer-name)))
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
772 (require 'eldoc)
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
773 (semantic-idle-scheduler-add 'semantic-idle-summary-idle-function)
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
774 (add-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
775 ;; Disable the mode
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
776 (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
108211
73a1ddc06d0e Use a mode-line spec rather than a static string in Semantic.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 108210
diff changeset
777 (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)))
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
778
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
779 (defun semantic-idle-summary-refresh-echo-area ()
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
780 (and semantic-idle-summary-mode
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
781 eldoc-last-message
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
782 (if (and (not executing-kbd-macro)
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
783 (not (and (boundp 'edebug-active) edebug-active))
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
784 (not cursor-in-echo-area)
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
785 (not (eq (selected-window) (minibuffer-window))))
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
786 (eldoc-message eldoc-last-message)
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
787 (setq eldoc-last-message nil))))
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
788
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
789 (semantic-add-minor-mode 'semantic-idle-summary-mode "")
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
790
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
791 (define-minor-mode global-semantic-idle-summary-mode
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
792 "Toggle Global Semantic Idle Summary mode.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
793 With ARG, turn Global Semantic Idle Summary mode on if ARG is
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
794 positive, off otherwise.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
795
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
796 When this minor mode is enabled, `semantic-idle-summary-mode' is
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
797 turned on in every Semantic-supported buffer."
106029
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
798 :global t
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
799 :group 'semantic
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
800 :group 'semantic-modes
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
801 (semantic-toggle-minor-mode-globally
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
802 'semantic-idle-summary-mode
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
803 (if global-semantic-idle-summary-mode 1 -1)))
d749d487704e * cedet/semantic/idle.el (semantic-idle-summary-mode)
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
804
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 ;;; Current symbol highlight
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808 ;; This mode will use context analysis to perform highlighting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809 ;; of all uses of the symbol that is under the cursor.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811 ;; This is to mimic the Eclipse tool of a similar nature.
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
812 (defvar semantic-idle-symbol-highlight-face 'region
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
813 "Face used for highlighting local symbols.")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
815 (defun semantic-idle-symbol-maybe-highlight (tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
816 "Perhaps add highlighting to the symbol represented by TAG.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
817 TAG was found as the symbol under point. If it happens to be
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818 visible, then highlight it."
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
819 (require 'pulse)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820 (let* ((region (when (and (semantic-tag-p tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
821 (semantic-tag-with-position-p tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822 (semantic-tag-overlay tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823 (file (when (and (semantic-tag-p tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 (semantic-tag-with-position-p tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825 (semantic-tag-file-name tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826 (buffer (when file (get-file-buffer file)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827 ;; We use pulse, but we don't want the flashy version,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 ;; just the stable version.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 (pulse-flag nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 (cond ((semantic-overlay-p region)
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105789
diff changeset
832 (with-current-buffer (semantic-overlay-buffer region)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833 (goto-char (semantic-overlay-start region))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 (when (pos-visible-in-window-p
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 (point) (get-buffer-window (current-buffer) 'visible))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836 (if (< (semantic-overlay-end region) (point-at-eol))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837 (pulse-momentary-highlight-overlay
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
838 region semantic-idle-symbol-highlight-face)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 ;; Not the same
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 (pulse-momentary-highlight-region
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 (semantic-overlay-start region)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842 (point-at-eol)
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
843 semantic-idle-symbol-highlight-face)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845 ((vectorp region)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 (let ((start (aref region 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 (end (aref region 1)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 (when buffer (set-buffer buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850 ;; As a vector, we have no filename. Perhaps it is a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851 ;; local variable?
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852 (when (and (<= end (point-max))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 (pos-visible-in-window-p
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 start (get-buffer-window (current-buffer) 'visible)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 (goto-char start)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856 (when (re-search-forward
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857 (regexp-quote (semantic-tag-name tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858 end t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859 ;; This is likely it, give it a try.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 (pulse-momentary-highlight-region
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861 start (if (<= end (point-at-eol)) end
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862 (point-at-eol))
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
863 semantic-idle-symbol-highlight-face)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
864 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865 nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
866
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
867 (define-semantic-idle-service semantic-idle-local-symbol-highlight
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
868 "Highlight the tag and symbol references of the symbol under point.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
869 Call `semantic-analyze-current-context' to find the reference tag.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
870 Call `semantic-symref-hits-in-region' to identify local references."
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
871 (require 'pulse)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
872 (when (semantic-idle-summary-useful-context-p)
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
873 (let* ((ctxt
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
874 (semanticdb-without-unloaded-file-searches
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
875 (semantic-analyze-current-context)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
876 (Hbounds (when ctxt (oref ctxt bounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
877 (target (when ctxt (car (reverse (oref ctxt prefix)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
878 (tag (semantic-current-tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
879 ;; We use pulse, but we don't want the flashy version,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
880 ;; just the stable version.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
881 (pulse-flag nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
882 (when ctxt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
883 ;; Highlight the original tag? Protect against problems.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
884 (condition-case nil
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
885 (semantic-idle-symbol-maybe-highlight target)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
886 (error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
887 ;; Identify all hits in this current tag.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
888 (when (semantic-tag-p target)
104454
e4842bf0f303 lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
889 (require 'semantic/symref/filter)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
890 (semantic-symref-hits-in-region
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
891 target (lambda (start end prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
892 (when (/= start (car Hbounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
893 (pulse-momentary-highlight-region
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
894 start end semantic-idle-symbol-highlight-face))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
895 (semantic-throw-on-input 'symref-highlight)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
896 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
897 (semantic-tag-start tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
898 (semantic-tag-end tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
899 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
900
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
901
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
902 ;;;###autoload
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
903 (define-minor-mode global-semantic-idle-scheduler-mode
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
904 "Toggle global use of option `semantic-idle-scheduler-mode'.
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106878
diff changeset
905 The idle scheduler will automatically reparse buffers in idle time,
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
906 and then schedule other jobs setup with `semantic-idle-scheduler-add'.
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
907 If ARG is positive or nil, enable, if it is negative, disable."
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
908 :global t
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
909 :group 'semantic
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
910 :group 'semantic-modes
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
911 ;; When turning off, disable other idle modes.
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
912 (when (null global-semantic-idle-scheduler-mode)
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
913 (global-semantic-idle-summary-mode -1)
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
914 (global-semantic-idle-local-symbol-highlight-mode -1)
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
915 (global-semantic-idle-completions-mode -1))
108210
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
916 (semantic-toggle-minor-mode-globally
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
917 'semantic-idle-scheduler-mode
5143700578d0 Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106895
diff changeset
918 (if global-semantic-idle-scheduler-mode 1 -1)))
106211
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
919
a26517472883 (global-semantic-idle-scheduler-mode): Move after definition of
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
920
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
921 ;;; Completion Popup Mode
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
922 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
923 ;; This mode uses tooltips to display a (hopefully) short list of possible
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
924 ;; completions available for the text under point. It provides
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
925 ;; NO provision for actually filling in the values from those completions.
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
926 (defun semantic-idle-completions-end-of-symbol-p ()
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
927 "Return non-nil if the cursor is at the END of a symbol.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
928 If the cursor is in the middle of a symbol, then we shouldn't be
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
929 doing fancy completions."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
930 (not (looking-at "\\w\\|\\s_")))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
931
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
932 (defun semantic-idle-completion-list-default ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
933 "Calculate and display a list of completions."
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
934 (when (and (semantic-idle-summary-useful-context-p)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
935 (semantic-idle-completions-end-of-symbol-p))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
936 ;; This mode can be fragile. Ignore problems.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
937 ;; If something doesn't do what you expect, run
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
938 ;; the below command by hand instead.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
939 (condition-case nil
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
940 (semanticdb-without-unloaded-file-searches
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
941 ;; Use idle version.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
942 (semantic-complete-analyze-inline-idle)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
943 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
944 (error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
945 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
946
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
947 (define-semantic-idle-service semantic-idle-completions
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
948 "Toggle Semantic Idle Completions mode.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
949 With ARG, turn Semantic Idle Completions mode on if ARG is
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
950 positive, off otherwise.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
951
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
952 This minor mode only takes effect if Semantic is active and
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
953 `semantic-idle-scheduler-mode' is enabled.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
954
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
955 When enabled, Emacs displays a list of possible completions at
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
956 idle time. The method for displaying completions is given by
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
957 `semantic-complete-inline-analyzer-idle-displayor-class'; the
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
958 default is to show completions inline.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
959
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
960 While a completion is displayed, RET accepts the completion; M-n
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
961 and M-p cycle through completion alternatives; TAB attempts to
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
962 complete as far as possible, and cycles if no additional
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
963 completion is possible; and any other command cancels the
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
964 completion.
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
965
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 106150
diff changeset
966 \\{semantic-complete-inline-map}"
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
967 ;; Add the ability to override sometime.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
968 (semantic-idle-completion-list-default))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
969
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
970
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
971 ;;; Breadcrumbs for tag under point
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
972 ;;
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
973 ;; Service that displays a breadcrumbs indication of the tag under
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
974 ;; point and its parents in the header or mode line.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
975 ;;
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
976
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
977 (defcustom semantic-idle-breadcrumbs-display-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
978 #'semantic-idle-breadcrumbs--display-in-header-line
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
979 "Function to display the tag under point in idle time.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
980 This function should take a list of Semantic tags as its only
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
981 argument. The tags are sorted according to their nesting order,
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
982 starting with the outermost tag. The function should call
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
983 `semantic-idle-breadcrumbs-format-tag-list-function' to convert
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
984 the tag list into a string."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
985 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
986 :type '(choice
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
987 (const :tag "Display in header line"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
988 semantic-idle-breadcrumbs--display-in-header-line)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
989 (const :tag "Display in mode line"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
990 semantic-idle-breadcrumbs--display-in-mode-line)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
991 (function :tag "Other function")))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
992
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
993 (defcustom semantic-idle-breadcrumbs-format-tag-list-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
994 #'semantic-idle-breadcrumbs--format-linear
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
995 "Function to format the list of tags containing point.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
996 This function should take a list of Semantic tags and an optional
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
997 maximum length of the produced string as its arguments. The
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
998 maximum length is a hint and can be ignored. When the maximum
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
999 length is omitted, an unconstrained string should be
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1000 produced. The tags are sorted according to their nesting order,
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1001 starting with the outermost tag. Single tags should be formatted
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1002 using `semantic-idle-breadcrumbs-format-tag-function' unless
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1003 special formatting is required."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1004 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1005 :type '(choice
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1006 (const :tag "Format tags as list, innermost last"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1007 semantic-idle-breadcrumbs--format-linear)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1008 (const :tag "Innermost tag with details, followed by remaining tags"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1009 semantic-idle-breadcrumbs--format-innermost-first)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1010 (function :tag "Other function")))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1011
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1012 (defcustom semantic-idle-breadcrumbs-format-tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1013 #'semantic-format-tag-abbreviate
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1014 "Function to call to format information about tags.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1015 This function should take a single argument, a Semantic tag, and
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1016 return a string to display.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1017 Some useful functions are found in `semantic-format-tag-functions'."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1018 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1019 :type semantic-format-tag-custom-list)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1020
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1021 (defcustom semantic-idle-breadcrumbs-separator 'mode-specific
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1022 "Specify how to separate tags in the breadcrumbs string.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1023 An arbitrary string or a mode-specific scope nesting
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1024 string (like, for example, \"::\" in C++, or \".\" in Java) can
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1025 be used."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1026 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1027 :type '(choice
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1028 (const :tag "Use mode specific separator"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1029 mode-specific)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1030 (string :tag "Specify separator string")))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1031
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1032 (defcustom semantic-idle-breadcrumbs-header-line-prefix
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1033 semantic-stickyfunc-indent-string ;; TODO not optimal
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1034 "String used to indent the breadcrumbs string.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1035 Customize this string to match the space used by scrollbars and
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1036 fringe."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1037 :group 'semantic
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1038 :type 'string)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1039
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1040 (defvar semantic-idle-breadcrumbs-popup-menu nil
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1041 "Menu used when a tag displayed by `semantic-idle-breadcrumbs-mode' is clicked.")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1042
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1043 (defun semantic-idle-breadcrumbs--popup-menu (event)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1044 "Popup a menu that displays things to do to the clicked tag.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1045 Argument EVENT describes the event that caused this function to
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1046 be called."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1047 (interactive "e")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1048 (let ((old-window (selected-window))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1049 (window (semantic-event-window event)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1050 (select-window window t)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1051 (semantic-popup-menu semantic-idle-breadcrumbs-popup-menu)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1052 (select-window old-window)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1053
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1054 (defmacro semantic-idle-breadcrumbs--tag-function (function)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1055 "Return lambda expression calling FUNCTION when called from a popup."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1056 `(lambda (event)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1057 (interactive "e")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1058 (let* ((old-window (selected-window))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1059 (window (semantic-event-window event))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1060 (column (car (nth 6 (nth 1 event)))) ;; TODO semantic-event-column?
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1061 (tag (progn
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1062 (select-window window t)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1063 (plist-get
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1064 (text-properties-at column header-line-format)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1065 'tag))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1066 (,function tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1067 (select-window old-window)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1068 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1069
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1070 ;; TODO does this work for mode-line case?
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1071 (defvar semantic-idle-breadcrumbs-popup-map
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1072 (let ((map (make-sparse-keymap)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1073 ;; mouse-1 goes to clicked tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1074 (define-key map
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1075 [ header-line mouse-1 ]
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1076 (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1077 semantic-go-to-tag))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1078 ;; mouse-3 pops up a context menu
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1079 (define-key map
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1080 [ header-line mouse-3 ]
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1081 'semantic-idle-breadcrumbs--popup-menu)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1082 map)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1083 "Keymap for semantic idle breadcrumbs minor mode.")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1084
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1085 (easy-menu-define
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1086 semantic-idle-breadcrumbs-popup-menu
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1087 semantic-idle-breadcrumbs-popup-map
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1088 "Semantic Breadcrumbs Mode Menu"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1089 (list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1090 "Breadcrumb Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1091 (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1092 (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1093 "Go to Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1094 (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1095 semantic-go-to-tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1096 :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1097 :help "Jump to this tag"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1098 ;; TODO these entries need minor changes (optional tag argument) in
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1099 ;; senator-copy-tag etc
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1100 ;; (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1101 ;; (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1102 ;; "Copy Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1103 ;; (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1104 ;; senator-copy-tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1105 ;; :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1106 ;; :help "Copy this tag"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1107 ;; (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1108 ;; (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1109 ;; "Kill Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1110 ;; (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1111 ;; senator-kill-tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1112 ;; :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1113 ;; :help "Kill tag text to the kill ring, and copy the tag to
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1114 ;; the tag ring"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1115 ;; (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1116 ;; (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1117 ;; "Copy Tag to Register"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1118 ;; (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1119 ;; senator-copy-tag-to-register)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1120 ;; :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1121 ;; :help "Copy this tag"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1122 ;; (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1123 ;; (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1124 ;; "Narrow to Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1125 ;; (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1126 ;; senator-narrow-to-defun)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1127 ;; :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1128 ;; :help "Narrow to the bounds of the current tag"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1129 ;; (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1130 ;; (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1131 ;; "Fold Tag"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1132 ;; (semantic-idle-breadcrumbs--tag-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1133 ;; senator-fold-tag-toggle)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1134 ;; :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1135 ;; :style 'toggle
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1136 ;; :selected '(let ((tag (semantic-current-tag)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1137 ;; (and tag (semantic-tag-folded-p tag)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1138 ;; :help "Fold the current tag to one line"))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1139 "---"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1140 (semantic-menu-item
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1141 (vector
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1142 "About this Header Line"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1143 (lambda ()
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1144 (interactive)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1145 (describe-function 'semantic-idle-breadcrumbs-mode))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1146 :active t
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1147 :help "Display help about this header line."))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1148 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1149 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1150
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1151 (define-semantic-idle-service semantic-idle-breadcrumbs
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1152 "Display breadcrumbs for the tag under point and its parents."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1153 (let* ((scope (semantic-calculate-scope))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1154 (tag-list (if scope
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1155 ;; If there is a scope, extract the tag and its
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1156 ;; parents.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1157 (append (oref scope parents)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1158 (when (oref scope tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1159 (list (oref scope tag))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1160 ;; Fall back to tags by overlay
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1161 (semantic-find-tag-by-overlay))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1162 ;; Display the tags.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1163 (funcall semantic-idle-breadcrumbs-display-function tag-list)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1164
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1165 (defun semantic-idle-breadcrumbs--display-in-header-line (tag-list)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1166 "Display the tags in TAG-LIST in the header line of their buffer."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1167 (let ((width (- (nth 2 (window-edges))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1168 (nth 0 (window-edges)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1169 ;; Format TAG-LIST and put the formatted string into the header
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1170 ;; line.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1171 (setq header-line-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1172 (concat
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1173 semantic-idle-breadcrumbs-header-line-prefix
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1174 (if tag-list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1175 (semantic-idle-breadcrumbs--format-tag-list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1176 tag-list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1177 (- width
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1178 (length semantic-idle-breadcrumbs-header-line-prefix)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1179 (propertize
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1180 "<not on tags>"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1181 'face
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1182 'font-lock-comment-face)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1183
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1184 ;; Update the header line.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1185 (force-mode-line-update))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1186
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1187 (defun semantic-idle-breadcrumbs--display-in-mode-line (tag-list)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1188 "Display the tags in TAG-LIST in the mode line of their buffer.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1189 TODO THIS FUNCTION DOES NOT WORK YET."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1190
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1191 (error "This function does not work yet")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1192
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1193 (let ((width (- (nth 2 (window-edges))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1194 (nth 0 (window-edges)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1195 (setq mode-line-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1196 (semantic-idle-breadcrumbs--format-tag-list tag-list width)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1197
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1198 (force-mode-line-update))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1199
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1200 (defun semantic-idle-breadcrumbs--format-tag-list (tag-list max-length)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1201 "Format TAG-LIST using configured functions respecting MAX-LENGTH.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1202 If the initial formatting result is longer than MAX-LENGTH, it is
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1203 shortened at the beginning."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1204 ;; Format TAG-LIST using the configured formatting function.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1205 (let* ((complete-format (funcall
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1206 semantic-idle-breadcrumbs-format-tag-list-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1207 tag-list max-length))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1208 ;; Determine length of complete format.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1209 (complete-length (length complete-format)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1210 ;; Shorten string if necessary.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1211 (if (<= complete-length max-length)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1212 complete-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1213 (concat "... "
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1214 (substring
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1215 complete-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1216 (- complete-length (- max-length 4))))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1217 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1218
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1219 (defun semantic-idle-breadcrumbs--format-linear
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1220 (tag-list &optional max-length)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1221 "Format TAG-LIST as a linear list, starting with the outermost tag.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1222 MAX-LENGTH is not used."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1223 (require 'semantic/analyze/fcn)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1224 (let* ((format-pieces (mapcar
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1225 #'semantic-idle-breadcrumbs--format-tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1226 tag-list))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1227 ;; Format tag list, putting configured separators between the
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1228 ;; tags.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1229 (complete-format (cond
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1230 ;; Mode specific separator.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1231 ((eq semantic-idle-breadcrumbs-separator
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1232 'mode-specific)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1233 (semantic-analyze-unsplit-name format-pieces))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1234
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1235 ;; Custom separator.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1236 ((stringp semantic-idle-breadcrumbs-separator)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1237 (mapconcat
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1238 #'identity
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1239 format-pieces
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1240 semantic-idle-breadcrumbs-separator)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1241 complete-format)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1242 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1243
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1244 (defun semantic-idle-breadcrumbs--format-innermost-first
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1245 (tag-list &optional max-length)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1246 "Format TAG-LIST placing the innermost tag first, separated from its parents.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1247 If MAX-LENGTH is non-nil, the innermost tag is shortened."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1248 (let* (;; Separate and format remaining tags. Calculate length of
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1249 ;; resulting string.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1250 (rest-tags (butlast tag-list))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1251 (rest-format (if rest-tags
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1252 (concat
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1253 " | "
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1254 (semantic-idle-breadcrumbs--format-linear
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1255 rest-tags))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1256 ""))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1257 (rest-length (length rest-format))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1258 ;; Format innermost tag and calculate length of resulting
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1259 ;; string.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1260 (inner-format (semantic-idle-breadcrumbs--format-tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1261 (car (last tag-list))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1262 #'semantic-format-tag-prototype))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1263 (inner-length (length inner-format))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1264 ;; Calculate complete length and shorten string for innermost
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1265 ;; tag if MAX-LENGTH is non-nil and the complete string is
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1266 ;; too long.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1267 (complete-length (+ inner-length rest-length))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1268 (inner-short (if (and max-length
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1269 (<= complete-length max-length))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1270 inner-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1271 (concat (substring
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1272 inner-format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1273 0
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1274 (- inner-length
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1275 (- complete-length max-length)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1276 4))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1277 " ..."))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1278 ;; Concat both parts.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1279 (concat inner-short rest-format))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1280 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1281
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1282 (defun semantic-idle-breadcrumbs--format-tag (tag &optional format-function)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1283 "Format TAG using the configured function or FORMAT-FUNCTION.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1284 This function also adds text properties for help-echo, mouse
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1285 highlighting and a keymap."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1286 (let ((formatted (funcall
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1287 (or format-function
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1288 semantic-idle-breadcrumbs-format-tag-function)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1289 tag nil t)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1290 (add-text-properties
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1291 0 (length formatted)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1292 (list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1293 'tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1294 tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1295 'help-echo
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1296 (format
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1297 "Tag %s
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1298 Type: %s
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1299 mouse-1: jump to tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1300 mouse-3: popup context menu"
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1301 (semantic-tag-name tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1302 (semantic-tag-class tag))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1303 'mouse-face
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1304 'highlight
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1305 'keymap
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1306 semantic-idle-breadcrumbs-popup-map)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1307 formatted)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1308 formatted))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1309
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
1310
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1311 (provide 'semantic/idle)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1312
104463
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
1313 ;; Local variables:
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
1314 ;; generated-autoload-file: "loaddefs.el"
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
1315 ;; generated-autoload-load-name: "semantic/idle"
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
1316 ;; End:
e4788b39543d lisp/cedet/semantic/idle.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104454
diff changeset
1317
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105340
diff changeset
1318 ;; arch-tag: 4bfd54da-5023-4cc1-91ae-e1fefc1a8d1b
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1319 ;;; semantic-idle.el ends here