changeset 705:c7d478752305

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Wed, 10 Jun 1992 01:34:51 +0000
parents 2aacd42951ef
children 86cb5db0b6c3
files lisp/comint.el lisp/files.el lisp/frame.el lisp/mail/sendmail.el lisp/mouse.el
diffstat 5 files changed, 73 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Tue Jun 09 23:02:56 1992 +0000
+++ b/lisp/comint.el	Wed Jun 10 01:34:51 1992 +0000
@@ -58,7 +58,7 @@
 ;;; background, dbx, gdb, kermit, prolog, telnet) to use comint-mode
 ;;; instead of shell-mode, see the notes at the end of this file.
 
-(defconst comint-version "2.02")
+(defconst comint-version "2.03")
 
 
 ;;; Brief Command Documentation:
@@ -69,7 +69,7 @@
 ;;; m-p	    comint-previous-input    	    Cycle backwards in input history
 ;;; m-n	    comint-next-input  	    	    Cycle forwards
 ;;; m-s     comint-previous-similar-input   Previous similar input
-;;; c-c c-r comint-previous-input-matching  Search backwards in input history
+;;; c-m-r   comint-previous-input-matching  Search backwards in input history
 ;;; return  comint-send-input
 ;;; c-a     comint-bol                      Beginning of line; skip prompt.
 ;;; c-d	    comint-delchar-or-maybe-eof     Delete char unless at end of buff.
@@ -107,6 +107,7 @@
 ;;;============================================================================
 ;;; Comint mode buffer local variables:
 ;;;     comint-prompt-regexp    - string       comint-bol uses to match prompt.
+;;;     comint-last-input-start - marker       Handy if inferior always echos
 ;;;     comint-last-input-end   - marker       For comint-kill-output command
 ;;;     input-ring-size         - integer      For the input history
 ;;;     input-ring              - ring             mechanism
@@ -213,6 +214,8 @@
     (setq mode-name "Comint")
     (setq mode-line-process '(": %s"))
     (use-local-map comint-mode-map)
+    (make-local-variable 'comint-last-input-start)
+    (setq comint-last-input-start (make-marker))
     (make-local-variable 'comint-last-input-end)
     (setq comint-last-input-end (make-marker))
     (make-local-variable 'comint-last-input-match)
@@ -229,6 +232,7 @@
     (make-local-variable 'comint-eol-on-send)
     (make-local-variable 'comint-ptyp)
     (setq comint-ptyp old-ptyp)
+    (make-local-variable 'comint-exec-hook)
     (run-hooks 'comint-mode-hook)
     ;Do this after the hook so the user can mung INPUT-RING-SIZE w/his hook.
     ;The test is so we don't lose history if we run comint-mode twice in
@@ -316,7 +320,7 @@
       (setq comint-ptyp process-connection-type) ; T if pty, NIL if pipe.
       ;; Jump to the end, and set the process mark.
       (goto-char (point-max))
-      (set-marker (process-mark proc) (point)))
+      (set-marker (process-mark proc) (point))
       ;; Feed it the startfile.
       (cond (startfile
 	     ;;This is guaranteed to wait long enough
@@ -331,7 +335,7 @@
 	     (delete-region (point) (point-max))
 	     (comint-send-string proc startfile)))
     (run-hooks 'comint-exec-hook)
-    buffer))
+    buffer)))
 
 ;;; This auxiliary function cranks up the process for comint-exec in
 ;;; the appropriate environment.
@@ -676,16 +680,17 @@
 	       (input (if (>= (point) pmark-val)
 			  (progn (if comint-eol-on-send (end-of-line))
 				 (buffer-substring pmark (point)))
-			  (let ((copy (funcall comint-get-old-input)))
-			    (goto-char pmark)
-			    (insert copy)
-			    copy))))
+			(let ((copy (funcall comint-get-old-input)))
+			  (goto-char pmark)
+			  (insert copy)
+			  copy))))
 	  (insert ?\n)
 	  (if (funcall comint-input-filter input) (ring-insert input-ring input))
 	  (funcall comint-input-sentinel input)
 	  (funcall comint-input-sender proc input)
