GNU bug report logs -
#53507
27.1; syntax highlight in the eval-expression prompt
Previous Next
Full log
Message #45 received at 53507 <at> debbugs.gnu.org (full text, mbox):
> So then I guess it's only a matter of merging the minibuffer
> keymap with emacs lisp mode map in the eval-expression prompt.
FWIW -
I know that this enhancement request is about having
Lisp font-locking while typing a sexp to evaluate.
My remarks are only partly related, I guess, and are
offered as food for thought.
1. Font-locking a sexp you're typing isn't very
important.
Not saying it can't or shouldn't happen. But
compared to font-locking the _resulting value_,
it's really not so important, IMHO.
2. Turning on `emacs-lisp-mode' for reading the sexp
is overkill. Unless you prevent it, it entails
running the mode hook, which can do all kinds of
things and might take a while. It's likely to be
problematic.
3. Although in principle it's only orthogonal, what
I'd propose is to concentrate on the _result_
sexp, instead of the input sexp to evaluate.
___
This is what I do, for #3. I think it, or similar,
makes sense also for vanilla Emacs:
1. Bind `M-:' to `pp-eval-expression', not to
`eval-expression'. This means you can get the
output in the echo area or a separate buffer,
and that buffer can be better Lisp-enabled:
font-lock, undo, `emacs-lisp-mode'.
2. Optionally show the result in a tooltip.
Provide a user option, but commands can flip
the behavior on the fly (with a prefix arg).
3. `pp-display-expression':
* When result is shown in a buffer: Put
buffer in `emacs-lisp-mode', with undo
and font-locked.
* But use NO `emacs-lisp-mode-hook' or
`change-major-mode-hook'.
`pp-eval-expression':
* Read the input sexp with completion.
Completion uses a PP+ keymap, which is like
`read-expression-map' but with some Elisp
key bindings.
* By default, use `pp-display-expression'.
But with non-zero prefix arg insert result
into current buffer, with or without
double-quotes if result is a string (prefix
arg < 0 means without).
* Respect pp versions of print options:
`pp-eval-expression-print-length',
`pp-eval-expression-print-level', and
`pp-max-tooltip-size'. (No reason to
force the same behavior for pretty-printing
as for nonpretty-printing.)
* Respect `eval-expression-debug-on-error'.
* Return result of evaluation (as well as
having it as car variable `values').
The code for pp+.el is here:
https://www.emacswiki.org/emacs/download/pp%2b.el
This bug report was last modified 3 years and 111 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.