unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Alan Mackenzie <acm@muc.de>
Cc: 19217@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 12:51:59 -0800 (PST)	[thread overview]
Message-ID: <6718ace6-b672-40fc-a5bc-ea29eb155239@default> (raw)
In-Reply-To: <20141130195811.GB12974@acm.acm>

> > > 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?

As I said, nothing happens.

emacs -Q
Put this in *scratch*, and evaluate it:
(when t
  (defface foo '((((background dark)) (:foreground "#58DFFA4FFFFF"))
                 (t (:foreground "Firebrick")))
    "A face." :group 'help)
  )

`M-x customize-face' shows that it is defined as it should be.

Edit the definition, replacing "Firebrick" with "Blue".  Put point
just after the defface sexp and hit `C-x C-e'.  `M-x customize-face'
shows that no change was made.  Feel free to blow away the Customize
buffer completely, so you are sure that you're not just seeing what
was there before. ;-)

Edit the color to "Green".  Put point on the symbol `defface' and
hit `C-M-x' - likewise, still no change to the face.

> > > > 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?

See above.  (1) `C-x C-e' should work as you say it works.
(2) `C-M-x' with point inside a defface sexp should also work.
If the latter cannot easily be made to work with point anywhere
inside the sexp, then at least make it work with point on `defface'
or near it (e.g. at the same list level).

> That `defface' be made a special case,

If that's necessary, yes.  It should be made to work, whether that
means special-casing it or not.

Currently, `C-M-x' inside a defun that is not at top level does not
have the problem that defface has.  Repeat the above recipe, but
with (defun toto () "Toto." (forward-char)) in place of the defface
sexp.  Edit it after evalling, to use `backward-char', and use
`C-M-x' again.  Check the definition before and after editing, using
(symbol-function 'toto).  No problem.  Not so, for defface.

> 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'?

No idea what you are going on about; sorry.

> > 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?

See above.  100% reproducible from emacs -Q.  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.

They should.  But they do not, in the case of defface.  See above.
Try it.

> > 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.

It's trivial to determine whether point is at the same list level
as the `defface' symbol.

> > What am I missing?
> 
> A detailed clear specification of what you want.

I don't think I'm (or you are) missing that.  Have you tried it?





  reply	other threads:[~2014-11-30 20:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<mailman.14952.1417284925.1147.bug-gnu-emacs@gnu.org>
     [not found] ` <<20141129191023.34112.qmail@mail.muc.de>
2014-11-29 20:08   ` bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level Drew Adams
2014-11-30 19:58     ` Alan Mackenzie
2014-11-30 20:51       ` Drew Adams [this message]
2014-11-30 23:20         ` Alan Mackenzie
2014-12-01  0:00           ` Drew Adams
2014-12-06 19:10         ` Alan Mackenzie
2014-12-10 22:20           ` Drew Adams
2014-12-13  3:07             ` Drew Adams
2020-09-18 13:36           ` Lars Ingebrigtsen
2020-09-18 15:53             ` Drew Adams
2020-09-19 14:10               ` Lars Ingebrigtsen
2020-10-15 14:28             ` Lars Ingebrigtsen
2020-10-15 15:29               ` Drew Adams
2020-10-15 15:35                 ` Lars Ingebrigtsen
2020-10-15 16:15                   ` Drew Adams
2014-11-29 18:13 Drew Adams
     [not found] ` <mailman.14952.1417284925.1147.bug-gnu-emacs@gnu.org>
2014-11-29 19:10   ` Alan Mackenzie
2014-12-01  3:51 ` Stefan Monnier
2014-12-01  4:29   ` Drew Adams
2014-12-01 13:49     ` Stefan Monnier
     [not found] ` <mailman.15037.1417408221.1147.bug-gnu-emacs@gnu.org>
2014-12-01 17:02   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6718ace6-b672-40fc-a5bc-ea29eb155239@default \
    --to=drew.adams@oracle.com \
    --cc=19217@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).