From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: pp-eval-expression enhancements
Date: Tue, 10 Jul 2007 15:54:42 -0700 [thread overview]
Message-ID: <BDEIJAFNGDOAGCJIPKPBCEKKCFAA.drew.adams@oracle.com> (raw)
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)
next reply other threads:[~2007-07-10 22:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-10 22:54 Drew Adams [this message]
2007-07-22 23:42 ` pp-eval-expression enhancements 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BDEIJAFNGDOAGCJIPKPBCEKKCFAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.