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: Tue, 18 Apr 2017 20:04:35 -0400 Message-ID: <877f2hs1nw.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492560255 19346 195.159.176.226 (19 Apr 2017 00:04:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2017 00:04:15 +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 Wed Apr 19 02:04:09 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 1d0d6P-0004se-JR for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Apr 2017 02:04:09 +0200 Original-Received: from localhost ([::1]:45076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0d6V-0007DH-IT for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Apr 2017 20:04:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0d6L-0007Cy-LT for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0d6I-0002GR-HV for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:04:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57132) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0d6I-0002GG-Em for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d0d6I-0006qi-47 for bug-gnu-emacs@gnu.org; Tue, 18 Apr 2017 20: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: Wed, 19 Apr 2017 00: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.149256019426267 (code B ref 21072); Wed, 19 Apr 2017 00:04:02 +0000 Original-Received: (at 21072) by debbugs.gnu.org; 19 Apr 2017 00:03:14 +0000 Original-Received: from localhost ([127.0.0.1]:55331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0d5W-0006pb-K8 for submit@debbugs.gnu.org; Tue, 18 Apr 2017 20:03:14 -0400 Original-Received: from mail-io0-f194.google.com ([209.85.223.194]:35830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0d5V-0006pO-EI for 21072@debbugs.gnu.org; Tue, 18 Apr 2017 20:03:14 -0400 Original-Received: by mail-io0-f194.google.com with SMTP id d203so1844036iof.2 for <21072@debbugs.gnu.org>; Tue, 18 Apr 2017 17:03:13 -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=knq3O4s4p41rttR8blvvC+Q4/I9G5VO6GTOZkXCWSeY=; b=e4cntT+7BIR8XRrcBjF8fNtCQMzIdo3BrvWsdPEelziTzBKY8Yn+bwxXVE1C3wgUIQ TTP9EglTfB9CKCS7ylMQM93lmd3hirKDMg4edw6uU/Ejj5woKTEQeWFmaZa2zXLBFKu5 GXn7q8pazoJ/6PNXAilZJzHiYD0yEayEVqMCCwl5vUaVZEEwgs0kzG3mfeDa19Ggru1/ UNq7q7iSkMMVyFRgv61amkH68ZcTucY3cCQYZH1aRiUu9tb/oM4bI6Ikl47uyEtMT4eL SKlmLwvTfbAnWWzLyhDj7NK8pdCBDGBl/uxiMTa5/mZUSDL1hU8PuiJiIWVgyq+mHXuH /hfQ== 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=knq3O4s4p41rttR8blvvC+Q4/I9G5VO6GTOZkXCWSeY=; b=U1/xbGK2Hbrta7dkeO63e7UmE00IzLPDDCcrkSJURElA1WrC1gzztLITSNZpVRZhHU c+L3DJpumHsVIV+BEiSevNm4b1lW258EKlR+lAyifl9R9YKVeWCuJufIC7NNmIpNML7M U38NKW7Sw7h52dsHrYgGCNsJbGkoXDBKZiV4zeKcYB1PxsTQJNdpZeXKGTOMA7anDcwq o/rONo6MN8vcJKGTrf/eH4Sl+W97QCnRAZW3u8Gg51kcc/ujIXizobuF4X/F1YgJ4Oir hfFCj+AzjbDlTYxzsc9Z5zucMwiyT6Hvho2XWa3ed15EfKU/wE+XTpR4pdr9uujQkhRo SvIg== X-Gm-Message-State: AN3rC/7KCvO97yFK6IdfPnUFl0SmRscDk01K43SfQuablwNDtW4FbPIt JW1ILYYe4/qCug== X-Received: by 10.107.130.99 with SMTP id e96mr633615iod.38.1492560187710; Tue, 18 Apr 2017 17:03:07 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id b91sm2337659itd.26.2017.04.18.17.03.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Apr 2017 17:03:06 -0700 (PDT) In-Reply-To: <87tw5l7v26.fsf@jane> (Marcin Borkowski's message of "Tue, 18 Apr 2017 14:35:13 +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:131746 Archived-At: 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))))) 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.