emacs-devel
[Top][All Lists]
Advanced

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

Re: Useless change in lisp.el?


From: Stefan Monnier
Subject: Re: Useless change in lisp.el?
Date: Mon, 26 Nov 2007 10:09:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> -The function (of no args) should go to the line on which the current
> -defun starts, and return non-nil, or should return nil if it can't
> -find the beginning.")
> +The function takes the same argument as `beginning-of-defun' and should
> +behave similarly, returning non-nil if it found the beginning of a defun.
> +Ideally it should move to a point right before an open-paren which encloses
> +the body of the defun.")

> As `beginning-of-defun-function' expressivly is
> introduced for all possible function definitions, it
> makes no sence to require or even to mention an open
> paren.

Sure it does: end-of-defun does basically
"(progn (beginning-of-defun-raw) (forward-sexp)", so if
beginning-of-defun-function stops right before an "open paren",
end-of-defun will do the right thing.  Otherwise, the programmer will
have to supply his own end-of-defun-function.  Note that since
forward-sexp can be customized with forward-sexp-function, the notion of
"open paren" may include things like "begin...end".

[ Yes, I know end-of-defun currently doesn't always use forward-sexp,
  I'm working on fixing that.  ]

If you see how to improve the doc to make this more clear, patches
are welcome.

> Other languages are completely free to design function
> definitions. Emacs should be able to follow them without specifying
> things no one may know at this time.

Indeed.  I did not write that the function *must* do it, just that it
should ideally do that.

> Too I pointed just these days at the fact, `beginning-of-defun' will
> be understood as top-level-form here rather than strictly
> a function-beginning.

Agreed.  I tried to keep this in mind when writing the above text, but
again, if you see a way to make it more clear, go for it.

> +   ;; we used to use end-of-defun for that, but it's not supposed to do
> +   ;; the same thing (it moves to the end of a defun not to the beginning
> +   ;; of the next).

> That's not the case.

Yes it is: try it in elisp-mode (with enough empty lines between defuns
that the difference caqn be noticed, of course).

> As `beginning-of-defun-function' together with `end-of-defun-function'
> are freely to design, progmodes could do that at their will.

No: end-of-defun can't know that it's called by beginning-of-defun.


        Stefan




reply via email to

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