-	  (set-marker (process-mark proc) (point))
-	  (set-marker comint-last-input-end (point))))))
+	  (set-marker comint-last-input-start pmark)
+	  (set-marker comint-last-input-end (point))
+	  (set-marker (process-mark proc) (point))))))
 
 (defun comint-get-old-input-default ()
   "Default for comint-get-old-input: take the current line, and discard
@@ -741,22 +746,27 @@
 ;;; saved -- typically passwords to ftp, telnet, or somesuch.
 ;;; Just enter m-x send-invisible and type in your line.
 
-(defun comint-read-noecho (prompt)
+(defun comint-read-noecho (prompt &optional stars)
   "Prompt the user with argument PROMPT. Read a single line of text
 without echoing, and return it. Note that the keystrokes comprising
 the text can still be recovered (temporarily) with \\[view-lossage]. This
-may be a security bug for some applications."
+may be a security bug for some applications. Optional argument STARS
+causes input to be echoed with '*' characters on the prompt line."
   (let ((echo-keystrokes 0)
+	(cursor-in-echo-area t)
 	(answ "")
 	tem)
-    (if (and (stringp prompt) (not (string= (message prompt) "")))
-	(message prompt))
+    (if (not (stringp prompt)) (setq prompt ""))
+    (message prompt)
     (while (not(or  (= (setq tem (read-char)) ?\^m)
 		    (= tem ?\n)))
-      (setq answ (concat answ (char-to-string tem))))
+      (setq answ (concat answ (char-to-string tem)))
+      (if stars (setq prompt (concat prompt "*")))
+      (message prompt))
     (message "")
     answ))
 
+
 (defun send-invisible (str)
   "Read a string without echoing, and send it to the process running
 in the current buffer. A new-line is additionally sent. String is not 
@@ -769,7 +779,7 @@
     (if (not proc) (error "Current buffer has no process")
 	(comint-send-string proc
 			    (if (stringp str) str
-				(comint-read-noecho "Enter non-echoed text")))
+				(comint-read-noecho "Non-echoed text: " t)))
 	(comint-send-string proc "\n"))))
 
 
@@ -1184,8 +1194,8 @@
 ;;; Most of the work is renaming variables and functions. These are the common
 ;;; ones:
 ;;; Local variables:
+;;;	last-input-start	comint-last-input-start
 ;;; 	last-input-end		comint-last-input-end
-;;;	last-input-start	<unnecessary>
 ;;;	shell-prompt-pattern	comint-prompt-regexp
 ;;;     shell-set-directory-error-hook <no equivalent>
 ;;; Miscellaneous:
@@ -1203,11 +1213,17 @@
 ;;;	show-output-from-shell	comint-show-output
 ;;;	copy-last-shell-input	Use comint-previous-input/comint-next-input
 ;;;
-;;; LAST-INPUT-START is no longer necessary because inputs are stored on the
-;;; input history ring. SHELL-SET-DIRECTORY is gone, its functionality taken
-;;; over by SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-sentinel.
-;;; Comint mode does not provide functionality equivalent to 
+;;; SHELL-SET-DIRECTORY is gone, its functionality taken over by
+;;; SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-sentinel.
+;;; Comint mode does not provide functionality equivalent to
 ;;; shell-set-directory-error-hook; it is gone.
+;;;
+;;; comint-last-input-start is provided for modes which want to munge
+;;; the buffer after input is sent, perhaps because the inferior
+;;; insists on echoing the input.  The LAST-INPUT-START variable in
+;;; the old shell package was used to implement a history mechanism,
+;;; but you should think twice before using comint-last-input-start
+;;; for this; the input history ring often does the job better.
 ;;; 
 ;;; If you are implementing some process-in-a-buffer mode, called foo-mode, do
 ;;; *not* create the comint-mode local variables in your foo-mode function.
@@ -1354,12 +1370,24 @@
 ;;; - Added a hook, comint-exec-hook that is run each time a process
 ;;;   is cranked up. Useful for things like process-kill-without-query.
 ;;;
+;;; These two were pointed out by tale:
 ;;; - Improved the doc string in comint-send-input a little bit.
 ;;; - Tweaked make-comint to check process status with comint-check-proc
 ;;;   instead of equivalent inline code. 
-;;; These two were pointed out by tale.
+;;;
 ;;; - Prompt-search history commands have been commented out. I never
 ;;;   liked them; I don't think anyone used them.
