>From f8c7ee1791ec6eee1993a9e5449112579e193415 Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 1 Apr 2021 21:31:56 +0200 Subject: [PATCH] Add bovinate-mode as a major mode and improve the bovinate command --- lisp/cedet/semantic.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index fb443fa4a3..421597fceb 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -335,25 +335,32 @@ Do not set this yourself. Call `semantic-debug'.") Arguments START and END bound the time being calculated." (float-time (time-subtract end start))) +(define-derived-mode bovinate-mode emacs-lisp-mode "Bovinate" + "Bovinate buffer major-mode, giving that the list is generated with +`pp-to-string', the syntax is very similar to a list of Emacs Lisp. +This major mode helps with the syntax highlight of some of the symbols.") + (defun bovinate (&optional clear) "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." (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*" (buffer-name)))) + (message "Retrieving tags took %.2f seconds." time-elapse) + (unless (get-buffer bovinate-buffer) + (setq bovinate-buffer (get-buffer-create bovinate-buffer))) + (with-current-buffer bovinate-buffer (erase-buffer) - (insert (pp-to-string out)) + (insert (pp-to-string tags)) + (bovinate-mode) (goto-char (point-min))))) + ;;; Functions of the parser plug-in API ;; -- 2.30.2