From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.devel Subject: Re: Brave new mark-defun (and a testing tool) Date: Sun, 12 Feb 2017 11:10:27 +0100 Message-ID: <87mvdriuss.fsf@mbork.pl> References: <87o9ydrzkr.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486894244 26861 195.159.176.226 (12 Feb 2017 10:10:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 12 Feb 2017 10:10:44 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 26.0.50.3 Cc: Emacs developers To: John Wiegley Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 12 11:10:39 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccr77-0006RW-90 for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2017 11:10:37 +0100 Original-Received: from localhost ([::1]:51317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccr79-0003PY-LZ for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2017 05:10:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccr6S-0003O4-Px for emacs-devel@gnu.org; Sun, 12 Feb 2017 05:09:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccr6P-0005PN-K6 for emacs-devel@gnu.org; Sun, 12 Feb 2017 05:09:56 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:34356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccr6P-0005Ov-C4 for emacs-devel@gnu.org; Sun, 12 Feb 2017 05:09:53 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id C15EDE6A25; Sun, 12 Feb 2017 11:09:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jfb9lHUr_LGu; Sun, 12 Feb 2017 11:09:48 +0100 (CET) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id AD0B4E6A15; Sun, 12 Feb 2017 11:09:48 +0100 (CET) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212269 Archived-At: On 2017-02-12, at 08:09, John Wiegley wrote: >>>>>> "MB" == Marcin Borkowski writes: > > MB> after several months of on-and-off work on bug#21072, I have implemented > MB> two (hopefully) nice features. One is an (almost) completely new > MB> version of mark-defun, which I hope works much better than the previous > MB> one: > > Can you clarify in what ways it is better? Reading through the text you > attached did not make it obvious to me... Well, sorry for that - all details are in the quite extensive thread about bug 21072. Here's a short summary of what "my" mark-defun tries to accomplish (I hope my memory serves me well here...) in case you have better things to do than reading through tens of old messages;-). 0. In order to test mark-defun more easily, I introduced the elisp-tests-with-temp-buffer macro. It accepts a string (or a string-valued variable) and runs the rest of its body in an Elisp buffer with that very string, with the exception that you can put special "markers" in that string (by default, of the form "=!name="), these markers are deleted from the temp buffer, and variables called "name" etc. are then bound to markers pointing at these positions. I would very much like some experienced Elisp hackers to look at it - I'm not sure it is entirely correct/elegant. 1. mark-defun is now extensively tested - it comes with a suite of about two dozen ert tests. 2. Bug#21072 is fixed - mark-defun between defuns marks the following defun, as its docstring and the manual say. 3. Both positive and negative arguments work correctly when the region is inactive (i.e., the right number of defuns are marked, either after or before the point). Both Drew and me (in the mentioned discussion) agreed that this is better than the allow-extend argument used now (which is probably quite useless anyway). 4. When the region is active, mark-defun selects one more defun (assuming that the region contains one or more defuns already - this is not checked), or abs(N) more defuns with an argument. With negative argument, the direction of selecting defuns is reversed (for the sake of following mark-defun commands). > Thanks, You're welcome, -- Marcin Borkowski