From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] (CEDET development) Improve the bovinate output buffer Date: Thu, 01 Apr 2021 18:02:48 -0400 Message-ID: References: <4776a4d8-e8c7-b087-2b3a-f3fa04b9fe99@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24108"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Fermin Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 02 00:03:46 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 1lS5Pl-00069A-Cv for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Apr 2021 00:03:45 +0200 Original-Received: from localhost ([::1]:37790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lS5Pk-0005od-CL for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Apr 2021 18:03:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lS5P1-0005OS-N8 for emacs-devel@gnu.org; Thu, 01 Apr 2021 18:02:59 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lS5Ov-0006dt-2R for emacs-devel@gnu.org; Thu, 01 Apr 2021 18:02:58 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 23F3F44115F; Thu, 1 Apr 2021 18:02:52 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1B64A4410DA; Thu, 1 Apr 2021 18:02:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1617314570; bh=vq5+0Lj98klRGi7o55L9amgs+6G826LXmIjPimP6AvI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=g5PDgUKEbV+wtoMwXeeoLqMgWaLuHR1FRP5P6ppa15zt+vorTFC1wyoCNpevmkK8t o5ZeNRSagsxKw2YIk8g46PObkJa/YYzlJh8iUbauJod1BvR/ykOU3OORzi86RXu3t6 eZi6EGpe68hHjXqCgnpmK/xaViLy8e5fiHIc2H3cDyPmgVxCArz81/Y3RgIe7B6lam Xt+NV9odCuxizJy7/7uXUwWnBoOsV9jUGkP4A9qKtICVpxNiUzCUpfIOhEG5SLzU8I vYLxvdwWFcxeaqwsfPW1vL2nV3uNHvDIKFCpMw0PmTMRrHC/l+X9K4g6xIbUbXYfIx 0dfIoOZpa5Ozw== Original-Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8CAA512030C; Thu, 1 Apr 2021 18:02:49 -0400 (EDT) In-Reply-To: <4776a4d8-e8c7-b087-2b3a-f3fa04b9fe99@posteo.net> (Fermin's message of "Thu, 1 Apr 2021 21:58:57 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:267282 Archived-At: > 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 > > --- Could you expand this commit message a bit and clarify on the first line that this regards some part of semantic? E.g.: Subject: [PATCH] semantic.el (bovinate): Prettify output * lisp/cedet/semantic.el (bovinate-mode): New major mode. (bovinate): ???. where the `???` should say what kind of improvement is brought by the patch (like "Give a more meaningful name to the buffer"?). > +(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.") AFAICT this is better served by `lisp-data-mode` than `emacs-lisp-mode`, no? Also, try to make the first line of docstrings be self-contained. Maybe you could just use `lisp-data-mode` without bothering to define a new major mode for it. > (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 I think you can simplify the last three lines to (with-current-buffer (get-buffer-create bovinate-buffer) > (erase-buffer) > - (insert (pp-to-string out)) > + (insert (pp-to-string tags)) > + (bovinate-mode) > (goto-char (point-min))))) I don't see where the new code implements the "negative CLEAR" behavior. Also I don't see in the new code where/when the buffer is displayed. [ Read on before replying ;-) ] > 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 > > --- Similar comment abut the commit message. > (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.") This would better be folded into the previous patch. > -(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") This means that when used interactively DISPLAY will always be nil and hence the buffer will never be "popped". This contradicts the first line's "Show output in a `bovinate-mode' buffer" and I also wonder what is the benefit (is it often useful/necessary to do `M-x bovinate` without wanting to see the resulting tags)? > (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)))) This should also be folded into the previous patch. > (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)))) Hmm... overall, I think the two patches should be squashed together. Stefan