unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Thien-Thi Nguyen'" <ttn@gnuvola.org>
Cc: emacs-devel@gnu.org
Subject: RE: Why is `C-M-x' only for top-level defuns?
Date: Wed, 11 Jan 2012 14:22:18 -0800	[thread overview]
Message-ID: <A795094B107748608674FD41577170A4@us.oracle.com> (raw)
In-Reply-To: <87vcohc48w.fsf@gnuvola.org>

>  (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	other threads:[~2012-01-11 22:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 17:06 Why is `C-M-x' only for top-level defuns? Drew Adams
2012-01-11 21:34 ` Thien-Thi Nguyen
2012-01-11 22:22   ` Drew Adams [this message]
2012-01-12  0:11 ` Juri Linkov
2012-01-12  0:36   ` Drew Adams
2012-01-12  1:27     ` Stefan Monnier
2012-01-12  2:40       ` Daniel Colascione
2012-01-12  3:42         ` Drew Adams
2012-01-12  4:05           ` Stefan Monnier
2012-01-12  4:15             ` Daniel Colascione
2012-01-12  6:34             ` Thierry Volpiatto
2012-01-12 15:29               ` Drew Adams
2012-01-12 10:30             ` Juri Linkov
2012-01-12 15:29               ` Drew Adams
2012-01-12 15:21             ` Drew Adams
2012-01-12 16:25               ` Drew Adams
2012-01-12 16:52                 ` Dave Abrahams
2012-01-12  5:23 ` Stephen J. Turnbull
2012-01-12 15:29   ` Drew Adams
2012-01-12 16:47     ` Stephen J. Turnbull
2012-01-12 16:56       ` Dave Abrahams

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=A795094B107748608674FD41577170A4@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=ttn@gnuvola.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).