unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Why is `C-M-x' only for top-level defuns?
Date: Thu, 12 Jan 2012 07:34:00 +0100	[thread overview]
Message-ID: <87fwflsa3r.fsf@gmail.com> (raw)
In-Reply-To: jwvpqepa7vd.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Stefan might be right that it would be difficult to get right - dunno.
>> Off the top of my head, however, I'd guess that just going `uplist'
>> from point till finding `defface', `defcustom', or `defvar' as the car
>> might be good enough.
>
> C-M-x differs from C-x C-e in two aspects:
> 1- it "guesses" which sexp is meant.
> 2- it handles defface/defvar/defcustom specially.
> IIUC you're only worried about the first partt o the extent that it
> prevents you from getting to the second.  I.e. what you're after is
> a way to get (2) of C-M-x for sexps where (1) currently fails.
>
> I'm not very much in fa vor of trying to make (1) smarter because it
> will make it less uniform.  So we could maybe provide a new command
> half-way between C-x C-e and C-M-x, or maybe change (1) so that it uses
> the region if active.

With anything, you can put point in any sexp of a block an eval it.
If needed you can edit it in minibuffer to provide a result.
Here cursor is on the let sexp and i hit `C-u C-:' and then edit it to
have a value for 'a' and 'b'.

(defun foo (a b)
  -!-(let ((c (+ a b)))
    (+ a b c)))

http://tinyurl.com/739svnv

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




  parent reply	other threads:[~2012-01-12  6:34 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
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 [this message]
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=87fwflsa3r.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.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).