From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Mastro Newsgroups: gmane.emacs.bugs Subject: bug#21072: Brave new mark-defun (and a testing tool) Date: Tue, 18 Apr 2017 17:35:06 -0700 Message-ID: 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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1492562179 13666 195.159.176.226 (19 Apr 2017 00:36:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2017 00:36:19 +0000 (UTC) Cc: Marcin Borkowski , Stefan Monnier , Noam Postavsky To: 21072@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 19 02:36:13 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 1d0dbP-0003ND-Ji for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Apr 2017 02:36:12 +0200 Original-Received: from localhost ([::1]:45153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0dbV-00053g-2K for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Apr 2017 20:36:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0dbL-00051h-JF for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:36:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0dbI-0007Qz-F4 for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:36:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57153) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0dbI-0007QM-AE for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:36:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d0dbG-0007cq-G0 for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:36:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Mastro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Apr 2017 00:36: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.149256213529279 (code B ref 21072); Wed, 19 Apr 2017 00:36:02 +0000 Original-Received: (at 21072) by debbugs.gnu.org; 19 Apr 2017 00:35:35 +0000 Original-Received: from localhost ([127.0.0.1]:55352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0dao-0007cB-Uw for submit@debbugs.gnu.org; Tue, 18 Apr 2017 20:35:35 -0400 Original-Received: from mail-qt0-f176.google.com ([209.85.216.176]:34446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0dam-0007bx-Qq for 21072@debbugs.gnu.org; Tue, 18 Apr 2017 20:35:33 -0400 Original-Received: by mail-qt0-f176.google.com with SMTP id c45so7748872qtb.1 for <21072@debbugs.gnu.org>; Tue, 18 Apr 2017 17:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Q5Je8rLUBeiuk80d6pctmDFO5LhXd1VvjGX1pl7t4Zw=; b=Wt4W+f29KsrJbUhOml6ZqeABdiRjPBY7Swk8HWPctTXkQukebx4/UAqlh4lOjUm3Pt DT4fXsIfo1XgN3/03OVlchzjqM7klusVf6ZpNKZME8nm7uxy+ZBzmnts6bMvG0aCUOZQ vSGXLu92R7mu5FyRP+5GHuI+yWm1utJ3bQH86Cap6b2ZkVcc2Iem+27SKvBkAxwSa9JO n5aH/H8K4JULvQbDrqAPqDqB2n/NIX1HKirrsO305nX5PhJ+FCFjeEgkOpKqowZUZNgN LHmVZZoBGE9GGL6L8bVA5Rkse9hARO0kCc5h55c/y6S9oIYsVIh2OFusQf8HZt0Z/zql bdxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Q5Je8rLUBeiuk80d6pctmDFO5LhXd1VvjGX1pl7t4Zw=; b=ShcwewlBSd4zmA7MBRQhNiy/QnH7FBkZNjSstRhVpQPDSnsdB0iksOY41ByciPeiaP 4Y2FgFMuA7Tl9D2HrYPLgh9ayktgHMmn/xDxX4u1jPLeFhcN/LJOATRh/1nwk9eph8sR qqORe/kF3Nj/xj0fQzRrV1gLzfiXfr3R+EUdd9ed/Qk0HDyNDb9pI9WECnaB44ywsQpx 6F2rGhFbymXn4o2TYLMMDnxJNVq77O9cU3W1VQPOFROjCCWU4W/ARbRS1EhtMDdsAAyz U8RIx7QH7X5YoYJpk0khvSi8TisTqBx+LjsxekLhyJMMaMJX3PDgdTZIlYTTX1wgTtVA peCA== X-Gm-Message-State: AN3rC/58DTTfVrjO8Esyupu40pE7th1Gn0jigNEMeipkgHZLBmO0C5iK 0+rVUXLgSaJrvSwUISHX+ZNjxvmDPw== X-Received: by 10.237.52.162 with SMTP id x31mr131999qtd.263.1492562127125; Tue, 18 Apr 2017 17:35:27 -0700 (PDT) Original-Received: by 10.237.32.9 with HTTP; Tue, 18 Apr 2017 17:35:06 -0700 (PDT) In-Reply-To: <877f2hs1nw.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:131747 Archived-At: wrote: > (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 (prog1 (point) (forward-line -1))) > (ppss (syntax-ppss))) > (cond ((nth 4 ppss) (goto-char (nth 8 ppss))) > ((and (parse-partial-sexp > (point) (line-end-position) nil t ppss) > (not (bolp)) (eolp))) > (t (goto-char pt) nil))))) > > However there will always be some comment style that doesn't work, e.g. > > // Some description followed by a blank. > > function name(arg) { > > } > > Another option is to give up the comment marking, it seems a bit > complicated to implement and explain to users. Would it help to lean on (forward-comment -1) more? Something like this: (defun beginning-of-defun-comments (&optional arg) (interactive "^p") (let ((arg (or arg 1)) point) (beginning-of-defun arg) (setq point (point)) (while (not (eq point (setq point (progn (forward-comment -1) (point)))))) (skip-chars-forward "[:space:]\r\n"))) Having to `skip-chars-forward' at the end seems a bit awkward, but I think it does work on the recently mentioned JavaScript examples. John John