From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: pp-eval-expression enhancements Date: Tue, 10 Jul 2007 15:54:42 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1184109182 32331 80.91.229.12 (10 Jul 2007 23:13:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Jul 2007 23:13:02 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 11 01:13:01 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I8OtB-0005w6-7e for ged-emacs-devel@m.gmane.org; Wed, 11 Jul 2007 01:13:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8OtA-0001bS-Ns for ged-emacs-devel@m.gmane.org; Tue, 10 Jul 2007 19:13:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I8Ot7-0001ar-1A for emacs-devel@gnu.org; Tue, 10 Jul 2007 19:12:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I8Ot6-0001aZ-L2 for emacs-devel@gnu.org; Tue, 10 Jul 2007 19:12:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8Ot6-0001aW-Ek for emacs-devel@gnu.org; Tue, 10 Jul 2007 19:12:56 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I8Ot6-0006Q2-2T for emacs-devel@gnu.org; Tue, 10 Jul 2007 19:12:56 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l6ANCp4W026976 for ; Tue, 10 Jul 2007 17:12:51 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l6AIeR6A012320 for ; Tue, 10 Jul 2007 17:12:51 -0600 Original-Received: from dhcp-amer-csvpn-gw2-141-144-73-85.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 3026414771184108087; Tue, 10 Jul 2007 15:54:47 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74607 Archived-At: 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)