[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21072: Brave new mark-defun (and a testing tool)
From: |
npostavs |
Subject: |
bug#21072: Brave new mark-defun (and a testing tool) |
Date: |
Sun, 02 Apr 2017 18:56:46 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
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?
>
> +** 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".
>
>
> +** 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))
- bug#21072: Brave new mark-defun (and a testing tool), Glenn Morris, 2017/04/02
- bug#21072: Brave new mark-defun (and a testing tool),
npostavs <=
- bug#21072: Brave new mark-defun (and a testing tool), Marcin Borkowski, 2017/04/07
- bug#21072: Brave new mark-defun (and a testing tool), npostavs, 2017/04/18
- bug#21072: Brave new mark-defun (and a testing tool), John Mastro, 2017/04/18
- bug#21072: Brave new mark-defun (and a testing tool), John Mastro, 2017/04/19
- bug#21072: Brave new mark-defun (and a testing tool), Marcin Borkowski, 2017/04/20
- bug#21072: Brave new mark-defun (and a testing tool), Marcin Borkowski, 2017/04/21