From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: IELM prompt Date: Thu, 22 Apr 2004 21:09:28 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200404230209.i3N29SF08935@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1082686792 29581 80.91.224.253 (23 Apr 2004 02:19:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Apr 2004 02:19:52 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 23 04:19:41 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BGqI1-0005Ix-00 for ; Fri, 23 Apr 2004 04:19:41 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BGqHz-0003dz-00 for ; Fri, 23 Apr 2004 04:19:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGqBr-0007w9-V7 for emacs-devel@quimby.gnus.org; Thu, 22 Apr 2004 22:13:19 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BGqBj-0007v8-EV for emacs-devel@gnu.org; Thu, 22 Apr 2004 22:13:11 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BGqBD-0007kb-5f for emacs-devel@gnu.org; Thu, 22 Apr 2004 22:13:10 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGqBC-0007ix-OS for emacs-devel@gnu.org; Thu, 22 Apr 2004 22:12:38 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i3N2CWTS018781 for ; Thu, 22 Apr 2004 21:12:32 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i3N29SF08935; Thu, 22 Apr 2004 21:09:28 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22056 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22056 There are (at least) three problems with the ielm prompt: 1. It is non-customizable. _Even_ if one sets ielm-prompt outside of Custom, the :set-function gets called anyway when ielm.el is loaded and the prompt becomes read-only, overriding the user's attempt at customizing the read-only-ness away. (This is because of custom-initialize-reset.) 2. It is not _really_ read-only. One can paste stuff inside the prompt. The default prompt is "ELISP> ". The last space is invisibly part of the read-only prompt. I just keep pasting stuff accidentally into that last space. The pasted forms to be executed are then invisibly part of the read-only prompt with extremely confusing results. This is very annoying. 3. Flushing the output with C-c C-o produces an error instead of the intended "*** output flushed ***" message. This is bad, because one likes to have a record of the fact that (probably extensive) output was flushed. Below are a patch to ielm.el, eliminating problems (1) and (2) and a (trivial) patch to comint.el eliminating (3). The patch to comint.el binds inhibit-read-only to t in comint-delete-output. To me, that makes sense regardless of the problems with the ielm prompt. If one wants the previous output gone, one wants it gone regardless of whether part of that output has the read-only property. The patch to ielm.el, apart from solving (1) and (2), also gets rid of the unnecessary :get and :set keywords in the ielm-prompt defcustom, letting inferior-emacs-lisp-mode do the work instead. Customizing the prompt would, by default, no longer affect existing *ielm* buffers. I believe that is an improvement, because two distinct prompts in the same ielm run looks messy. (I often save *ielm* buffers.) If there are no objections, I could install these patches: ===File ~/comint-diff======================================= *** comint.el 14 Apr 2004 14:14:13 -0500 1.294 --- comint.el 22 Apr 2004 18:50:10 -0500 *************** *** 2006,2012 **** Does not delete the prompt." (interactive) (let ((proc (get-buffer-process (current-buffer))) ! (replacement nil)) (save-excursion (let ((pmark (progn (goto-char (process-mark proc)) (forward-line 0) --- 2006,2013 ---- Does not delete the prompt." (interactive) (let ((proc (get-buffer-process (current-buffer))) ! (replacement nil) ! (inhibit-read-only t)) (save-excursion (let ((pmark (progn (goto-char (process-mark proc)) (forward-line 0) ============================================================ ===File ~/ielm-diff========================================= *** ielm.el 22 Apr 2004 08:56:46 -0500 1.36 --- ielm.el 22 Apr 2004 20:47:27 -0500 *************** *** 49,60 **** :type 'boolean :group 'ielm) (defcustom ielm-prompt "ELISP> " ! "Prompt used in IELM." :type 'string ! :group 'ielm ! :get #'(lambda (symbol) (substring-no-properties (symbol-value symbol))) ! :set #'(lambda (symbol value) (set symbol (propertize value 'read-only t 'rear-nonsticky t)))) (defcustom ielm-dynamic-return t "*Controls whether \\\\[ielm-return] has intelligent behaviour in IELM. --- 49,80 ---- :type 'boolean :group 'ielm) + (defcustom ielm-prompt-read-only t + "If non-nil, the IELM prompt is read only. + \\\ + Setting this variable does not affect existing IELM runs, unless + you execute the command \\[inferior-emacs-lisp-mode] \(_not_ just + \\[ielm]) in that IELM buffer. Even then, it does not affect + existing prompts. + + You can give the IELM prompt more highly customized read-only + type properties \(for instance make only part of the prompt + read-only), by setting this option to nil, and then setting + `ielm-prompt', outside of Custom, to a string with the desired + text properties." + :type 'boolean + :group 'ielm + :version "21.4") + (defcustom ielm-prompt "ELISP> " ! "Prompt used in IELM. ! \\\ ! Setting this variable does not affect existing IELM runs, unless ! you execute the command \\[inferior-emacs-lisp-mode] \(_not_ just ! \\[ielm]) in that IELM buffer. Even then, it does not affect ! existing prompts." :type 'string ! :group 'ielm) (defcustom ielm-dynamic-return t "*Controls whether \\\\[ielm-return] has intelligent behaviour in IELM. *************** *** 429,434 **** --- 449,456 ---- The behaviour of IELM may be customised with the following variables: * To stop beeping on error, set `ielm-noisy' to nil * If you don't like the prompt, you can change it by setting `ielm-prompt'. + * If you do not like that the prompt is (by default) read-only, set + `ielm-prompt-read-only' to nil. * Set `ielm-dynamic-return' to nil for bindings like `lisp-interaction-mode' * Entry to this mode runs `comint-mode-hook' and `ielm-mode-hook' (in that order). *************** *** 443,448 **** --- 465,477 ---- (setq comint-input-sender 'ielm-input-sender) (setq comint-process-echoes nil) (make-local-variable 'comint-dynamic-complete-functions) + (set (make-local-variable 'ielm-prompt) + (if ielm-prompt-read-only + (propertize ielm-prompt + 'read-only t + 'rear-nonsticky t + 'front-sticky '(read-only)) + ielm-prompt)) (setq comint-dynamic-complete-functions '(ielm-tab comint-replace-by-expanded-history ielm-complete-filename ielm-complete-symbol)) (setq comint-get-old-input 'ielm-get-old-input) ============================================================