[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: Thierry Volpiatto
Subject: Re: Why is `C-M-x' only for top-level defuns?
Date: Thu, 12 Jan 2012 07:34:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Stefan Monnier <address@hidden> 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)))


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

reply via email to

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