GNU bug report logs - #19217
25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sat, 29 Nov 2014 18:15:02 UTC

Severity: wishlist

Tags: fixed

Found in version 25.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 19217 <at> debbugs.gnu.org
Subject: bug#19217: 25.0.50;	`C-M-x' (`eval-defun') on a `defface' that is not top-level
Date: Sun, 30 Nov 2014 19:58:11 +0000
Hello, Drew.

On Sat, Nov 29, 2014 at 12:08:14PM -0800, Drew Adams wrote:
> > You can also move point to just after the closing ) and do C-x C-e
> > (`eval-last-sexp').

> I too thought that was the case, but it does not seem to be.  I just
> tried it, starting with emacs -Q in several Emacs versions (22, 24.4,
> 25 dev build).

I've never had a problem with C-x C-e that I can remember, and that
includes several times with point after a random ) inside a defun.  What
happens when you do C-x C-e with point just after the `defface' form?

> > > How about letting users redefine a `defface' with `C-M-x' even in
> > > this case?

> > How is Emacs to determine which depth of parenthesis is to be
> > considered the opening one?  For example, if a defface is contained
> > within a defmacro, which one is to be executed on C-M-x?

> I really don't care about corner cases, if in fact there are any.

What exactly are you suggesting?  That `defface' be made a special case,
and that if any of the sequence of enclosing (s opens a `defface' form,
this should be the one chosen for execution?  Or should any defining
function count?  What is special about `defface'?

> You could even require that point be on the symbol `defface' in the
> sexp, for all I care.  Then it should be trivial to grab the `defface'
> sexp (e.g., use `(list-at-point)').

> The point is to have some way to reevaluate the defface sexp.  If
> `C-x C-e' worked, that would be enough, but AFAICT it does not work.

What happens when you try it?

> > > Is there a good reason for doing this only at top-level?

> > I think it is to make it unambiguous, which form is to be evaluated.

> Dunno how `C-x C-e' could be ambiguous wrt the sexp that precedes
> point.  If the sexp preceding point is ambiguous then I think we're
> probably in a world of trouble. ;-)

Neither C-M-x not C-x C-e are ambiguous.  The first evaluates the top
level form containing point, the second the sexp immediately preceding
point.

> Coming back to `C-M-x': Then don't seek perfection.  Require that
> point be closer to the list enclosing `defface' than to another
> list when you try `C-M-x', in order for it to unambiguously pick
> up the right sexp.

I'm not sure how you're going to construe "closer", given that a list
typically extends over many characters and when point is within it, that
must count as distance zero.  Or something.

> What am I missing?

A detailed clear specification of what you want.

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 4 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.