From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Wed, 18 Jul 2018 14:23:20 +0000 (-0400)
Subject: * lisp/comint.el: Clean up namespace
X-Git-Tag: emacs-27.0.90~4664^2~62
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=04a32fa60bead4359bc9353af67f26958c795593;p=emacs.git

* lisp/comint.el: Clean up namespace

(shell-strip-ctrl-m): Mark as obsolete.
(comint-send-invisible): Rename from `send-invisible`.
(send-invisible): Make it an obsolete alias.
* lisp/net/rlogin.el: Adjust accordingly; Use lexical-binding.
* lisp/shell.el: Adjust accordingly.
---

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 3d3441401dd..236cb07785c 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1026,8 +1026,8 @@ Move backward across one shell command, but not beyond the current line
 Ask the shell for its working directory, and update the Shell buffer's
 default directory.  @xref{Directory Tracking}.
 
-@item M-x send-invisible @key{RET} @var{text} @key{RET}
-@findex send-invisible
+@item M-x comint-send-invisible @key{RET} @var{text} @key{RET}
+@findex comint-send-invisible
 Send @var{text} as input to the shell, after reading it without
 echoing.  This is useful when a shell command runs a program that asks
 for a password.
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 903c56cef90..5b432d5b2fb 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -2988,7 +2988,7 @@ Emacs compiled on a 64-bit machine can handle much larger buffers.
 @cindex Shell buffer, echoed commands and @samp{^M} in
 @cindex Echoed commands in @code{shell-mode}
 
-Try typing @kbd{M-x shell-strip-ctrl-m @key{RET}} while in @code{shell-mode} to
+Try typing @kbd{M-x comint-strip-ctrl-m @key{RET}} while in @code{shell-mode} to
 make them go away.  If that doesn't work, you have several options:
 
 For @code{tcsh}, put this in your @file{.cshrc} (or @file{.tcshrc})
@@ -3041,7 +3041,7 @@ characters from the buffer by adding this to your @file{.emacs} init
 file:
 
 @smalllisp
-(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m)
+(add-hook 'comint-output-filter-functions #'comint-strip-ctrl-m)
 @end smalllisp
 
 On a related note: if your shell is echoing your input line in the shell
diff --git a/etc/NEWS b/etc/NEWS
index 5648dd0a63a..861520bd14b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -232,6 +232,10 @@ shown in the currently selected window.
 
 ** Comint
 
++++
+*** 'send-invisible' is now an obsolete alias for `comint-send-invisible'
+Also, 'shell-strip-ctrl-m' is declared obsolete.
+
 +++
 *** 'C-c .' (comint-insert-previous-argument) no longer interprets '&'.
 This feature caused problems when '&&' was present in the previous
diff --git a/lisp/comint.el b/lisp/comint.el
index 71a2b5eca55..a9c3e47f88e 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -78,7 +78,7 @@
 ;;
 ;; Not bound by default in comint-mode (some are in shell mode)
 ;; comint-run				Run a program under comint-mode
-;; send-invisible			Read a line w/o echo, and send to proc
+;; comint-send-invisible		Read a line w/o echo, and send to proc
 ;; comint-dynamic-complete-filename	Complete filename at point.
 ;; comint-dynamic-list-filename-completions List completions in help buffer.
 ;; comint-replace-by-expanded-filename	Expand and complete filename at point;
@@ -632,7 +632,7 @@ Input ring history expansion can be achieved with the commands
 Input ring expansion is controlled by the variable `comint-input-autoexpand',
 and addition is controlled by the variable `comint-input-ignoredups'.
 
-Commands with no default key bindings include `send-invisible',
+Commands with no default key bindings include `comint-send-invisible',
 `completion-at-point', `comint-dynamic-list-filename-completions', and
 `comint-magic-space'.
 
@@ -2247,7 +2247,7 @@ This function could be on `comint-output-filter-functions' or bound to a key."
 	(error nil))
       (while (re-search-forward "\r+$" pmark t)
 	(replace-match "" t t)))))
