emacs-devel
[Top][All Lists]
Advanced

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

Re: Why is `C-M-x' only for top-level defuns?


From: Thien-Thi Nguyen
Subject: Re: Why is `C-M-x' only for top-level defuns?
Date: Wed, 11 Jan 2012 22:34:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

() "Drew Adams" <address@hidden>
() Wed, 11 Jan 2012 09:06:24 -0800

   There is likely a good reason for this, but I'll still pose the question,
   to learn.

   Why not let `C-M-x' re-evaluate a "defun" (defcustom, defface, etc.) that
   is not necessarily at top level?  E.g., with point on, say, `defface' in
   this sexp, why shouldn't `C-M-x' redefine the face?

   (when twillig-&-the-tithy-toves-do-tyre-&-timble-in-the-twabe
     (defface ...))

   Currently, in order to make `C-M-x' work for such a "defun" I temporarily
   move its first line to column 1 and then hit `C-M-x'.  Seems like a silly
   workaround, but I don't know of a better one.  Am I missing something?

In the example above, the outermost form is a conditional expression,
and the definition is internal.  What if you have:

 (when CONDITION
   (deffoo NAME (if CONDITION
                    (defbar NAME VALUE)
                  (defbaz NAME VALUE))))

?  Then, getting ‘C-M-x’ to Do What You Mean when point is "inside
somewhere" is challenged by the multiple definitions.  Better to move
point to some place and be explicit.  That's what ‘C-x C-e’ is for.

That's the deriving answer.  The authoritarian answer is that "defun"
has a specific meaning (form w/ open-paren in column 0).  The cavalier
answer is that "maybe someone already asked this on help-gnu-emacs
one or two decades ago, hint hint".  [insert long-nosed mockup, here :-]



reply via email to

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