X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b35f288d478ef137a4d9e8e5a6a5f368a86b01f5..1adfb5ee55d16cd3d9d78998ae7bbb8e5708d9c5:/lisp/net/rlogin.el diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index 763b09d858..921ceff290 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el @@ -1,7 +1,7 @@ ;;; rlogin.el --- remote login interface -;; Copyright (C) 1992, 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1992-1995, 1997-1998, 2001-2016 Free Software +;; Foundation, Inc. ;; Author: Noah Friedman ;; Maintainer: Noah Friedman @@ -36,6 +36,11 @@ ;;; Code: +;; FIXME? +;; Maybe this file should be obsolete. +;; http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00517.html +;; It only adds rlogin-directory-tracking-mode. Is that useful? + (require 'comint) (require 'shell) @@ -44,42 +49,41 @@ :group 'processes :group 'unix) -(defcustom rlogin-program "rlogin" - "*Name of program to invoke rlogin" +(defcustom rlogin-program "ssh" + "Name of program to invoke remote login." + :version "24.4" ; rlogin -> ssh :type 'string :group 'rlogin) -(defcustom rlogin-explicit-args nil - "*List of arguments to pass to rlogin on the command line." +(defcustom rlogin-explicit-args '("-t" "-t") + "List of arguments to pass to `rlogin-program' on the command line." + :version "24.4" ; nil -> -t -t :type '(repeat (string :tag "Argument")) :group 'rlogin) (defcustom rlogin-mode-hook nil - "*Hooks to run after setting current buffer to rlogin-mode." + "Hooks to run after setting current buffer to rlogin-mode." :type 'hook :group 'rlogin) (defcustom rlogin-process-connection-type - (save-match-data - ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if - ;; stdin isn't a tty. - (cond ((and (boundp 'system-configuration) - (stringp system-configuration) - (string-match "-solaris2" system-configuration)) - t) - (t nil))) - "*If non-nil, use a pty for the local rlogin process. + ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if + ;; stdin isn't a tty. + (and (string-match "rlogin" rlogin-program) + (string-match-p "-solaris2" system-configuration) t) + "If non-nil, use a pty for the local rlogin process. If nil, use a pipe (if pipes are supported on the local system). Generally it is better not to waste ptys on systems which have a static number of them. On the other hand, some implementations of `rlogin' assume a pty is being used, and errors will result from using a pipe instead." + :set-after '(rlogin-program) :type '(choice (const :tag "pipes" nil) (other :tag "ptys" t)) :group 'rlogin) (defcustom rlogin-directory-tracking-mode 'local - "*Control whether and how to do directory tracking in an rlogin buffer. + "Control whether and how to do directory tracking in an rlogin buffer. nil means don't do directory tracking. @@ -103,35 +107,33 @@ re-synching of directories." (make-variable-buffer-local 'rlogin-directory-tracking-mode) (defcustom rlogin-host nil - "*The name of the remote host. This variable is buffer-local." + "The name of the default remote host. This variable is buffer-local." :type '(choice (const nil) string) :group 'rlogin) (defcustom rlogin-remote-user nil - "*The username used on the remote host. + "The username used on the remote host. This variable is buffer-local and defaults to your local user name. If rlogin is invoked with the `-l' option to specify the remote username, this variable is set from that." :type '(choice (const nil) string) :group 'rlogin) -;; Initialize rlogin mode map. -(defvar rlogin-mode-map '()) -(cond - ((null rlogin-mode-map) - (setq rlogin-mode-map (if (consp shell-mode-map) - (cons 'keymap shell-mode-map) - (copy-keymap shell-mode-map))) - (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C) - (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D) - (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z) - (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) - (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D) - (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete))) +(defvar rlogin-mode-map + (let ((map (if (consp shell-mode-map) + (cons 'keymap shell-mode-map) + (copy-keymap shell-mode-map)))) + (define-key map "\C-c\C-c" 'rlogin-send-Ctrl-C) + (define-key map "\C-c\C-d" 'rlogin-send-Ctrl-D) + (define-key map "\C-c\C-z" 'rlogin-send-Ctrl-Z) + (define-key map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) + (define-key map "\C-d" 'rlogin-delchar-or-send-Ctrl-D) + (define-key map "\C-i" 'rlogin-tab-or-complete) + map) + "Keymap for `rlogin-mode'.") - -;;;###autoload (add-hook 'same-window-regexps "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)") + (defvar rlogin-history nil) ;;;###autoload @@ -143,7 +145,7 @@ other arguments for `rlogin'. Input is sent line-at-a-time to the remote connection. Communication with the remote host is recorded in a buffer `*rlogin-HOST*' -\(or `*rlogin-USER@HOST*' if the remote username differs\). +\(or `*rlogin-USER@HOST*' if the remote username differs). If a prefix argument is given and the buffer `*rlogin-HOST*' already exists, a new buffer with a different connection will be made. @@ -172,10 +174,11 @@ If you wish to change directory tracking styles during a session, use the function `rlogin-directory-tracking-mode' rather than simply setting the variable." (interactive (list - (read-from-minibuffer "rlogin arguments (hostname first): " + (read-from-minibuffer (format-message + "Arguments for `%s' (hostname first): " + (file-name-nondirectory rlogin-program)) nil nil nil 'rlogin-history) current-prefix-arg)) - (let* ((process-connection-type rlogin-process-connection-type) (args (if rlogin-explicit-args (append (split-string input-args) @@ -192,7 +195,6 @@ variable." (buffer-name (if (string= user (user-login-name)) (format "*rlogin-%s*" host) (format "*rlogin-%s@%s*" user host)))) - (cond ((null buffer)) ((stringp buffer) (setq buffer-name buffer)) @@ -202,32 +204,26 @@ variable." (setq buffer-name (format "%s<%d>" buffer-name buffer))) (t (setq buffer-name (generate-new-buffer-name buffer-name)))) - (setq buffer (get-buffer-create buffer-name)) - (pop-to-buffer buffer-name) - + (switch-to-buffer buffer-name) (unless (comint-check-proc buffer-name) (comint-exec buffer buffer-name rlogin-program nil args) - (rlogin-mode) - (make-local-variable 'rlogin-host) (setq rlogin-host host) (make-local-variable 'rlogin-remote-user) (setq rlogin-remote-user user) - - (condition-case () - (cond ((eq rlogin-directory-tracking-mode t) - ;; Do this here, rather than calling the tracking mode - ;; function, to avoid a gratuitous resync check; the default - ;; should be the user's home directory, be it local or remote. - (setq comint-file-name-prefix - (concat "/" rlogin-remote-user "@" rlogin-host ":")) - (cd-absolute comint-file-name-prefix)) - ((null rlogin-directory-tracking-mode)) - (t - (cd-absolute (concat comint-file-name-prefix "~/")))) - (error nil))))) + (ignore-errors + (cond ((eq rlogin-directory-tracking-mode t) + ;; Do this here, rather than calling the tracking mode + ;; function, to avoid a gratuitous resync check; the default + ;; should be the user's home directory, be it local or remote. + (setq comint-file-name-prefix + (concat "/" rlogin-remote-user "@" rlogin-host ":")) + (cd-absolute comint-file-name-prefix)) + ((null rlogin-directory-tracking-mode)) + (t + (cd-absolute (concat comint-file-name-prefix "~/")))))))) (put 'rlogin-mode 'mode-class 'special) @@ -239,17 +235,17 @@ variable." "Do remote or local directory tracking, or disable entirely. If called with no prefix argument or a unspecified prefix argument (just -``\\[universal-argument]'' with no number) do remote directory tracking via +`\\[universal-argument]' with no number) do remote directory tracking via ange-ftp. If called as a function, give it no argument. If called with a negative prefix argument, disable directory tracking entirely. If called with a positive, numeric prefix argument, e.g. -``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'', +`\\[universal-argument] 1 M-x rlogin-directory-tracking-mode', then do directory tracking but assume the remote filesystem is the same as the local system. This only works in general if the remote machine and the -local one share the same directories (through NFS)." +local one share the same directories (e.g. through NFS)." (interactive "P") (cond ((or (null prefix) @@ -302,8 +298,7 @@ local one share the same directories (through NFS)." (process-send-string nil "\C-\\")) (defun rlogin-delchar-or-send-Ctrl-D (arg) - "\ -Delete ARG characters forward, or send a C-d to process if at end of buffer." + "Delete ARG characters forward, or send a C-d to process if at end of buffer." (interactive "p") (if (eobp) (rlogin-send-Ctrl-D) @@ -313,10 +308,9 @@ Delete ARG characters forward, or send a C-d to process if at end of buffer." "Complete file name if doing directory tracking, or just insert TAB." (interactive) (if rlogin-directory-tracking-mode - (comint-dynamic-complete) + (completion-at-point) (insert "\C-i"))) (provide 'rlogin) -;; arch-tag: 6e20eabf-feda-40fa-ab40-0d156db447e4 ;;; rlogin.el ends here