From: npostavs@users.sourceforge.net
To: Marcin Borkowski <mbork@mbork.pl>
Cc: emacs-devel@gnu.org, 21072@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#21072: Brave new mark-defun (and a testing tool)
Date: Sun, 02 Apr 2017 18:56:46 -0400 [thread overview]
Message-ID: <87k272wh8x.fsf__26855.253466829$1491173774$gmane$org@users.sourceforge.net> (raw)
In-Reply-To: <87a881ofsu.fsf@jane> (Marcin Borkowski's message of "Fri, 31 Mar 2017 13:18:25 +0200")
Marcin Borkowski <mbork@mbork.pl> writes:
>
> OK, I pushed the branch "fix-bug-21072". Can anyone confirm that it's
> ok and either merge it into master or tell me that I can do it?
> \f
> +** New macro 'elisp-tests-with-temp-buffer'
> +which helps writing tests for functions that should change buffers in
> +specific ways or manipulate point or mark positions.
> +
> +---
I don't this should be documented in NEWS since the macro is being added
to a test file, so it's not part of Emacs' libraries. Also, the format
of the NEWS entry is wrong in the same way as the next one (see below).
> +With a prefix argument, it marks that many defuns or extends the
> +region by the appropriate number of defuns. With negative prefix
> +argument it marks defuns in the opposite direction and also changes
> +the direction of selecting for subsequent uses of @code{mark-defun}.
This doesn't say what exactly happens with zero as argument. The code
seems to do something odd. Perhaps it should just be a user-error
instead? Or maybe just a nop.
> modified etc/NEWS
> @@ -363,6 +363,15 @@ words where first character is upper rather than title case, e.g.,
> "DŽungla" instead of "Džungla".
>
> \f
> +** New behavior of 'mark-defun' implemented
> +Prefix argument selects that many (or that many more) defuns.
> +Negative prefix arg flips the direction of selection. Also,
> +'mark-defun' between defuns correctly selects N following defuns (or
> +-N previous for negative arguments). Finally, comments preceding the
> +defun are selected unless they are separated from the defun by a blank
> +line.
> +
> ++++
> * Changes in Specialized Modes and Packages in Emacs 26.1
>
This entry should go before the page separator, and the "+++" should go
on the line just above the entry, not after it.
> +(defun beginning-of-defun-comments (&optional arg)
> + (let (nbobp)
> + (while (progn
> + (setq nbobp (zerop (forward-line -1)))
> + (and (not (looking-at "^\\s-*$"))
> + (beginning-of-defun--in-emptyish-line-p)
> + nbobp)))
> + (when nbobp
> + (forward-line 1))))
The looking-at call is redundant, right? Anyway, can't that all be
replaced by just
(forward-comment (- (point)))
(unless (bolp)
(forward-line 1))
> +(defun mark-defun (&optional arg)
> + (let (nbobp)
> + (while (progn
> + (setq nbobp (zerop (forward-line -1)))
> + (and (looking-at "^\\s-*$")
> + nbobp)))
> + (when nbobp
> + (forward-line 1))))
I think this can be just
(skip-chars-backward "[:space:]\n")
(unless (bolp)
(forward-line 1))
next prev parent reply other threads:[~2017-04-02 22:56 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87o9ydrzkr.fsf@mbork.pl>
[not found] ` <m2bmu7lwal.fsf@newartisans.com>
[not found] ` <87mvdriuss.fsf@mbork.pl>
[not found] ` <m2k28v3xp2.fsf@newartisans.com>
[not found] ` <87bmu6icea.fsf@mbork.pl>
[not found] ` <c04b44ac-8bd4-ecfa-5d2f-492135a067ad@yandex.ru>
[not found] ` <m2d1el29yr.fsf@newartisans.com>
2017-02-14 10:45 ` bug#21072: Brave new mark-defun (and a testing tool) Marcin Borkowski
2017-02-14 13:02 ` Dmitry Gutov
[not found] ` <52e67f43-edcf-09e3-5fd6-6079763fd234@yandex.ru>
2017-02-14 19:06 ` Marcin Borkowski
[not found] ` <87tw7wh9sf.fsf@mbork.pl>
[not found] ` <jwvr330wp9a.fsf-monnier+gmane.emacs.devel@gnu.org>
2017-02-15 6:45 ` Marcin Borkowski
[not found] ` <87k28sdka6.fsf@jane>
2017-02-15 7:56 ` Stefan Monnier
[not found] ` <jwvh93vopsr.fsf-monnier+Inbox@gnu.org>
2017-02-15 19:18 ` Marcin Borkowski
2017-02-15 19:27 ` Stefan Monnier
[not found] ` <jwvbmu3p88m.fsf-monnier+Inbox@gnu.org>
2017-02-16 4:40 ` Marcin Borkowski
[not found] ` <87bmu2eoji.fsf@jane>
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:50 ` Dmitry Gutov
2017-03-07 16:53 ` Eli Zaretskii
2017-03-29 6:30 ` Marcin Borkowski
[not found] ` <83innlgh95.fsf@gnu.org>
2017-03-29 6:30 ` Marcin Borkowski
[not found] ` <83o9xdghmc.fsf@gnu.org>
2017-03-29 6:34 ` Marcin Borkowski
[not found] ` <87o9wkoald.fsf@jane>
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 [this message]
[not found] ` <87k272wh8x.fsf@users.sourceforge.net>
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
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='87k272wh8x.fsf__26855.253466829$1491173774$gmane$org@users.sourceforge.net' \
--to=npostavs@users.sourceforge.net \
--cc=21072@debbugs.gnu.org \
--cc=emacs-devel@gnu.org \
--cc=mbork@mbork.pl \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).