From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#21072: Brave new mark-defun (and a testing tool) Date: Tue, 25 Apr 2017 13:43:38 +0200 Message-ID: <87wpa8yaol.fsf@jane> References: <87o9ydrzkr.fsf@mbork.pl> <87k28sdka6.fsf@jane> <87efyze00g.fsf@jane> <87bmu2eoji.fsf@jane> <87wpcpw61w.fsf@jane> <83o9xdghmc.fsf@gnu.org> <87o9wkoald.fsf@jane> <87a881ofsu.fsf@jane> <87k272wh8x.fsf@users.sourceforge.net> <871st4aal7.fsf@jane> <87tw5l7v26.fsf@jane> <877f2hs1nw.fsf@users.sourceforge.net> <87zifa9ce5.fsf@jane> <87shl0pbcg.fsf@users.sourceforge.net> <87shky9ez8.fsf@jane> <8737cyotmt.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1493120651 16349 195.159.176.226 (25 Apr 2017 11:44:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Apr 2017 11:44:11 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 26.0.50 Cc: 21072@debbugs.gnu.org, Stefan Monnier To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 25 13:44:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1d2yt4-00044b-A8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Apr 2017 13:44:06 +0200 Original-Received: from localhost ([::1]:48656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2ytA-00029O-2S for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Apr 2017 07:44:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2yt4-000296-CF for bug-gnu-emacs@gnu.org; Tue, 25 Apr 2017 07:44:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2yt0-00029P-6h for bug-gnu-emacs@gnu.org; Tue, 25 Apr 2017 07:44:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2yt0-00029H-2B for bug-gnu-emacs@gnu.org; Tue, 25 Apr 2017 07:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d2ysz-0006z1-QD for bug-gnu-emacs@gnu.org; Tue, 25 Apr 2017 07:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Apr 2017 11:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21072 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21072-submit@debbugs.gnu.org id=B21072.149312060226785 (code B ref 21072); Tue, 25 Apr 2017 11:44:01 +0000 Original-Received: (at 21072) by debbugs.gnu.org; 25 Apr 2017 11:43:22 +0000 Original-Received: from localhost ([127.0.0.1]:38867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2ysM-0006xx-9Y for submit@debbugs.gnu.org; Tue, 25 Apr 2017 07:43:22 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:58661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2ysK-0006xn-GK for 21072@debbugs.gnu.org; Tue, 25 Apr 2017 07:43:21 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 9F410E630C; Tue, 25 Apr 2017 13:43:16 +0200 (CEST) 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 7ngwymHV9Y7h; Tue, 25 Apr 2017 13:43:13 +0200 (CEST) Original-Received: from localhost (unknown [62.3.162.100]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 21321E62BC; Tue, 25 Apr 2017 13:43:13 +0200 (CEST) In-reply-to: <8737cyotmt.fsf@users.sourceforge.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131951 Archived-At: On 2017-04-24, at 14:52, npostavs@users.sourceforge.net wrote: > Marcin Borkowski writes: > >> On 2017-04-22, at 20:05, npostavs@users.sourceforge.net wrote: >> >>>> Still not there - I tried first on Elisp, like this: >>>> >>>> ;; A comment >>>> (defun ...) >>>> >>>> and it left the point at the end of the "A comment" line instead of at >>>> the beginning... >>> >>> Hmm, I don't get that, although I did miss an inf loop when the comment >>> is at beginning of buffer. Here is a fixed version: >> >> Still the same here, also in emacs -Q. > > Hmm, I was testing before now just by evaluating the changed functions > after startup, I must have messed something up. I think this one might > be okay. > > (defun beginning-of-defun-comments (&optional arg) > "Move to the beginning of ARGth defun, including comments." > (interactive "^p") > (unless arg (setq arg 1)) > (beginning-of-defun arg) > (while (let ((pt (line-beginning-position)) > (ppss (and (zerop (forward-line -1)) (syntax-ppss)))) > (cond ((nth 4 ppss) (goto-char (nth 8 ppss))) > ((and ppss > (parse-partial-sexp > (point) (line-end-position) nil t ppss) > (not (bolp)) (eolp))) > (t (goto-char pt) nil))))) Quick tests show that you are right. I'd like to understand the code, too - that will take me a while. >>> Looks good to me (apart from the commit messages). > > Actually, now that I've applied this thing properly, I notice 2 test > failures in batch mode: > > 2 unexpected results: > FAILED mark-defun-arg-region-active > FAILED mark-defun-no-arg-region-active > > They pass when run in interactive mode (I haven't looked into why). That seems strange - all tests pass here with M-x ert. What do you mean by "batch mode"? >> What should they look like, then? Should I make all of them into the >> ChangeLog format, or just rebase/squash all of them so that there are >> two of them only (one for the testing tool and one for the >> beginning-of-defun)? > > Yeah, I would go ahead and squash them, since you need to rebase to fix > commit messages anyway. Will do. Thanks, -- Marcin Borkowski