[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: |
Drew Adams |
Subject: |
bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level |
Date: |
Fri, 12 Dec 2014 19:07:08 -0800 (PST) |
Hi Alan,
> Starting from emacs -Q, it works, for both face & var. With my
> setup, however, it does not work (no change from before). Dunno
> why. Tried it with `lexical-binding' t and nil - neither worked.
>
> I'll bisect my setup when I get a moment, to try to find out why it
> doesn't work for me.
>
> Thanks for working on this.
I found the explanation. I bind `C-x C-e' to `pp-eval-last-sexp',
not to `eval-last-sexp'. Apparently the latter got considerably
redefined after Emacs 24.4, so that `pp-eval-last-sexp' is no
longer parallel with `eval-last-sexp' - the code is very different.
Your fix seems good for `eval-last-sexp'. But I would like to
also see a similar fix for `pp-eval-last-sexp'. Could you
perhaps take a look at fixing that as well?
I filed a separate bug (#19362) for bringing `pp.el' into line
with the changes that were made in moving from `lisp-mode.el'
to `elisp-mode.el'. I'm not sure about all that might be
involved for such a fix, as I don't know just what has changed.
So that bug report is worded vaguely.
But I would at least like to see `pp-eval-last-sexp' updated
similarly to how `eval-last-sexp' was (for Emacs-Lisp buffers).
A quick glance suggests that the change involves respecting
`lexical-binding', but it might be more or other than that.
Could you perhaps take a look? I would like to be able to
get both (a) any advantages brought to `eval-last-sexp' by
the Emacs 25 changes to it and (b) the advantage of your
fix to it (this bug). But I also want to be able to continue
using `pp-eval-last-sexp' instead of `eval-last-sexp'.
I just want the former to enjoy the same advantages as latter.
I have my own enhancement to `pp-eval-expression' (which is
used by `pp-eval-last-sexp'), but the changes I make to that
are probably orthogonal and I will be able to make them to
whatever updated definition of `pp-eval-last-sexp' there is.
---
FYI, the changes I make to `pp-eval-expression' are these:
1. Read with completion using `pp-read-expression-map'.
2. Progress message added.
3. Added optional arg and insertion behavior.
4. Respect `pp-eval-expression-print-length',
`pp-eval-expression-print-level', and
`eval-expression-debug-on-error'.
#1 means bindings for `lisp-indent-line', `lisp-complete-symbol',
`indent-sexp', `eval-defun', and `indent-pp-sexp'.
#3 means this:
With a prefix arg, insert the value into the current buffer at point.
With a negative prefix arg, if the value is a string then insert it
into the buffer without double-quotes (`"').
#4 means you can use different values from the same
options without the prefix `pp-'.
---
FYI, I do this, wrt keys:
(substitute-key-definition 'eval-last-sexp
'pp-eval-last-sexp global-map)
(substitute-key-definition 'eval-expression
'pp-eval-expression global-map))