emacs-devel
[Top][All Lists]
Advanced

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

pp-eval-expression enhancements


From: Drew Adams
Subject: pp-eval-expression enhancements
Date: Tue, 10 Jul 2007 15:54:42 -0700

This patch improves `pp-eval-expression' in these ways:

* Provides a progress message.
* Does not make buffer *Pp Eval Output* read-only.
* Inhibits emacs-lisp-mode-hook and change-major-mode-hook
  when entering emacs-lisp-mode.
* Fontifies buffer *Pp Eval Output*.

I often want to use *Pp Eval Output* as more or less a normal Emacs-Lisp
buffer: killing, yanking, evaluating. I see no reason to make it read-only.
It should probably also have undo, but I'll leave that to someone else's
patch.

I also propose that we use `M-:', the binding of `eval-expression', for
`pp-eval-expression' instead. Why would we not want to do that? To try that
out, do this:

(substitute-key-definition 'eval-expression 'pp-eval-expression global-map)

--------------8<---------------------

*** pp-CVS-2007-07-10.el        Tue Jul 10 15:37:26 2007
--- pp-CVS-patched-2007-07-10.el        Tue Jul 10 15:40:38 2007
***************
*** 103,108 ****
--- 103,109 ----
    (interactive
     (list (read-from-minibuffer "Eval: " nil read-expression-map t
                                 'read-expression-history)))
+   (message "Evaluating...")
    (setq values (cons (eval expression) values))
    (let* ((old-show-function temp-buffer-show-function)
         ;; Use this function to display the buffer.
***************
*** 126,139 ****
                         (progn
                           (select-window window)
                           (run-hooks 'temp-buffer-show-hook))
!                      (select-window old-selected)))
!                (message "%s" (buffer-substring (point-min) (point)))
!                ))))))
!     (with-output-to-temp-buffer "*Pp Eval Output*"
!       (pp (car values))
!       (with-current-buffer standard-output
!       (emacs-lisp-mode)
!       (set (make-local-variable 'font-lock-verbose) nil)))))

  ;;;###autoload
  (defun pp-eval-last-sexp (arg)
--- 127,144 ----
                         (progn
                           (select-window window)
                           (run-hooks 'temp-buffer-show-hook))
!                       (select-window old-selected)
!                       (message "Evaluating...done.  See buffer *Pp Eval
Output*.")))
!                 (message "%s" (buffer-substring (point-min)
(point)))))))))
!     (with-output-to-temp-buffer "*Pp Eval Output*" (pp (car values)))
!     (save-excursion
!       (set-buffer "*Pp Eval Output*")
!       (setq buffer-read-only nil)
!       (let ((emacs-lisp-mode-hook nil)
!             (change-major-mode-hook nil))
!         (emacs-lisp-mode))
!       (set (make-local-variable 'font-lock-verbose) nil)
!       (font-lock-fontify-buffer))))

  ;;;###autoload
  (defun pp-eval-last-sexp (arg)





reply via email to

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