emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: [Fwd: Re: beginning-of-defun]


From: Andreas Roehler
Subject: Re: [Fwd: Re: beginning-of-defun]
Date: Mon, 10 Jul 2006 21:40:30 +0200
User-agent: Thunderbird 1.5.0.4 (X11/20060516)

Thien-Thi Nguyen schrieb:
   From: Andreas Roehler <address@hidden>
   Date: Mon, 10 Jul 2006 15:46:02 +0200

   It's not just for fun I entered this matter. `beginning-of-defun' is
   buggy - and a lot of forms which rely on it.

given the discussion so far i remain unconvinced there is a bug.  note
however: i'm not stopping you from continuing, personally.  if you post
code as the way to propose the bug fix, it that will be easier to
evaluate its merits.  remember to not break callers (both included w/
emacs and external) of `beginning-of-defun'.

thi


There are not many, but some cases, where `beginning-of-defun'
fails

To use a real existing inner form (cursor at roof-sign):

(when (boundp 'bar)
 (defun e-r-t-l ()
   (let ((starting-point (point)))
     (end-of-defun)
     (beginning-of-defun)
     (prog1
     (edebug-read-and-maybe-wrap-form)
   ;; Recover point, but only if no error occurred.
   (goto-char starting-point)))))
                            ^

M-x eval-defun ==> nil
Evaluation fails caused by failure of (beginning-of-defun)

(defun e-r-t-l ()
 (let ((starting-point (point)))
   (end-of-defun)
   (beginning-of-defun)
   (prog1
   (edebug-read-and-maybe-wrap-form)
     ;; Recover point, but only if no error occurred.
     (goto-char starting-point))))
                          ^

M-x eval-defun ==> e-r-t-l

However, it should also work in the first case.

As I need it to call from programs, it should be possible to rely
on.

Hopeful to send some scratch next days.
__
Andreas Roehler





reply via email to

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