Mercurial > emacs
comparison lisp/cedet/semantic.el @ 104519:934691bc93ed
* cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Change timeout to 1. Doc fix.
* cedet/semantic/edit.el (semantic-change-hooks): Add
semantic-edits-change-function-handle-changes directly.
* cedet/semantic/util.el (semantic--completion-cache): Move to
semantic.el.
(semantic-symbol-start): Remove unneeded function.
* cedet/semantic.el (semantic--completion-cache): Move here from
semantic/util.el
(semantic-clear-toplevel-cache, semantic--set-buffer-cache)
(semantic-fetch-tags): Reset semantic--completion-cache.
(semantic-force-refresh): New function
(semantic-mode-map): New variable.
* cedet/semantic/senator.el: New file.
* cedet/ede.el: Fix autoload.
(ede-customize-forms-menu): Handle null projects.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 27 Sep 2009 03:36:58 +0000 |
parents | c65d65798b34 |
children | 18ae68cd64bd |
comparison
equal
deleted
inserted
replaced
104518:78d37f6e576f | 104519:934691bc93ed |
---|---|
202 :type 'boolean) | 202 :type 'boolean) |
203 | 203 |
204 (defvar semantic-parser-name "LL" | 204 (defvar semantic-parser-name "LL" |
205 "Optional name of the parser used to parse input stream.") | 205 "Optional name of the parser used to parse input stream.") |
206 (make-variable-buffer-local 'semantic-parser-name) | 206 (make-variable-buffer-local 'semantic-parser-name) |
207 | |
208 (defvar semantic--completion-cache nil | |
209 "Internal variable used by `semantic-complete-symbol'.") | |
210 (make-variable-buffer-local 'semantic--completion-cache) | |
207 | 211 |
208 ;;; Parse tree state management API | 212 ;;; Parse tree state management API |
209 ;; | 213 ;; |
210 (defvar semantic-parse-tree-state 'needs-rebuild | 214 (defvar semantic-parse-tree-state 'needs-rebuild |
211 "State of the current parse tree.") | 215 "State of the current parse tree.") |
485 ;; Old model. Delete someday. | 489 ;; Old model. Delete someday. |
486 ;;(run-hooks 'semantic-after-toplevel-bovinate-hook) | 490 ;;(run-hooks 'semantic-after-toplevel-bovinate-hook) |
487 | 491 |
488 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook | 492 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook |
489 semantic--buffer-cache) | 493 semantic--buffer-cache) |
490 ) | 494 |
495 (setq semantic--completion-cache nil)) | |
491 | 496 |
492 (defvar semantic-bovinate-nonterminal-check-obarray) | 497 (defvar semantic-bovinate-nonterminal-check-obarray) |
493 | 498 |
494 (defun semantic--set-buffer-cache (tagtable) | 499 (defun semantic--set-buffer-cache (tagtable) |
495 "Set the toplevel cache cache to TAGTABLE." | 500 "Set the toplevel cache cache to TAGTABLE." |
501 (semantic-parse-tree-set-up-to-date) | 506 (semantic-parse-tree-set-up-to-date) |
502 (semantic-make-local-hook 'after-change-functions) | 507 (semantic-make-local-hook 'after-change-functions) |
503 (add-hook 'after-change-functions 'semantic-change-function nil t) | 508 (add-hook 'after-change-functions 'semantic-change-function nil t) |
504 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook | 509 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook |
505 semantic--buffer-cache) | 510 semantic--buffer-cache) |
511 (setq semantic--completion-cache nil) | |
506 ;; Refresh the display of unmatched syntax tokens if enabled | 512 ;; Refresh the display of unmatched syntax tokens if enabled |
507 (run-hook-with-args 'semantic-unmatched-syntax-hook | 513 (run-hook-with-args 'semantic-unmatched-syntax-hook |
508 semantic-unmatched-syntax-cache) | 514 semantic-unmatched-syntax-cache) |
509 ;; Old Semantic 1.3 hook API. Maybe useful forever? | 515 ;; Old Semantic 1.3 hook API. Maybe useful forever? |
510 (run-hooks 'semantic-after-toplevel-bovinate-hook) | 516 (run-hooks 'semantic-after-toplevel-bovinate-hook) |
578 ;; Move this into the incremental parser. This is a bug. | 584 ;; Move this into the incremental parser. This is a bug. |
579 ;; | 585 ;; |
580 (semantic-clear-unmatched-syntax-cache) | 586 (semantic-clear-unmatched-syntax-cache) |
581 (run-hook-with-args ;; Let hooks know the updated tags | 587 (run-hook-with-args ;; Let hooks know the updated tags |
582 'semantic-after-partial-cache-change-hook res)) | 588 'semantic-after-partial-cache-change-hook res)) |
583 ) | 589 (setq semantic--completion-cache nil)) |
584 | 590 |
585 ;;;; Parse the whole system. | 591 ;;;; Parse the whole system. |
586 ((semantic-parse-tree-needs-rebuild-p) | 592 ((semantic-parse-tree-needs-rebuild-p) |
587 ;; Use Emacs' built-in progress-reporter | 593 ;; Use Emacs' built-in progress-reporter |
588 (let ((semantic--progress-reporter | 594 (let ((semantic--progress-reporter |
817 (make-obsolete 'semantic-bovinate-from-nonterminal-full | 823 (make-obsolete 'semantic-bovinate-from-nonterminal-full |
818 'semantic-parse-region) | 824 'semantic-parse-region) |
819 | 825 |
820 ;;; User interface | 826 ;;; User interface |
821 | 827 |
828 (defun semantic-force-refresh () | |
829 "Force a full refresh of the current buffer's tags. | |
830 Throw away all the old tags, and recreate the tag database." | |
831 (interactive) | |
832 (semantic-clear-toplevel-cache) | |
833 (semantic-fetch-tags)) | |
834 | |
835 (defvar semantic-mode-map | |
836 (let ((map (make-sparse-keymap)) | |
837 (menu (make-sparse-keymap "Semantic")) | |
838 (navigate-menu (make-sparse-keymap "Navigate Tags")) | |
839 (edit-menu (make-sparse-keymap "Edit Tags"))) | |
840 | |
841 (define-key edit-menu [semantic-analyze-possible-completions] | |
842 '(menu-item "List Completions" semantic-analyze-possible-completions | |
843 :help "Display a list of completions for the tag at point")) | |
844 (define-key edit-menu [semantic-complete-analyze-inline] | |
845 '(menu-item "Complete Tag Inline" semantic-complete-analyze-inline | |
846 :help "Display inline completion for the tag at point")) | |
847 (define-key edit-menu [semantic-completion-separator] | |
848 '("--")) | |
849 (define-key edit-menu [senator-transpose-tags-down] | |
850 '(menu-item "Transpose Tags Down" senator-transpose-tags-down | |
851 :active (semantic-current-tag) | |
852 :help "Transpose the current tag and the next tag")) | |
853 (define-key edit-menu [senator-transpose-tags-up] | |
854 '(menu-item "Transpose Tags Up" senator-transpose-tags-up | |
855 :active (semantic-current-tag) | |
856 :help "Transpose the current tag and the previous tag")) | |
857 (define-key edit-menu [semantic-edit-separator] | |
858 '("--")) | |
859 (define-key edit-menu [senator-yank-tag] | |
860 '(menu-item "Yank Tag" senator-yank-tag | |
861 :active (not (ring-empty-p senator-tag-ring)) | |
862 :help "Yank the head of the tag ring into the buffer")) | |
863 (define-key edit-menu [senator-copy-tag-to-register] | |
864 '(menu-item "Copy Tag To Register" senator-copy-tag-to-register | |
865 :active (semantic-current-tag) | |
866 :help "Yank the head of the tag ring into the buffer")) | |
867 (define-key edit-menu [senator-copy-tag] | |
868 '(menu-item "Copy Tag" senator-copy-tag | |
869 :active (semantic-current-tag) | |
870 :help "Copy the current tag to the tag ring")) | |
871 (define-key edit-menu [senator-kill-tag] | |
872 '(menu-item "Kill Tag" senator-kill-tag | |
873 :active (semantic-current-tag) | |
874 :help "Kill the current tag, and copy it to the tag ring")) | |
875 | |
876 (define-key navigate-menu [senator-narrow-to-defun] | |
877 '(menu-item "Narrow to Tag" senator-narrow-to-defun | |
878 :active (semantic-current-tag) | |
879 :help "Narrow the buffer to the bounds of the current tag")) | |
880 (define-key navigate-menu [semantic-narrow-to-defun-separator] | |
881 '("--")) | |
882 (define-key navigate-menu [semantic-symref-symbol] | |
883 '(menu-item "Find Tag References..." semantic-symref-symbol | |
884 :help "Read a tag and list the references to it")) | |
885 (define-key navigate-menu [semantic-complete-jump] | |
886 '(menu-item "Find Tag Globally..." semantic-complete-jump | |
887 :help "Read a tag name and find it in the current project")) | |
888 (define-key navigate-menu [semantic-complete-jump-local] | |
889 '(menu-item "Find Tag in This Buffer..." semantic-complete-jump-local | |
890 :help "Read a tag name and find it in this buffer")) | |
891 (define-key navigate-menu [semantic-navigation-separator] | |
892 '("--")) | |
893 (define-key navigate-menu [senator-go-to-up-reference] | |
894 '(menu-item "Parent Tag" senator-go-to-up-reference | |
895 :help "Navigate up one reference by tag.")) | |
896 (define-key navigate-menu [senator-next-tag] | |
897 '(menu-item "Next Tag" senator-next-tag | |
898 :help "Go to the next tag")) | |
899 (define-key navigate-menu [senator-previous-tag] | |
900 '(menu-item "Previous Tag" senator-previous-tag | |
901 :help "Go to the previous tag")) | |
902 | |
903 (define-key menu [semantic-force-refresh] | |
904 '(menu-item "Reparse Buffer" semantic-force-refresh | |
905 :help "Force a full reparse of the current buffer.")) | |
906 (define-key menu [semantic-refresh-separator] | |
907 '("--")) | |
908 (define-key menu [edit-menu] | |
909 (cons "Edit Tags" edit-menu)) | |
910 (define-key menu [navigate-menu] | |
911 (cons "Navigate Tags" navigate-menu)) | |
912 (define-key menu [semantic-options-separator] | |
913 '("--")) | |
914 (define-key menu [global-semantic-highlight-func-mode] | |
915 (menu-bar-make-mm-toggle | |
916 global-semantic-highlight-func-mode | |
917 "Highlight Current Function" | |
918 "Highlight the tag at point")) | |
919 (define-key menu [global-semantic-decoration-mode] | |
920 (menu-bar-make-mm-toggle | |
921 global-semantic-decoration-mode | |
922 "Decorate Tags" | |
923 "Decorate tags based on various attributes")) | |
924 (define-key menu [global-semantic-idle-completions-mode] | |
925 (menu-bar-make-mm-toggle | |
926 global-semantic-idle-completions-mode | |
927 "Show Tag Completions" | |
928 "Show tag completions when idle")) | |
929 (define-key menu [global-semantic-idle-summary-mode] | |
930 (menu-bar-make-mm-toggle | |
931 global-semantic-idle-summary-mode | |
932 "Show Tag Summaries" | |
933 "Show tag summaries when idle")) | |
934 (define-key menu [global-semanticdb-minor-mode] | |
935 '(menu-item "Semantic Database" global-semanticdb-minor-mode | |
936 :help "Store tag information in a database" | |
937 :button (:toggle . (semanticdb-minor-mode-p)))) | |
938 (define-key menu [global-semantic-idle-scheduler-mode] | |
939 (menu-bar-make-mm-toggle | |
940 global-semantic-idle-scheduler-mode | |
941 "Reparse When Idle" | |
942 "Keep a buffer's parse tree up to date when idle")) | |
943 (define-key map [menu-bar semantic] | |
944 (cons "Development" menu)) | |
945 | |
946 ;; Key bindings: | |
947 | |
948 ;; (define-key km "f" 'senator-search-set-tag-class-filter) | |
949 ;; (define-key km "i" 'senator-isearch-toggle-semantic-mode) | |
950 (define-key map "\C-c,j" 'semantic-complete-jump-local) | |
951 (define-key map "\C-c,J" 'semantic-complete-jump) | |
952 (define-key map "\C-c,g" 'semantic-symref-symbol) | |
953 (define-key map "\C-c,G" 'semantic-symref) | |
954 (define-key map "\C-c,p" 'senator-previous-tag) | |
955 (define-key map "\C-c,n" 'senator-next-tag) | |
956 (define-key map "\C-c,u" 'senator-go-to-up-reference) | |
957 (define-key map "\C-c, " 'semantic-complete-analyze-inline) | |
958 (define-key map "\C-c,\C-w" 'senator-kill-tag) | |
959 (define-key map "\C-c,\M-w" 'senator-copy-tag) | |
960 (define-key map "\C-c,\C-y" 'senator-yank-tag) | |
961 (define-key map "\C-c,r" 'senator-copy-tag-to-register) | |
962 (define-key map [?\C-c ?, up] 'senator-transpose-tags-up) | |
963 (define-key map [?\C-c ?, down] 'senator-transpose-tags-down) | |
964 (define-key map "\C-c,l" 'semantic-analyze-possible-completions) | |
965 ;; (define-key km "-" 'senator-fold-tag) | |
966 ;; (define-key km "+" 'senator-unfold-tag) | |
967 map)) | |
968 | |
822 ;; The `semantic-mode' command, in conjuction with the | 969 ;; The `semantic-mode' command, in conjuction with the |
823 ;; `semantic-default-submodes' variable, are used to collectively | 970 ;; `semantic-default-submodes' variable, are used to collectively |
824 ;; toggle Semantic's various auxilliary minor modes. | 971 ;; toggle Semantic's various auxilliary minor modes. |
825 | 972 |
826 (defvar semantic-load-system-cache-loaded nil | 973 (defvar semantic-load-system-cache-loaded nil |
865 | 1012 |
866 In Semantic mode, Emacs parses the buffers you visit for their | 1013 In Semantic mode, Emacs parses the buffers you visit for their |
867 semantic content. This information is used by a variety of | 1014 semantic content. This information is used by a variety of |
868 auxilliary minor modes, listed in `semantic-default-submodes'; | 1015 auxilliary minor modes, listed in `semantic-default-submodes'; |
869 all the minor modes in this list are also enabled when you enable | 1016 all the minor modes in this list are also enabled when you enable |
870 Semantic mode." | 1017 Semantic mode. |
1018 | |
1019 \\{semantic-mode-map}" | |
1020 :global t | |
871 :group 'semantic | 1021 :group 'semantic |
872 (if semantic-mode | 1022 (if semantic-mode |
873 ;; Turn on Semantic mode | 1023 ;; Turn on Semantic mode |
874 (progn | 1024 (progn |
1025 ;; Enable all the global auxilliary minor modes in | |
1026 ;; `semantic-submode-list'. | |
875 (dolist (mode semantic-submode-list) | 1027 (dolist (mode semantic-submode-list) |
876 (if (memq mode semantic-default-submodes) | 1028 (if (memq mode semantic-default-submodes) |
877 (funcall mode 1))) | 1029 (funcall mode 1))) |
878 (unless semantic-load-system-cache-loaded | 1030 (unless semantic-load-system-cache-loaded |
879 (setq semantic-load-system-cache-loaded t) | 1031 (setq semantic-load-system-cache-loaded t) |