emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Usability suggestion : completion for M-:


From: Drew Adams
Subject: RE: Usability suggestion : completion for M-:
Date: Wed, 9 Apr 2008 14:20:39 -0700

>  * Drew believe that the whole M-: should evolve to something more
>    like a interactive scratch in the context of current buffer, and
>    that if TAB does not complete in scratch, it should not complete in
>    M-:

To be specific, I said this:

> I would prefer to see M-: take on more of the
> character of a pop-up emacs-lisp-mode buffer:
> TAB, C-M-q, C-j,..., but with RET still causing
> eval...  And I'd like to see M-: pretty-print the
> result (as in pp-eval-expression)

No need to "evolve to something more like" - it's easy enough to do. This is the
behavior in Icicles, for instance.

(defvar icicle-read-expression-map nil
  "Icicle mode version of `read-expression-map'.
Several Emacs-Lisp mode key bindings are used.")
(unless icicle-read-expression-map
  (let ((map (make-sparse-keymap)))
    (define-key map "\M-\t" 'lisp-complete-symbol)
    (define-key map "\t" 'lisp-indent-line)
    (define-key map "\e\C-q" 'indent-sexp)
    (define-key map "\e\t" 'lisp-complete-symbol)
    (define-key map "\e\C-x" 'eval-defun)
    (define-key map "\e\C-q" 'indent-pp-sexp)
    ;;(define-key map "\177" 'backward-delete-char-untabify)
    (set-keymap-parent map minibuffer-local-map)
    (setq icicle-read-expression-map map)))

(defun icicle-pp-eval-expression (expression) ; `M-:' in Icicle mode.
  "Evaluate an Emacs-Lisp expression and pretty-print its value."
  (interactive
   (list (read-from-minibuffer "Eval: " nil
           icicle-read-expression-map t 'read-expression-history)))
  (pp-eval-expression expression))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]