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: Fri, 21 Apr 2017 14:24:34 +0200 Message-ID: <87zifa9ce5.fsf@jane> 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 X-Trace: blaine.gmane.org 1492778808 6998 195.159.176.226 (21 Apr 2017 12:46:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Apr 2017 12:46:48 +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 Fri Apr 21 14:46:44 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 1d1XxT-0001it-Mc for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Apr 2017 14:46:43 +0200 Original-Received: from localhost ([::1]:59112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1XxZ-0002Fc-Ci for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Apr 2017 08:46:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1XbZ-0007fI-UX for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2017 08:24:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1XbW-0007re-Ky for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2017 08:24:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33549) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d1XbW-0007rX-H5 for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2017 08:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d1XbW-0003IH-AP for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2017 08:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Apr 2017 12:24: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.149277743512647 (code B ref 21072); Fri, 21 Apr 2017 12:24:02 +0000 Original-Received: (at 21072) by debbugs.gnu.org; 21 Apr 2017 12:23:55 +0000 Original-Received: from localhost ([127.0.0.1]:59981 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1XbP-0003Hu-DD for submit@debbugs.gnu.org; Fri, 21 Apr 2017 08:23:55 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:36302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1XbN-0003Hl-At for 21072@debbugs.gnu.org; Fri, 21 Apr 2017 08:23:53 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id E0CDEE6BBE; Fri, 21 Apr 2017 14:23:51 +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 Jc-_5mGGnADq; Fri, 21 Apr 2017 14:23:48 +0200 (CEST) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id ABB2FE602D; Fri, 21 Apr 2017 14:23:48 +0200 (CEST) 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:131823 Archived-At: 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) > "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))))) 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... > 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. 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.) I wouldn't like to resign from marking comments; I think it is pretty useful. So I'm going to delete the branch with the wrong name and push another one, with the fixes we discussed earlier. Best, -- Marcin Borkowski