[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: Daniel Colascione
Subject: Re: Why is `C-M-x' only for top-level defuns?
Date: Wed, 11 Jan 2012 20:15:11 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

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)));
        { /* Check if there is really a global binding rather than just a let

and similarly for defface and defcustom.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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