all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: emacs-devel@gnu.org
Subject: Useless change in lisp.el?
Date: Sun, 25 Nov 2007 17:55:50 +0100	[thread overview]
Message-ID: <200711251755.50891.andreas.roehler@online.de> (raw)


I doubt if the change seen in

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/lisp.el,v

Changes by:Stefan Monnier <monnier>07/11/22 22:12:22

is valid. It don't add any functionality AFAIS.

As arguments given for it are wrong AFAIU, it might
lead to confusion.

+++ lisp/emacs-lisp/lisp.el22 Nov 2007 22:12:20 -00001.81
@@ -175,9 +175,10 @@
if defining `defun-prompt-regexp' is not sufficient to handle the mode's
needs.

-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. 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.

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.


(defun beginning-of-defun (&optional arg)
 "Move backward to the beginning of a defun.
@@ -218,12 +219,22 @@
 (unless arg (setq arg 1))
 (cond
  (beginning-of-defun-function
+  (condition-case nil
+    (funcall beginning-of-defun-function arg)
+   ;; We used to define beginning-of-defun-function as taking no argument
+   ;; but that makes it impossible to implement correct forward motion:
+   ;; 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. As `beginning-of-defun-function'
together with `end-of-defun-function' are freely to
design, progmodes could do that at their will. See BTW
`she-beg-end.el' in source-list. Adding an `arg'
here don't touch that question.

+   ;; In case the beginning-of-defun-function uses the old calling
+   ;; convention, fallback on the old implementation.
+   (wrong-number-of-arguments
  (if (> arg 0)
(dotimes (i arg)
 (funcall beginning-of-defun-function))
   ;; Better not call end-of-defun-function directly, in case
   ;; it's not defined.
-   (end-of-defun (- arg))))
+     (end-of-defun (- arg))))))

Here an unnecessary complication comes in together with a provision for just 
that complication.

In the result we have may have two instances aiming the
same arg and extra need to look, where the argument is
set.
 
Thanks

Andreas Röhler

             reply	other threads:[~2007-11-25 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-25 16:55 Andreas Röhler [this message]
2007-11-26 15:09 ` Useless change in lisp.el? Stefan Monnier
2007-11-26 18:14   ` Andreas Röhler
2007-11-26 18:33     ` Andreas Röhler
2007-11-26 19:26     ` Stefan Monnier
2007-11-26 19:58       ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711251755.50891.andreas.roehler@online.de \
    --to=andreas.roehler@online.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.