-(defalias 'shell-strip-ctrl-m 'comint-strip-ctrl-m)
+(define-obsolete-function-alias 'shell-strip-ctrl-m #'comint-strip-ctrl-m "27.1")
 
 (defun comint-show-maximum-output ()
   "Put the end of the buffer at the bottom of the window."
@@ -2357,9 +2357,9 @@ a buffer local variable."
 
 ;; These three functions are for entering text you don't want echoed or
 ;; saved -- typically passwords to ftp, telnet, or somesuch.
-;; Just enter m-x send-invisible and type in your line.
+;; Just enter m-x comint-send-invisible and type in your line.
 
-(defun send-invisible (&optional prompt)
+(defun comint-send-invisible (&optional prompt)
   "Read a string without echoing.
 Then send it to the process running in the current buffer.
 The string is sent using `comint-input-sender'.
@@ -2382,18 +2382,19 @@ Security bug: your string can still be temporarily recovered with
 	    (message "Warning: text will be echoed")))
       (error "Buffer %s has no process" (current-buffer)))))
 
+(define-obsolete-function-alias 'send-invisible #'comint-send-invisible "27.1")
+
 (defun comint-watch-for-password-prompt (string)
   "Prompt in the minibuffer for password and send without echoing.
-This function uses `send-invisible' to read and send a password to the buffer's
-process if STRING contains a password prompt defined by
-`comint-password-prompt-regexp'.
+Looks for a match to `comint-password-prompt-regexp' in order
+to detect the need to (prompt and) send a password.
 
 This function could be in the list `comint-output-filter-functions'."
   (when (let ((case-fold-search t))
 	  (string-match comint-password-prompt-regexp string))
     (when (string-match "^[ \n\r\t\v\f\b\a]+" string)
       (setq string (replace-match "" t t string)))
-    (send-invisible string)))
+    (comint-send-invisible string)))
 
 ;; Low-level process communication
 
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index 3bfc4d7f356..015e04f4075 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -1,4 +1,4 @@
-;;; rlogin.el --- remote login interface
+;;; rlogin.el --- remote login interface  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 1992-1995, 1997-1998, 2001-2018 Free Software
 ;; Foundation, Inc.
@@ -30,9 +30,9 @@
 ;; tracking and the sending of some special characters.
 
 ;; If you wish for rlogin mode to prompt you in the minibuffer for
-;; passwords when a password prompt appears, just enter m-x send-invisible
-;; and type in your line, or add `comint-watch-for-password-prompt' to
-;; `comint-output-filter-functions'.
+;; passwords when a password prompt appears, just enter
+;; M-x comint-send-invisible and type in your line (or tweak
+;; `comint-password-prompt-regexp' to match your password prompt).
 
 ;;; Code:
 
diff --git a/lisp/shell.el b/lisp/shell.el
index fa6eee0f187..ac6f11aeb40 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -73,7 +73,7 @@
 ;; c-c c-o comint-delete-output		   Delete last batch of process output
 ;; c-c c-r comint-show-output		   Show last batch of process output
 ;; c-c c-l comint-dynamic-list-input-ring  List input history
-;;         send-invisible                  Read line w/o echo & send to proc
+;;         comint-send-invisible           Read line w/o echo & send to proc
 ;;         comint-continue-subjob	   Useful if you accidentally suspend
 ;;					        top-level job
 ;; comint-mode-hook is the comint mode hook.
@@ -500,7 +500,7 @@ Shell buffers.  It implements `shell-completion-execonly' for
     the end of process to the end of the current line.
 \\[comint-send-input] before end of process output copies the current line minus the prompt to
     the end of the buffer and sends it (\\[comint-copy-old-input] just copies the current line).
-\\[send-invisible] reads a line of text without echoing it, and sends it to
+\\[comint-send-invisible] reads a line of text without echoing it, and sends it to
     the shell.  This is useful for entering passwords.  Or, add the function
     `comint-watch-for-password-prompt' to `comint-output-filter-functions'.