all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: npostavs@users.sourceforge.net
Cc: 21072@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#21072: Brave new mark-defun (and a testing tool)
Date: Fri, 21 Apr 2017 14:24:34 +0200	[thread overview]
Message-ID: <87zifa9ce5.fsf@jane> (raw)
In-Reply-To: <877f2hs1nw.fsf@users.sourceforge.net>


On 2017-04-19, at 02:04, npostavs@users.sourceforge.net wrote:

> Marcin Borkowski <mbork@mbork.pl> 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





  parent reply	other threads:[~2017-04-21 12:24 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08  6:01 Brave new mark-defun (and a testing tool) Marcin Borkowski
2017-02-12  7:09 ` John Wiegley
2017-02-12 10:10   ` Marcin Borkowski
2017-02-12 10:13     ` Marcin Borkowski
2017-02-12 21:29     ` John Wiegley
2017-02-13 11:00       ` Marcin Borkowski
2017-02-13 15:16         ` Dmitry Gutov
2017-02-13 15:58           ` Marcin Borkowski
2017-02-13 19:00           ` John Wiegley
2017-02-14 10:45             ` bug#21072: " Marcin Borkowski
2017-02-14 13:02               ` Dmitry Gutov
2017-02-14 13:02               ` Dmitry Gutov
2017-02-14 19:06                 ` Marcin Borkowski
2017-02-14 19:06                 ` Marcin Borkowski
2017-02-14 19:25                   ` Stefan Monnier
2017-02-15  6:45                     ` Marcin Borkowski
2017-02-15  6:45                     ` Marcin Borkowski
2017-02-15  7:56                       ` Stefan Monnier
2017-02-15  7:56                       ` Stefan Monnier
2017-02-15 19:18                         ` Marcin Borkowski
2017-02-15 19:27                           ` Stefan Monnier
2017-02-16  4:40                             ` Marcin Borkowski
2017-02-16  4:40                             ` Marcin Borkowski
2017-02-16 13:22                               ` Stefan Monnier
2017-02-17  8:54                                 ` Marcin Borkowski
2017-03-07 16:46                                   ` Eli Zaretskii
2017-03-07 16:46                                   ` Eli Zaretskii
2017-03-29  6:34                                     ` Marcin Borkowski
2017-03-29  6:34                                     ` Marcin Borkowski
2017-03-31 11:18                                       ` Marcin Borkowski
2017-04-02 20:22                                         ` Glenn Morris
2017-04-07  8:26                                           ` Marcin Borkowski
2017-04-02 22:56                                         ` npostavs
2017-04-07  8:25                                           ` Marcin Borkowski
2017-04-07 14:41                                             ` Noam Postavsky
2017-04-18 12:35                                               ` Marcin Borkowski
2017-04-18 14:04                                                 ` Drew Adams
2017-04-18 14:38                                                   ` Eli Zaretskii
2017-04-19  0:04                                                 ` npostavs
2017-04-19  0:35                                                   ` John Mastro
2017-04-20  0:47                                                     ` John Mastro
2017-04-20 12:11                                                       ` Marcin Borkowski
2017-04-21 12:24                                                   ` Marcin Borkowski [this message]
2017-04-21 12:29                                                     ` Marcin Borkowski
2017-04-22 18:05                                                     ` npostavs
2017-04-24 12:17                                                       ` Marcin Borkowski
2017-04-24 12:52                                                         ` npostavs
2017-04-25 11:43                                                           ` Marcin Borkowski
2017-04-25 12:13                                                             ` npostavs
2017-04-25 20:49                                                             ` Noam Postavsky
2017-04-27 16:43                                                           ` Marcin Borkowski
2017-04-27 21:48                                                             ` Noam Postavsky
2017-04-30 14:49                                                               ` Marcin Borkowski
2017-04-30 15:19                                                               ` Marcin Borkowski
2017-04-30 16:10                                                                 ` Stefan Monnier
2017-04-30 18:04                                                                   ` Noam Postavsky
2017-04-30 18:46                                                                     ` Stefan Monnier
2017-04-30 19:18                                                                       ` npostavs
2017-04-30 20:09                                                                         ` Stefan Monnier
2017-04-30 21:41                                                                           ` npostavs
2017-04-30 22:03                                                                             ` Stefan Monnier
2017-04-30 22:21                                                                               ` npostavs
2017-05-03 15:20                                                                                 ` Marcin Borkowski
2017-05-03  5:27                                                                   ` Marcin Borkowski
2017-05-03  8:43                                                                     ` Michael Heerdegen
2017-05-03 12:44                                                                     ` Stefan Monnier
2017-05-09 12:39                                                               ` Marcin Borkowski
2017-05-10  2:53                                                                 ` npostavs
2017-05-10  3:15                                                                   ` Stefan Monnier
2017-05-10  3:31                                                                     ` npostavs
2017-05-10 16:31                                                                       ` Eli Zaretskii
2017-05-12  9:42                                                                   ` Marcin Borkowski
2017-05-12 20:32                                                                     ` npostavs
2017-05-14  5:13                                                                     ` Marcin Borkowski
2017-05-15  0:17                                                                       ` Glenn Morris
2017-05-16 22:38                                                                         ` npostavs
2017-05-20 22:30                                                                           ` npostavs
2017-04-02 22:56                                         ` npostavs
2017-03-07 16:50                                   ` Dmitry Gutov
2017-03-07 16:53                                     ` Eli Zaretskii
2017-03-07 16:53                                     ` Eli Zaretskii
2017-03-29  6:30                                       ` Marcin Borkowski
2017-03-29  6:30                                     ` Marcin Borkowski
2017-02-15 19:27                           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zifa9ce5.fsf@jane \
    --to=mbork@mbork.pl \
    --cc=21072@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.