[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change the default binding of C-x C-e ?

From: Alan Mackenzie
Subject: Re: Change the default binding of C-x C-e ?
Date: Sun, 6 Jan 2008 15:17:05 +0000
User-agent: Mutt/1.5.9i

Hi, Mike!

On Sun, Jan 06, 2008 at 03:41:04AM -0800, Mike Mattie wrote:
> Hello,

> I think it is a good idea to change the default key-binding of C-x C-e
> to eval-defun. From a reading of the Elisp Intro I became used to using
> the usual binding which is eval-last-sexp. Things worked fine until I
> progressed in elisp to where I wanted to use defvar. As the informed
> have probably surmised I was baffled by the results because repeated
> evaluation did not affect the default value.

> While reading through the manuals I stumbled across eval-defun and
> realized what was going on. AFAICT they are effectively the same in
> use, however eval-defun does not have suprising corner cases like
> defvar default values.

eval-last-sexp and eval-defun do different things - e-d determines the
top level construct surrounding point, e-l-s finds the previous
expression.  I think you've just found that out.

It is sometimes useful whilst hacking lisp to evaluate an expression in
the middle of a defun.  You'd be surprised how often that happens.
That's what C-x C-e is for, and I'd bet my entire life savings on the
rest of the Emacs team agreeing here.

> FWIW it may help others to change this binding.

Maybe, maybe not.  I would suggest a compromise binding: C-u C-x C-e for
eval-defun.  You could implement that for yourself using "advice".

Alan Mackenzie (Nuremberg).

reply via email to

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