GNU bug report logs -
#21072
24.5; inconsistent behaviour of `C-M-h (mark-defun)' in Emacs Lisp
Previous Next
Reported by: Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Date: Thu, 16 Jul 2015 06:13:01 UTC
Severity: minor
Found in version 24.5
Done: Marcin Borkowski <mbork <at> mbork.pl>
Bug is archived. No further changes may be made.
Full log
Message #164 received at 21072 <at> debbugs.gnu.org (full text, mbox):
Marcin Borkowski <mbork <at> 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))
This bug report was last modified 8 years and 81 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.