+;;; - Made comint-exec-hook a local var, as it should have been.
+;;;   (This way, for instance, you can have cmushell procs kill-w/o-query,
+;;;    but let Scheme procs be default.)
+;;;
+;;; 7/91 Shivers
+;;; - Souped up comint-read-noecho with an optional argument, STARS.
+;;;   Suggested by mjlx@EAGLE.CNSF.CORNELL.EDU.
+;;; - Moved comint-previous-input-matching from C-c r to C-M-r.
+;;;   C-c <letter> bindings are reserved for the user.
+;;;   These bindings were done by Jim Blandy.
+;;; These changes comprise version 2.03.
 
 (provide 'comint)
 
--- a/lisp/files.el	Tue Jun 09 23:02:56 1992 +0000
+++ b/lisp/files.el	Wed Jun 10 01:34:51 1992 +0000
@@ -1380,8 +1380,9 @@
 (define-key ctl-x-4-map "\C-f" 'find-file-other-window)
 (define-key ctl-x-4-map "b" 'switch-to-buffer-other-window)
 
-(define-key ctl-x-3-map "b" 'switch-to-buffer-other-screen)
-(define-key ctl-x-3-map "f" 'find-file-other-screen)
-(define-key ctl-x-3-map "r" 'find-file-read-only-other-screen)
+(define-key ctl-x-5-map "b" 'switch-to-buffer-other-screen)
+(define-key ctl-x-5-map "f" 'find-file-other-screen)
+(define-key ctl-x-5-map "\C-f" 'find-file-other-screen)
+(define-key ctl-x-5-map "r" 'find-file-read-only-other-screen)
 
 ;;; files.el ends here
--- a/lisp/frame.el	Tue Jun 09 23:02:56 1992 +0000
+++ b/lisp/frame.el	Wed Jun 10 01:34:51 1992 +0000
@@ -264,11 +264,11 @@
 			    (list (cons 'horizontal-scroll-bar toggle))))
 
 ;;;; Key bindings
-(define-prefix-command 'ctl-x-3-map)
-(define-key ctl-x-map "3" 'ctl-x-3-map)
+(define-prefix-command 'ctl-x-5-map)
+(define-key ctl-x-map "5" 'ctl-x-5-map)
 
-(define-key ctl-x-3-map "2" 'new-screen)
-(define-key ctl-x-3-map "0" 'delete-screen)
+(define-key ctl-x-5-map "2" 'new-screen)
+(define-key ctl-x-5-map "0" 'delete-screen)
 
 (provide 'screen)
 
--- a/lisp/mail/sendmail.el	Tue Jun 09 23:02:56 1992 +0000
+++ b/lisp/mail/sendmail.el	Wed Jun 10 01:34:51 1992 +0000
@@ -658,7 +658,7 @@
 (define-key ctl-x-4-map "m" 'mail-other-window)
 
 ;;;###autoload
-(define-key ctl-x-3-map "m" 'mail-other-screen)
+(define-key ctl-x-5-map "m" 'mail-other-screen)
 
 
 ;;; Do not add anything but external entries on this page.
--- a/lisp/mouse.el	Tue Jun 09 23:02:56 1992 +0000
+++ b/lisp/mouse.el	Wed Jun 10 01:34:51 1992 +0000
@@ -1,12 +1,11 @@
 ;;; mouse.el --- window system-independent mouse support.
-
-;;; Copyright (C) 1988 Free Software Foundation, Inc.
+;;; Copyright (C) 1988, 1992 Free Software Foundation, Inc.
 
 ;;; This file is part of GNU Emacs.
 
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 1, or (at your option)
+;;; the Free Software Foundation; either version 2, or (at your option)
 ;;; any later version.
 
 ;;; GNU Emacs is distributed in the hope that it will be useful,
@@ -81,12 +80,19 @@
   (mouse-set-mark click)
   (kill-region))
 
-(defun mouse-kill-ring-save
+(defun mouse-yank-at-click (click arg)
+  "Insert the last stretch of killed text at the position clicked on.
+Prefix arguments are interpreted as with \\[yank]."
+  (interactive "K\nP")
+  (mouse-set-point click)
+  (yank arg))
+
+(defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
 This does not delete the region; it acts like \\[kill-ring-save]."
   (interactive "K")
   (mouse-set-mark click)
-  (kill-ring-save))
+  (call-interactively 'kill-ring-save))
 
 
 
@@ -451,8 +457,10 @@
 ;;; Bindings for mouse commands.
 
 (global-set-key   [mouse-1]	'mouse-set-point)
+(global-set-key   [mouse-2]	'mouse-yank-at-click)
+(global-set-key   [mouse-3]	'mouse-kill-ring-save)
+
 (global-set-key [S-mouse-1]	'mouse-set-mark)
-(global-set-key   [mouse-3]	'mouse-delete-other-windows)
 
 (provide 'mouse)