[Top][All Lists]
[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: |
Sun, 16 Jul 2006 21:49:47 +0200 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060516) |
Richard Stallman schrieb:
Thanks for starting to explore this issue.
Because it only finds `defun' calls, it fails to find other constructs
that define functions or macros.
This would be the task of `beginning-of-form' - a more
abstract utility.
Also, it would get rather confused
when dealing with top-level forms that don't define functions at all:
it just skips them.
Imagine to make a `beginning-of-form' working the
way `thing-at-point' does: (beginning-of-form 'defvar)
etc.
The example suggests that this code avoids finding a match inside a
string, but in fact there is no code to check that. It just checks
that the (defun doesn't follow any non-indentation and that it includes
a function name and argument list.
Indeed. Will proceed here. Will it be possible to write a reg-exp which
matches a functions definition reliable? Just couldn't
get it until now. Probably a more prosperous way is to
write genuine mode-functions, in Emacs Lisp using the
list- and sexp-moving commands.
I think it would be more useful to specially recognize certain
top-level combining constructs, such as eval-when-compile and `when',
and treat their subforms as
Don't understand completely what this part means. Will
reflect it further.
defuns.
IMO different meanings of
`defun' in Emacs are the reason of a major difficulty
for beginners (at least for non-programmers).
Altogether I see no use and no reason to have it,
beside of historical ones.
To keep backward compatibility while replacing all
`defun'-namings where `function' or just top-level-form
is meant, it could be done while defining aliases at all
cases where `function' is the right name.
Of course the manuals must be corrected afterwards, but
that's seems not a too complicated task, as quite
often only a word is to change.
;; The mode should set this, if possible
(defcustom beginning-of-function-return-value t
"Specify the return value if function succeeds: either t or the value
of point"
:group 'lisp
:type '(choice (const t)
(sexp :tag "Return function" (point))))
I think that feature is unhelpful complexity. It would be better to
have just one return value convention. If the caller of
beginning-of-function wants the value of point, it can do (if
(beginning-of-function) (point))
Would not consider it a important question. Just need the
point as return value and would save writing with it.
`beginning-of-defun-raw' at the moment closes:
and (re-search-backward ...)
(progn (goto-char (1- (match-end 0)))) t))
Why the `t' instead of the more useful (point)? Isn't
the value of point true anyway?
As there are probably reasons to put it that way which
I ignore, I didn't abolish it, just turned to
(point). With the default as `t' the
user won't remark a changing here.
__
Andreas Roehler
- [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/08
- Re: [Fwd: Re: beginning-of-defun], Thien-Thi Nguyen, 2006/07/08
- Re: [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/10
- Re: [Fwd: Re: beginning-of-defun], Thien-Thi Nguyen, 2006/07/10
- Re: [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/10
- Re: [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/14
- Re: [Fwd: Re: beginning-of-defun], Richard Stallman, 2006/07/16
- Re: [Fwd: Re: beginning-of-defun],
Andreas Roehler <=
- Re: [Fwd: Re: beginning-of-defun], Richard Stallman, 2006/07/17
- Re: [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/17
- Re: [Fwd: Re: beginning-of-defun], Thien-Thi Nguyen, 2006/07/17
- Re: [Fwd: Re: beginning-of-defun], Richard Stallman, 2006/07/17
- Re: [Fwd: Re: beginning-of-defun], Andreas Roehler, 2006/07/18