From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Rogers Newsgroups: gmane.emacs.devel Subject: comint-insert-input on non-command lines: A trivial fix, a quibble, and a bug Date: Sat, 6 May 2006 16:05:09 -0400 Message-ID: <17501.373.791079.156322@rgrjr.dyndns.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1146945928 30488 80.91.229.2 (6 May 2006 20:05:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 May 2006 20:05:28 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 06 22:05:26 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FcT1n-0000bl-Ls for ged-emacs-devel@m.gmane.org; Sat, 06 May 2006 22:05:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcT1n-0000VJ-8H for ged-emacs-devel@m.gmane.org; Sat, 06 May 2006 16:05:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FcT1c-0000V5-2l for emacs-devel@gnu.org; Sat, 06 May 2006 16:05:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FcT1b-0000Ur-4S for emacs-devel@gnu.org; Sat, 06 May 2006 16:05:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcT1a-0000Ul-W9 for emacs-devel@gnu.org; Sat, 06 May 2006 16:05:11 -0400 Original-Received: from [24.128.218.106] (helo=rgrjr.dyndns.org) by monty-python.gnu.org with smtp (Exim 4.52) id 1FcT23-00070m-0d for emacs-devel@gnu.org; Sat, 06 May 2006 16:05:39 -0400 Original-Received: (qmail 19685 invoked by uid 500); 6 May 2006 20:05:09 -0000 Original-To: emacs-devel@gnu.org X-Mailer: VM 7.19 under Emacs 22.0.50.1 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:54014 Archived-At: First the fix (see the diff below): When you type "C-c RET" (comint-insert-input) in shell mode (e.g.) with point on a line of output, nothing happens, not even a ding. This seems to be because comint-insert-input is trying to invoke the "RET" binding, but doesn't allow for the fact that this-command-keys returns a string. The patch makes it work for me, though only if you define "working" as "insert a newline at point". Hence the quibble: I would argue that these bindings are backwards. There have been many times that I've typed "RET" (comint-send-input) in a shell buffer and mistakenly expected newline insertion, instead of the defined "reinvoke this command" behavior. In contrast, I never expect insertion when I type "C-c RET"; besides which, the side-effects of an accidental "C-c RET" are easier to undo. So if "safety" were the reason for changing comint-insert-input to work only on actual command input, then it seems inconsistent not to do the same for comint-send-input as well. Moreover, I would argue that comint-send-input should be the picky one, and comint-insert-input should be more forgiving, so that you could then get the current effect of "RET" on an arbitrary line by typing "C-c RET RET", i.e. insert at the process mark and then submit it. As it is, I see no way to get the former comint-copy-old-input behavior, save by cut-and-paste. Or have I missed something? If not, that's the bug: I find it extremely useful to be able to reinvoke lines of transcript output (e.g. commands echoed by "make") after editing them, so it is frustrating that "C-c RET" no longer works for that. Even if the new behavior is deemed a feature (or gets grandfathered due to release pressure), it amounts to an incompatible change, but I can't find any mention of this in NEWS. (Except for the command name, the description in misc.texi hasn't changed, though the new behavior does match it better than the old behavior did.) So the question is: Misfeature, or documentation oversight? TIA, -- Bob Rogers http://rgrjr.dyndns.org/ ------------------------------------------------------------------------ Index: lisp/comint.el =================================================================== RCS file: /sources/emacs/emacs/lisp/comint.el,v retrieving revision 1.340 diff -c -r1.340 comint.el *** lisp/comint.el 22 Apr 2006 23:30:13 -0000 1.340 --- lisp/comint.el 6 May 2006 16:07:16 -0000 *************** *** 807,813 **** (if (not (eq (get-char-property (point) 'field) 'input)) ;; No input at POS, fall back to the global definition. (let* ((keys (this-command-keys)) ! (last-key (and (vectorp keys) (aref keys (1- (length keys))))) (fun (and last-key (lookup-key global-map (vector last-key))))) (goto-char pos) (and fun (call-interactively fun))) --- 807,814 ---- (if (not (eq (get-char-property (point) 'field) 'input)) ;; No input at POS, fall back to the global definition. (let* ((keys (this-command-keys)) ! (last-key (and (or (vectorp keys) (stringp keys)) ! (aref keys (1- (length keys))))) (fun (and last-key (lookup-key global-map (vector last-key))))) (goto-char pos) (and fun (call-interactively fun)))