all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pp-eval-expression enhancements
@ 2007-07-10 22:54 Drew Adams
  2007-07-22 23:42 ` Drew Adams
  0 siblings, 1 reply; 20+ messages in thread
From: Drew Adams @ 2007-07-10 22:54 UTC (permalink / raw)
  To: Emacs-Devel

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)

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-08-04 23:42 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 22:54 pp-eval-expression enhancements Drew Adams
2007-07-22 23:42 ` Drew Adams
2007-07-23 18:06   ` Richard Stallman
2007-07-23 20:54     ` Drew Adams
2007-07-24 16:45       ` Richard Stallman
2007-07-24 17:18         ` Drew Adams
2007-07-24 18:17           ` Stefan Monnier
2007-07-24 18:50             ` Drew Adams
2007-07-24 19:24               ` Stefan Monnier
2007-07-24 20:23                 ` Drew Adams
2007-07-24 22:02                   ` Stefan Monnier
2007-07-25 21:40                   ` Juri Linkov
2007-07-26  0:49                     ` Stefan Monnier
2007-07-26  8:48                       ` Juri Linkov
2007-07-26 19:12                         ` Stefan Monnier
2007-08-04 23:42                     ` T. V. Raman
2007-07-25 15:02           ` Richard Stallman
2007-07-25 15:02           ` Richard Stallman
2007-08-02 15:45           ` Richard Stallman
2007-08-03  3:26             ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.