diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index fb443fa4a3..a017caa7ff 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -335,25 +335,28 @@ semantic-elapsed-time Arguments START and END bound the time being calculated." (float-time (time-subtract end start))) -(defun bovinate (&optional clear) +(define-derived-mode bovinate-mode lisp-data-mode "Bovinate" + "Bovinate buffer major-mode.") + +(cl-defun bovinate (&optional clear (display t)) "Parse the current buffer. Show output in a temp buffer. -Optional argument CLEAR will clear the cache before parsing. -If CLEAR is negative, it will do a full reparse, and also display -the output buffer." +If CLEAR is non-nil, it will do a full reparse. +If DISPLAY is nil, it doesn't show the parser buffer." (interactive "P") - (if clear (semantic-clear-toplevel-cache)) - (if (eq clear '-) (setq clear -1)) + (when clear (semantic-clear-toplevel-cache)) (let* ((start (current-time)) - (out (semantic-fetch-tags))) - (message "Retrieving tags took %.2f seconds." - (semantic-elapsed-time start nil)) - (when (or (null clear) (not (listp clear)) - (and (numberp clear) (< 0 clear))) - (pop-to-buffer "*Parser Output*") - (require 'pp) + (tags (semantic-fetch-tags)) + (time-elapse (semantic-elapsed-time start nil)) + (bovinate-buffer + (format "*Parser Output from %s*" (buffer-name)))) + (message "Retrieving tags took %.2f seconds." time-elapse) + (with-current-buffer (get-buffer-create bovinate-buffer) (erase-buffer) - (insert (pp-to-string out)) - (goto-char (point-min))))) + (insert (pp-to-string tags)) + (bovinate-mode) + (goto-char (point-min))) + (when display (pop-to-buffer bovinate-buffer)))) + ;;; Functions of the parser plug-in API ;;