[Top][All Lists]

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

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

From: Drew Adams
Subject: RE: Why is `C-M-x' only for top-level defuns?
Date: Wed, 11 Jan 2012 14:22:18 -0800

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

1. I haven't thought about redesigning it.  There might indeed be other things
to consider.

2. Offhand, I'd say why not let `C-M-x' always act on the innermost defface,
defcustom etc. containing point?  That would be clear to users and presumably
straightforward to implement.

3. That would mean that if you wanted to eval a top-level sexp containing a def*
you would need to place point outside the def*.  In this I agree with you that
"it is better to move point somewhere and be explicit."  Put point inside the
form you want and outside any subform you do not want.

4. That's _not_ what `C-x C-e' is for, AFAIK.  It does not re-eval an existing
face's definition etc.  AFAIK, the only way to get re-eval a defface etc. after
changing its code is to use `C-M-x'.

> That's the deriving answer.  The authoritarian answer is that "defun"
> has a specific meaning (form w/ open-paren in column 0).

Well, yes.  For some purposes (e.g. `beginning-of-defun') that makes sense.  But
does that column limitation make sense also for `C-M-x'?  That's the question.

("Top-level" defun is really not the same thing as having its open paren in
column 0.  I'm glad that by default the actual criterion used is column 0 and
not truly top-level.  If that were not the case then the workaround of
temporarily moving a non top-level defface to column 0 and hitting `C-M-x' would
not work.)

BTW, does option `open-paren-in-column-0-is-defun-start' work?  I cannot see any
difference if I set it to nil.  What's a good recipe to show what it does?  I
was expecting that with a nil value `C-M-x' etc. would actually require a
defface etc. to be top-level in the buffer, not just starting in column 0, in
order for it to be redefined.

> 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 :-]

Dunno what you mean.  Did I ask that decades ago?  Could be.  What was the
answer? ;-)

reply via email to

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