all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Drew Adams <drew.adams@oracle.com>
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: Sat, 6 Dec 2014 19:10:57 +0000	[thread overview]
Message-ID: <20141206191057.GB3233@acm.acm> (raw)
In-Reply-To: <6718ace6-b672-40fc-a5bc-ea29eb155239@default>

Hi, Drew.

On Sun, Nov 30, 2014 at 12:51:59PM -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?

> As I said, nothing happens.

OK.  I've hacked the following patch together, which wasn't actually all
that difficult.  I've tested it out on a defvar, and it works there.  It
gives C-x C-e the same special handling that C-M-x has for defvar's,
defcustom's, defface's, etc.  It's incomplete (no documentation has been
changed), but it might do what you need.  Please try it out.



diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 2be81a5..830ae2b 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -811,10 +811,11 @@ and level of lists, and include additional formats for integers
   (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
     ;; Setup the lexical environment if lexical-binding is enabled.
     (elisp--eval-last-sexp-print-value
-     (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
+     (eval (eval-sexp-add-defvars
+	    (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp))))
+	   lexical-binding)
      eval-last-sexp-arg-internal)))
 
-
 (defun elisp--eval-last-sexp-print-value (value &optional eval-last-sexp-arg-internal)
   (let ((unabbreviated (let ((print-length nil) (print-level nil))
 			 (prin1-to-string value)))



-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2014-12-06 19:10 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
2014-11-30 23:20         ` Alan Mackenzie
2014-12-01  0:00           ` Drew Adams
2014-12-06 19:10         ` Alan Mackenzie [this message]
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

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

  git send-email \
    --in-reply-to=20141206191057.GB3233@acm.acm \
    --to=acm@muc.de \
    --cc=19217@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.