diff options
Diffstat (limited to 'lisp/cedet/semantic')
| -rw-r--r-- | lisp/cedet/semantic/complete.el | 5 | ||||
| -rw-r--r-- | lisp/cedet/semantic/find.el | 12 | ||||
| -rw-r--r-- | lisp/cedet/semantic/fw.el | 9 | ||||
| -rw-r--r-- | lisp/cedet/semantic/grammar.el | 26 | ||||
| -rw-r--r-- | lisp/cedet/semantic/ia.el | 77 | ||||
| -rw-r--r-- | lisp/cedet/semantic/symref/list.el | 83 |
6 files changed, 101 insertions, 111 deletions
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index b42e24fb9c0..9af890fb6eb 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -1634,6 +1634,8 @@ Display mechanism using tooltip for a list of possible completions.") (error nil)) ) +(defvar tooltip-mode) + (defmethod semantic-displayor-show-request ((obj semantic-displayor-tooltip)) "A request to show the current tags table." (if (or (not (featurep 'tooltip)) (not tooltip-mode)) @@ -1726,6 +1728,9 @@ Return a cons cell (X . Y)" (+ (cdr point-pix-pos) (cadr edges) top)))) +(defvar tooltip-frame-parameters) +(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) + (defun semantic-displayor-tooltip-show (text) "Display a tooltip with TEXT near cursor." (let ((point-pix-pos (semantic-displayor-point-position)) diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index f660c69ec3d..351c6163e2b 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el @@ -265,9 +265,9 @@ TABLE is a semantic tags table. See `semantic-something-to-tag-table'." "Find the first tag with NAME in TABLE. NAME is a string. TABLE is a semantic tags table. See `semantic-something-to-tag-table'. -This routine uses `assoc' to quickly find the first matching entry." - (funcall (if semantic-case-fold 'assoc-ignore-case 'assoc) - name (semantic-something-to-tag-table table))) +Respects `semantic-case-fold'." + (assoc-string name (semantic-something-to-tag-table table) + semantic-case-fold)) (defmacro semantic-find-tags-by-name (name &optional table) "Find all tags with NAME in TABLE. @@ -457,13 +457,11 @@ TABLE is a tag table. See `semantic-something-to-tag-table'." "Find a tag NAME within STREAMORBUFFER. NAME is a string. If SEARCH-PARTS is non-nil, search children of tags. If SEARCH-INCLUDE was never implemented. +Respects `semantic-case-fold'. Use `semantic-find-first-tag-by-name' instead." (let* ((stream (semantic-something-to-tag-table streamorbuffer)) - (assoc-fun (if semantic-case-fold - #'assoc-ignore-case - #'assoc)) - (m (funcall assoc-fun name stream))) + (m (assoc-string name stream semantic-case-fold))) (if m m (let ((toklst stream) diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index 7850e0462b2..825cdc9f0a4 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el @@ -321,6 +321,15 @@ Avoid using a large BODY since it is duplicated." ;;; Misc utilities ;; + +(defvar semantic-new-buffer-fcn-was-run nil + "Non-nil after `semantic-new-buffer-fcn' has been executed.") +(make-variable-buffer-local 'semantic-new-buffer-fcn-was-run) + +(defsubst semantic-active-p () + "Return non-nil if the current buffer was set up for parsing." + semantic-new-buffer-fcn-was-run) + (defsubst semantic-map-buffers (function) "Run FUNCTION for each Semantic enabled buffer found. FUNCTION does not have arguments. When FUNCTION is entered diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index ce658cd5d54..60c4ccadf65 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -860,7 +860,7 @@ Lisp code." ;; Use Unix EOLs, so that the file is portable to all platforms. (setq buffer-file-coding-system 'raw-text-unix) (erase-buffer) - (unless (eq major-mode 'emacs-lisp-mode) + (unless (derived-mode-p 'emacs-lisp-mode) (emacs-lisp-mode)) ;;;; Header + Prologue @@ -1102,7 +1102,9 @@ END is the limit of the search." ;;;; Define major mode ;;;; -(defvar semantic-grammar-syntax-table +(define-obsolete-variable-alias 'semantic-grammar-syntax-table + 'semantic-grammar-mode-syntax-table "24.1") +(defvar semantic-grammar-mode-syntax-table (let ((table (make-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?\: "." table) ;; COLON (modify-syntax-entry ?\> "." table) ;; GT @@ -1170,7 +1172,9 @@ END is the limit of the search." semantic-grammar-mode-keywords-1 "Font Lock keywords used to highlight Semantic grammar buffers.") -(defvar semantic-grammar-map +(define-obsolete-variable-alias 'semantic-grammar-map + 'semantic-grammar-mode-map "24.1") +(defvar semantic-grammar-mode-map (let ((km (make-sparse-keymap))) (define-key km "|" 'semantic-grammar-electric-punctuation) @@ -1271,22 +1275,17 @@ the change bounds to encompass the whole nonterminal tag." (semantic-tag-start outer) (semantic-tag-end outer))))) -(defun semantic-grammar-mode () +(define-derived-mode semantic-grammar-mode + fundamental-mode "Semantic Grammar Framework" "Initialize a buffer for editing Semantic grammars. -\\{semantic-grammar-map}" - (interactive) - (kill-all-local-variables) - (setq major-mode 'semantic-grammar-mode - mode-name "Semantic Grammar Framework") +\\{semantic-grammar-mode-map}" (set (make-local-variable 'parse-sexp-ignore-comments) t) (set (make-local-variable 'comment-start) ";;") ;; Look within the line for a ; following an even number of backslashes ;; after either a non-backslash or the line beginning. (set (make-local-variable 'comment-start-skip) "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (set-syntax-table semantic-grammar-syntax-table) - (use-local-map semantic-grammar-map) (set (make-local-variable 'indent-line-function) 'semantic-grammar-indent) (set (make-local-variable 'fill-paragraph-function) @@ -1335,15 +1334,14 @@ the change bounds to encompass the whole nonterminal tag." (semantic-make-local-hook 'semantic-edits-new-change-functions) (add-hook 'semantic-edits-new-change-functions 'semantic-grammar-edits-new-change-hook-fcn - nil t) - (semantic-run-mode-hooks 'semantic-grammar-mode-hook)) + nil t)) ;;;; ;;;; Useful commands ;;;; (defvar semantic-grammar-skip-quoted-syntax-table - (let ((st (copy-syntax-table semantic-grammar-syntax-table))) + (let ((st (copy-syntax-table semantic-grammar-mode-syntax-table))) (modify-syntax-entry ?\' "$" st) st) "Syntax table to skip a whole quoted expression in grammar code. diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el index d087ac6fcde..d1ff7f1d9aa 100644 --- a/lisp/cedet/semantic/ia.el +++ b/lisp/cedet/semantic/ia.el @@ -149,44 +149,45 @@ Completion options are calculated with `semantic-analyze-possible-completions'." :group 'semantic :type semantic-format-tag-custom-list) -;;;###autoload -(defun semantic-ia-complete-symbol-menu (point) - "Complete the current symbol via a menu based at POINT. -Completion options are calculated with `semantic-analyze-possible-completions'." - (interactive "d") - (require 'imenu) - (let* ((a (semantic-analyze-current-context point)) - (syms (semantic-analyze-possible-completions a)) - ) - ;; Complete this symbol. - (if (not syms) - (progn - (message "No smart completions found. Trying Senator.") - (when (semantic-analyze-context-p a) - ;; This is a quick way of getting a nice completion list - ;; in the menu if the regular context mechanism fails. - (senator-completion-menu-popup))) - - (let* ((menu - (mapcar - (lambda (tag) - (cons - (funcall semantic-ia-completion-menu-format-tag-function tag) - (vector tag))) - syms)) - (ans - (imenu--mouse-menu - ;; XEmacs needs that the menu has at least 2 items. So, - ;; include a nil item that will be ignored by imenu. - (cons nil menu) - (senator-completion-menu-point-as-event) - "Completions"))) - (when ans - (if (not (semantic-tag-p ans)) - (setq ans (aref (cdr ans) 0))) - (delete-region (car (oref a bounds)) (cdr (oref a bounds))) - (semantic-ia-insert-tag ans)) - )))) +;; Disabled - see http://debbugs.gnu.org/14522 +;; ;;;###autoload +;; (defun semantic-ia-complete-symbol-menu (point) +;; "Complete the current symbol via a menu based at POINT. +;; Completion options are calculated with `semantic-analyze-possible-completions'." +;; (interactive "d") +;; (require 'imenu) +;; (let* ((a (semantic-analyze-current-context point)) +;; (syms (semantic-analyze-possible-completions a)) +;; ) +;; ;; Complete this symbol. +;; (if (not syms) +;; (progn +;; (message "No smart completions found. Trying Senator.") +;; (when (semantic-analyze-context-p a) +;; ;; This is a quick way of getting a nice completion list +;; ;; in the menu if the regular context mechanism fails. +;; (senator-completion-menu-popup))) +;; +;; (let* ((menu +;; (mapcar +;; (lambda (tag) +;; (cons +;; (funcall semantic-ia-completion-menu-format-tag-function tag) +;; (vector tag))) +;; syms)) +;; (ans +;; (imenu--mouse-menu +;; ;; XEmacs needs that the menu has at least 2 items. So, +;; ;; include a nil item that will be ignored by imenu. +;; (cons nil menu) +;; (senator-completion-menu-point-as-event) +;; "Completions"))) +;; (when ans +;; (if (not (semantic-tag-p ans)) +;; (setq ans (aref (cdr ans) 0))) +;; (delete-region (car (oref a bounds)) (cdr (oref a bounds))) +;; (semantic-ia-insert-tag ans)) +;; )))) ;;; Completions Tip ;; diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el index c1f0a092afc..af8e18f8c55 100644 --- a/lisp/cedet/semantic/symref/list.el +++ b/lisp/cedet/semantic/symref/list.el @@ -48,18 +48,18 @@ they are used in. Display the references in `semantic-symref-results-mode'." (interactive) (semantic-fetch-tags) - (let ((ct (semantic-current-tag)) - (res nil) - ) + (let ((ct (semantic-current-tag))) ;; Must have a tag... (when (not ct) (error "Place cursor inside tag to be searched for")) ;; Check w/ user. - (when (not (y-or-n-p (format "Find references for %s? " (semantic-tag-name ct)))) + (when (not (y-or-n-p (format "Find references for %s? " + (semantic-tag-name ct)))) (error "Quit")) ;; Gather results and tags (message "Gathering References...") - (setq res (semantic-symref-find-references-by-name (semantic-tag-name ct))) - (semantic-symref-produce-list-on-results res (semantic-tag-name ct)))) + (let* ((name (semantic-tag-name ct)) + (res (semantic-symref-find-references-by-name name))) + (semantic-symref-produce-list-on-results res name)))) ;;;###autoload (defun semantic-symref-symbol (sym) @@ -72,11 +72,9 @@ Display the references in `semantic-symref-results-mode'." (interactive (list (semantic-tag-name (semantic-complete-read-tag-project "Symrefs for: ")))) (semantic-fetch-tags) - (let ((res nil) - ) - ;; Gather results and tags - (message "Gathering References...") - (setq res (semantic-symref-find-references-by-name sym)) + ;; Gather results and tags + (message "Gathering References...") + (let ((res (semantic-symref-find-references-by-name sym))) (semantic-symref-produce-list-on-results res sym))) ;;;###autoload @@ -90,28 +88,11 @@ Display the references in`semantic-symref-results-mode'." (interactive (list (semantic-tag-name (semantic-complete-read-tag-buffer-deep "Symrefs for: ")))) (semantic-fetch-tags) - (let ((res nil) - ) - ;; Gather results and tags - (message "Gathering References...") - (setq res (semantic-symref-find-text sym)) + (message "Gathering References...") + ;; Gather results and tags + (let ((res (semantic-symref-find-text sym))) (semantic-symref-produce-list-on-results res sym))) - -(defun semantic-symref-produce-list-on-results (res str) - "Produce a symref list mode buffer on the results RES." - (when (not res) (error "No references found")) - (semantic-symref-result-get-tags res t) - (message "Gathering References...done") - ;; Build a references buffer. - (let ((buff (get-buffer-create - (format "*Symref %s" str))) - ) - (switch-to-buffer-other-window buff) - (set-buffer buff) - (semantic-symref-results-mode res)) - ) - ;;; RESULTS MODE ;; (defgroup semantic-symref-results-mode nil @@ -178,36 +159,35 @@ Display the references in`semantic-symref-results-mode'." (defcustom semantic-symref-auto-expand-results nil "Non-nil to expand symref results on buffer creation." - :group 'semantic-symref-results-mode :type 'boolean) (defcustom semantic-symref-results-mode-hook nil "Hook run when `semantic-symref-results-mode' starts." - :group 'semantic-symref-results-mode :type 'hook) (defvar semantic-symref-current-results nil "The current results in a results mode buffer.") -(defun semantic-symref-results-mode (results) - ;; FIXME: Use define-derived-mode. - "Major-mode for displaying Semantic Symbol Reference RESULTS. -RESULTS is an object of class `semantic-symref-results'." - (interactive) - (kill-all-local-variables) - (setq major-mode 'semantic-symref-results-mode - mode-name "Symref" - ) - (use-local-map semantic-symref-results-mode-map) - (set (make-local-variable 'semantic-symref-current-results) - results) - (semantic-symref-results-dump results) - (goto-char (point-min)) +(defun semantic-symref-produce-list-on-results (res str) + "Produce a symref list mode buffer on the results RES." + (when (not res) (error "No references found")) + (semantic-symref-result-get-tags res t) + (message "Gathering References...done") + ;; Build a references buffer. + (let ((buff (get-buffer-create (format "*Symref %s" str)))) + (switch-to-buffer-other-window buff) + (set-buffer buff) + (semantic-symref-results-mode) + (set (make-local-variable 'semantic-symref-current-results) res) + (semantic-symref-results-dump res) + (goto-char (point-min)))) + +(define-derived-mode semantic-symref-results-mode nil "Symref" + "Major-mode for displaying Semantic Symbol Reference results." (buffer-disable-undo) + ;; FIXME: Why bother turning off font-lock? (set (make-local-variable 'font-lock-global-modes) nil) - (font-lock-mode -1) - (run-mode-hooks 'semantic-symref-results-mode-hook) - ) + (font-lock-mode -1)) (defun semantic-symref-hide-buffer () "Hide buffer with semantic-symref results." @@ -215,9 +195,8 @@ RESULTS is an object of class `semantic-symref-results'." (bury-buffer)) (defcustom semantic-symref-results-summary-function 'semantic-format-tag-prototype - "*Function to use when creating items in Imenu. + "Function to use when creating items in Imenu. Some useful functions are found in `semantic-format-tag-functions'." - :group 'semantic-symref-results-mode :type semantic-format-tag-custom-list) (defun semantic-symref-results-dump (results) |
