On 1/11/12 8:05 PM, Stefan Monnier wrote: >> 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. What about replacing 2 with something like this? (Untested) === modified file 'src/eval.c' --- src/eval.c 2011-12-04 15:46:07 +0000 +++ src/eval.c 2012-01-12 04:12:30 +0000 @@ -827,7 +827,7 @@ SDATA (SYMBOL_NAME (sym))); } - if (NILP (tem)) + if (NILP (tem) || EQ (Vthis_command, Qeval_defun)) Fset_default (sym, eval_sub (Fcar (tail))); else { /* Check if there is really a global binding rather than just a let and similarly for defface and defcustom.