[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21072: 24.5; inconsistent behaviour of `C-M-h (mark-defun)' in Emacs

From: Marcin Borkowski
Subject: bug#21072: 24.5; inconsistent behaviour of `C-M-h (mark-defun)' in Emacs Lisp
Date: Tue, 07 Feb 2017 07:22:51 +0100
User-agent: mu4e 0.9.19; emacs

Hi Drew, hi all,

sorry for the delay - as I mentioned last time, I was going to have
a very busy semester, which now came to an end - and hence I'm back.

On 2016-11-27, at 19:51, Drew Adams <drew.adams@oracle.com> wrote:

> Again, thanks for working on this.
>> (defun in-comment-line-p ()
>>   "Return non-nil if the point is in a comment line.
>> See http://lists.gnu.org/archive/html/help-gnu-emacs/2016-
>> 08/msg00141.html"
> The second doc-string sentence should just be a comment in the
> code, if it is needed at all.

Done, thanks.

>> If the mark is active, it marks the next defun after the one(s)
>> already marked.  With positive ARG, mark that many more defuns.
> more -> next

Done, thanks.

>>   ;; Trick with 'mark-defun-back due to Drew Adams
> No need for the attribution. ;-)

Why not;-)?  I'll change it to a link to your message, however - this
might be actually more useful for future developers.

> I didn't really test, but for this:
> (defun a ()
>   nil)
> (defun b ()
>   nil)
> ;;;;
> (defun c ()
>   nil)
> With point anywhere in either of the last two defuns or
> on the comment line between them, `M-- C-M-h' selects not
> only the expected defun but also the last line of the
> defun before it.
> E.g., with point at the beginning of the comment line,
> this is selected:
>   nil)
> (defun a ()
>   nil)

Yep, you're right.  However, this seems to be a strange feature of
beginning-of-defun.  Place the point at the very same place at say M-:
(beginning-of-defun 0).  See?

Since I guess almost nobody follows this discussion anymore, I'll ask
about it in a separate thread on emacs-devel.  The question remains,
however: should I "fix" beginning-of-defun or just circumvent this
behavior in my code?


Marcin Borkowski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]