From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fermin Newsgroups: gmane.emacs.devel Subject: [PATCH] (CEDET development) Improve the bovinate output buffer Date: Thu, 1 Apr 2021 21:58:57 +0200 Message-ID: <4776a4d8-e8c7-b087-2b3a-f3fa04b9fe99@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------04E931C7C70439C3884F66DA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39924"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 01 22:00:03 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lS3U3-000AIL-Jq for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Apr 2021 22:00:03 +0200 Original-Received: from localhost ([::1]:44074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lS3U2-0003Xg-KS for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Apr 2021 16:00:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lS3TC-0002zx-Uj for emacs-devel@gnu.org; Thu, 01 Apr 2021 15:59:10 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:60829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lS3T9-0005kW-B5 for emacs-devel@gnu.org; Thu, 01 Apr 2021 15:59:09 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id E0A75160061 for ; Thu, 1 Apr 2021 21:59:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1617307142; bh=plrXrJQgYpNiHEQiJQ2fJrQFJsDqRm05my3Et7puPAE=; h=To:From:Subject:Date:From; b=TK8yiY18S+Z2LYoGQFY/4umWEkzG0w9sXK7vFrgt6FzCcRq2y/IfH30+DGH5+yADl 9xKE5wHqtOGVUcs6AErrg4dnLHIdWVU1NpOwtfwlwi8maZpdvJOZms0dGruVYfcbJd ZZznns6mr8DbtTSH0l2y1Iol0mT5owq77oT4k7TxfUKKNCGcr+R20B9uu5VlYtyewQ RVQ5IRp+8dpyA9qvSfjcMSiP/l8mGpPdbC+/6r582PlF5aXzeMog5A+abtvIqn/7Tl WeuYbVPPbClqE58oPIlR0ob+syGbNj/eCWkecBm1r044Rerbmt9/QsFEa36dFPw9hD cp5vch1lyVnDw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FBDXP752rz6tmF for ; Thu, 1 Apr 2021 21:59:01 +0200 (CEST) Content-Language: en-US Received-SPF: pass client-ip=185.67.36.65; envelope-from=fmfs@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267278 Archived-At: This is a multi-part message in MIME format. --------------04E931C7C70439C3884F66DA Content-Type: multipart/alternative; boundary="------------498D682E51499BE578E9EC92" --------------498D682E51499BE578E9EC92 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit There is an essential command when developing a new parser with bovine that is *bovinate*, this gives all the buffer information about the tags and helps the developer understand what information is been change. The idea of this patch is simple, provide a major mode for the bovinate buffer base on the emacs-lisp mode, giving that there are a few similarities in the output, it also add more information in the buffer name, so you can have different output buffers at the same time with different names. The idea  in the future is to add more information in the bovinate buffer, so it can truly serve as a debugger information buffer. There is 2 patch attached, one of them is the change of the function and adding of the major mode, the other one adds the display behavior, so it can also be automatically displayed. --------------498D682E51499BE578E9EC92 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

There is an essential command when developing a new parser with bovine that is bovinate, this gives all the
buffer information about the tags and helps the developer understand what information is been change.

The idea of this patch is simple, provide a major mode for the bovinate buffer base on the emacs-lisp mode,
giving that there are a few similarities in the output, it also add more information in the buffer name, so
you can have different output buffers at the same time with different names.

The idea  in the future is to add more information in the bovinate buffer, so it can truly serve as a debugger
information buffer.

There is 2 patch attached, one of them is the change of the function and adding of the major mode, the other one
adds the display behavior, so it can also be automatically displayed.

--------------498D682E51499BE578E9EC92-- --------------04E931C7C70439C3884F66DA Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-bovinate-mode-as-a-major-mode-and-improve-the-bo.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Add-bovinate-mode-as-a-major-mode-and-improve-the-bo.pa"; filename*1="tch" >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 --------------04E931C7C70439C3884F66DA Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-display-as-a-optional-parameter-for-displaying-t.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Add-display-as-a-optional-parameter-for-displaying-t.pa"; filename*1="tch" >From 1c1673283186780e6db007f79d4f8aa864660f79 Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 1 Apr 2021 21:53:16 +0200 Subject: [PATCH] Add display as a optional parameter for displaying the buffer --- lisp/cedet/semantic.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index 421597fceb..256b420688 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -337,21 +337,20 @@ Arguments START and END bound the time being calculated." (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. +`pp-to-string', the syntax is very similar to a list in 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. +(defun bovinate (&optional clear display) + "Parse the current buffer. Show output in a `bovinate-mode' 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 non-nil DISPLAY will display the buffer `pop-to-buffer'." (interactive "P") (when clear (semantic-clear-toplevel-cache)) (let* ((start (current-time)) (tags (semantic-fetch-tags)) (time-elapse (semantic-elapsed-time start nil)) (bovinate-buffer - (format "*Parser Output from %s buffer*" (buffer-name)))) + (format "*Parser Output from %s*" (buffer-name)))) (message "Retrieving tags took %.2f seconds." time-elapse) (unless (get-buffer bovinate-buffer) (setq bovinate-buffer (get-buffer-create bovinate-buffer))) @@ -359,7 +358,8 @@ the output buffer." (erase-buffer) (insert (pp-to-string tags)) (bovinate-mode) - (goto-char (point-min))))) + (goto-char (point-min))) + (when display (pop-to-buffer bovinate-buffer)))) ;;; Functions of the parser plug-in API -- 2.30.2 --------------04E931C7C70439C3884F66DA--