[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not to
From: |
Alan Mackenzie |
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 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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).