[Top][All Lists]

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

bug#2379: [PATCH?] lisp.el: beginning-of-defun

From: Stefan Monnier
Subject: bug#2379: [PATCH?] lisp.el: beginning-of-defun
Date: Thu, 19 Feb 2009 12:31:22 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux)

> There's some strange programming style in `beginning-of-defun-raw' for
> Emacs 22.2, perhaps this is what was meant by the use of this `progn'
> syntax?

> -      (progn (goto-char (1- (match-end 0)))) t))
> +      (progn (goto-char (1- (match-end 0))) t)))

I think that was the intention.  Note that it turns out that the two
forms are equivalent in this context (because goto-char never returns

> Then, once that is figured out, why doesn't `beginning-of-defun'
> manage zero arguments like many of the movement commands do?

I'd rather not touch its behavior for 0.  Basically, it should never be
called with a 0 argument (see below).

> Support for a zero argument in these functions is important for
> situations where you want to be programmatic with
> `beginning-of-defun',   Can this be fixed?

AFAICT, proper support for 0 would require a serious rethink of BOD's
semantics: currently if you're inside defun number N, then (BOD i) moves
to (N-(i-1)) is i is positive and to (N-i) if i is negative.  I.e. it
moves to N if i=1 and to N+1 if i=-1, so where should 0 move to: there
is no other defun between those two.


reply via email to

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