[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: |
Lars Ingebrigtsen |
Subject: |
bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level |
Date: |
Fri, 18 Sep 2020 15:36:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Alan Mackenzie <acm@muc.de> writes:
> 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.
The patch no longer applies to Emacs 28, so I've respun it:
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 72b94a57b4..7682e099f5 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1190,7 +1190,8 @@ elisp--eval-last-sexp
;; Setup the lexical environment if lexical-binding is enabled.
(elisp--eval-last-sexp-print-value
(eval (macroexpand-all
- (eval-sexp-add-defvars (elisp--preceding-sexp)))
+ (eval-sexp-add-defvars
+ (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
lexical-binding)
(if insert-value (current-buffer) t) no-truncate char-print-limit)))
To recap, this allows `C-x C-e' on defvar/defface to work the same as
`C-M-x' on those (when they are top-level).
That these two work differently is a source of frustration, so I think
it makes conceptual sense, but I'm not sure what the repercussions would
be otherwise...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level,
Lars Ingebrigtsen <=