From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#21072: Brave new mark-defun (and a testing tool) Date: Sat, 22 Apr 2017 14:05:03 -0400 Message-ID: <87shl0pbcg.fsf@users.sourceforge.net> References: <87o9ydrzkr.fsf@mbork.pl> <87wpctgieu.fsf@mbork.pl> <52e67f43-edcf-09e3-5fd6-6079763fd234@yandex.ru> <87tw7wh9sf.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492884260 21794 195.159.176.226 (22 Apr 2017 18:04:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2017 18:04:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 21072@debbugs.gnu.org, Stefan Monnier To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 22 20:04:15 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 1d1zOI-0005X2-6W for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Apr 2017 20:04:14 +0200 Original-Received: from localhost ([::1]:36439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1zON-0000B8-VQ for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Apr 2017 14:04:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1zOB-00008s-Ru for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2017 14:04:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1zO6-0002SV-U5 for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2017 14:04:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36457) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d1zO6-0002SQ-Pl for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2017 14:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d1zO6-0005QP-FK for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2017 14:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Apr 2017 18:04:02 +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.149288422120825 (code B ref 21072); Sat, 22 Apr 2017 18:04:02 +0000 Original-Received: (at 21072) by debbugs.gnu.org; 22 Apr 2017 18:03:41 +0000 Original-Received: from localhost ([127.0.0.1]:34656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1zNl-0005Pp-G0 for submit@debbugs.gnu.org; Sat, 22 Apr 2017 14:03:41 -0400 Original-Received: from mail-it0-f67.google.com ([209.85.214.67]:32868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1zNj-0005Pc-C8 for 21072@debbugs.gnu.org; Sat, 22 Apr 2017 14:03:39 -0400 Original-Received: by mail-it0-f67.google.com with SMTP id z67so5779603itb.0 for <21072@debbugs.gnu.org>; Sat, 22 Apr 2017 11:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=nBu5ytbMhZ96u+FkrQ8+zXaZp78dmTUxtueQJgiwzcI=; b=kgeDewweGLjunNZvS7HeHRJTBnH52Ow48u6mZopGD+k5Scgfs6X/CgOR6V21gv0zc0 mvRHFCq3KGzAldAFPW8+1Qadi+8ClMiKEf6gQtPVBg0eWtOnvKHQdfz+N8gHip/lb3Ok ymjdEAAwG7RAla1ybpR/EfFORNy0+jzmngjHsrPBcrSKF+8TltYbiZLsUT52mMUpnHGP QN+EhL/HWoRbgO3lYXpPRu3loglRR79b4N1ne4BVcn2D54ZSBV9MebrGb61ToGhIzNkI z2DFV/mqhur3fYeLz7bbpFlF4CwWH7XwTAtGRW5W1KPJkf1h928OEjjBXwqI5W0EC7YW 0rKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=nBu5ytbMhZ96u+FkrQ8+zXaZp78dmTUxtueQJgiwzcI=; b=eac4aIyQNwEaIadmKjeCYXXVA8LAvJ4F9cgZflPGDYdPcpGc8dcEdO8Z+tiQp9bVzn 1g3ZI4eyVPcE2J+3FG9BHe0NCdgSd9apUjsOwlDWSXtkRu8aEWg+El2ntG4BroNVlpFw 62TCvzYYNjtGyi2zPsrZRMqlXIe5gjn1RY4BIH2UQaL4niwBiodWDILn+Nt4iX0NoZ9i VdG81jhGjsuqO01W+t4gAg97uVtaO/waO0a1J/+vCe69vognXMLsCo9LLCUtleB0qoQQ nvrquKzXbShmpy2Z1TyIWxE8Nz499ElC5bIonQ7weojkZYCK9gZIufK87BPolO3g+mBy ynDA== X-Gm-Message-State: AN3rC/6eowsqkUophNN7hkpL9VR6Y1K/Ljwu8P8z/arQi3TZ3+gXocWl kURQgv3JFmRh7w== X-Received: by 10.36.40.81 with SMTP id h78mr5100281ith.44.1492884213830; Sat, 22 Apr 2017 11:03:33 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id u133sm2896010iod.21.2017.04.22.11.03.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Apr 2017 11:03:33 -0700 (PDT) In-Reply-To: <87zifa9ce5.fsf@jane> (Marcin Borkowski's message of "Fri, 21 Apr 2017 14:24:34 +0200") 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:131882 Archived-At: Marcin Borkowski writes: > On 2017-04-19, at 02:04, npostavs@users.sourceforge.net wrote: > >> Marcin Borkowski writes: >> >>>> Oh, right, I thought it was doing backward-comment, but the difference >>>> is that it stops at blank lines, thus the *non-redundant* looking-at >>>> call. >>>> >>>> I wonder if that's a sensible thing to do for languages that have >>>> multiline comments though, e.g. Javascript: >>>> >>>> /* >>>> >>>> This function returns 0 >>>> >>>> */ >>>> function foo () { >>>> return 0; >>>> } >>>> >>>> Although we might say that such comments should have "*" on the empty lines. >>> >>> Definitely. OTOH, what if they don't...? I'm not sure how to detect >>> such a situation. Any ideas? >> >> (defun beginning-of-defun-comments (&optional arg) [...] > > 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: (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 (point)) (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))))) > > I'm tempted to leave it is it is in my branch. For one, I'm a bit tired > by all this and I'd like to move on; also, as you said above, there is > little hope to do it "100% correctly", and I guess my solution may be > good enough. (I'm pretty sure it's better than the status quo, at > least.) Yeah, since there's no perfect answer, I think it's fine if you just go with whichever version you like best. If people disagree, we'll find out in bug reports :) > as I mentioned a few minutes ago, I pushed the fix/bug-21072 branch with > a few fixes discussed in this thread. If it is in good enoug shape to > merge into master, please tell me and I'll do it; if not, I'll fix what > should be fixed (commit messages?) Looks good to me (apart from the commit messages).