diff options
| author | Glenn Morris | 2011-04-07 20:11:31 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-04-07 20:11:31 -0700 |
| commit | 56442f0c3d102cfae04ae5fed45152d18c20fadf (patch) | |
| tree | 10de8c2121c2d36f307f1c0ffe1f9cef4b7d3f77 | |
| parent | 12544bbe7512150c9af6d082cbfbc6a4279215ad (diff) | |
| download | emacs-56442f0c3d102cfae04ae5fed45152d18c20fadf.tar.gz emacs-56442f0c3d102cfae04ae5fed45152d18c20fadf.zip | |
rlogin.el trivia.
* lisp/net/rlogin.el (rlogin-process-connection-type): Simplify.
(rlogin-mode-map): Initialize in the defvar.
(rlogin): Use ignore-errors.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/net/rlogin.el | 70 |
2 files changed, 32 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0bbf1218eca..ae36e174b96 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-04-08 Glenn Morris <rgm@gnu.org> | 1 | 2011-04-08 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * net/rlogin.el (rlogin-process-connection-type): Simplify. | ||
| 4 | (rlogin-mode-map): Initialize in the defvar. | ||
| 5 | (rlogin): Use ignore-errors. | ||
| 6 | |||
| 3 | * replace.el (occur-mode-map): Some fixes for menu items. | 7 | * replace.el (occur-mode-map): Some fixes for menu items. |
| 4 | 8 | ||
| 5 | 2011-04-07 Aaron S. Hawley <aaron.s.hawley@gmail.com> | 9 | 2011-04-07 Aaron S. Hawley <aaron.s.hawley@gmail.com> |
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index 91b4aa7d72e..e2619e3bf79 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el | |||
| @@ -60,14 +60,9 @@ | |||
| 60 | :group 'rlogin) | 60 | :group 'rlogin) |
| 61 | 61 | ||
| 62 | (defcustom rlogin-process-connection-type | 62 | (defcustom rlogin-process-connection-type |
| 63 | (save-match-data | 63 | ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if |
| 64 | ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if | 64 | ;; stdin isn't a tty. |
| 65 | ;; stdin isn't a tty. | 65 | (and (string-match-p "-solaris2" system-configuration) t) |
| 66 | (cond ((and (boundp 'system-configuration) | ||
| 67 | (stringp system-configuration) | ||
| 68 | (string-match "-solaris2" system-configuration)) | ||
| 69 | t) | ||
| 70 | (t nil))) | ||
| 71 | "If non-nil, use a pty for the local rlogin process. | 66 | "If non-nil, use a pty for the local rlogin process. |
| 72 | If nil, use a pipe (if pipes are supported on the local system). | 67 | If nil, use a pipe (if pipes are supported on the local system). |
| 73 | 68 | ||
| @@ -115,19 +110,19 @@ this variable is set from that." | |||
| 115 | :type '(choice (const nil) string) | 110 | :type '(choice (const nil) string) |
| 116 | :group 'rlogin) | 111 | :group 'rlogin) |
| 117 | 112 | ||
| 118 | ;; Initialize rlogin mode map. | 113 | (defvar rlogin-mode-map |
| 119 | (defvar rlogin-mode-map '()) | 114 | (let ((map (if (consp shell-mode-map) |
| 120 | (cond | 115 | (cons 'keymap shell-mode-map) |
| 121 | ((null rlogin-mode-map) | 116 | (copy-keymap shell-mode-map)))) |
| 122 | (setq rlogin-mode-map (if (consp shell-mode-map) | 117 | (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C) |
| 123 | (cons 'keymap shell-mode-map) | 118 | (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D) |
| 124 | (copy-keymap shell-mode-map))) | 119 | (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z) |
| 125 | (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C) | 120 | (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) |
| 126 | (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D) | 121 | (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D) |
| 127 | (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z) | 122 | (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete) |
| 128 | (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) | 123 | map) |
| 129 | (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D) | 124 | "Keymap for `rlogin-mode'.") |
| 130 | (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete))) | 125 | |
| 131 | 126 | ||
| 132 | 127 | ||
| 133 | ;;;###autoload (add-hook 'same-window-regexps (purecopy "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")) | 128 | ;;;###autoload (add-hook 'same-window-regexps (purecopy "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")) |
| @@ -175,7 +170,6 @@ variable." | |||
| 175 | (read-from-minibuffer "rlogin arguments (hostname first): " | 170 | (read-from-minibuffer "rlogin arguments (hostname first): " |
| 176 | nil nil nil 'rlogin-history) | 171 | nil nil nil 'rlogin-history) |
| 177 | current-prefix-arg)) | 172 | current-prefix-arg)) |
| 178 | |||
| 179 | (let* ((process-connection-type rlogin-process-connection-type) | 173 | (let* ((process-connection-type rlogin-process-connection-type) |
| 180 | (args (if rlogin-explicit-args | 174 | (args (if rlogin-explicit-args |
| 181 | (append (split-string input-args) | 175 | (append (split-string input-args) |
| @@ -192,7 +186,6 @@ variable." | |||
| 192 | (buffer-name (if (string= user (user-login-name)) | 186 | (buffer-name (if (string= user (user-login-name)) |
| 193 | (format "*rlogin-%s*" host) | 187 | (format "*rlogin-%s*" host) |
| 194 | (format "*rlogin-%s@%s*" user host)))) | 188 | (format "*rlogin-%s@%s*" user host)))) |
| 195 | |||
| 196 | (cond ((null buffer)) | 189 | (cond ((null buffer)) |
| 197 | ((stringp buffer) | 190 | ((stringp buffer) |
| 198 | (setq buffer-name buffer)) | 191 | (setq buffer-name buffer)) |
| @@ -202,32 +195,26 @@ variable." | |||
| 202 | (setq buffer-name (format "%s<%d>" buffer-name buffer))) | 195 | (setq buffer-name (format "%s<%d>" buffer-name buffer))) |
| 203 | (t | 196 | (t |
| 204 | (setq buffer-name (generate-new-buffer-name buffer-name)))) | 197 | (setq buffer-name (generate-new-buffer-name buffer-name)))) |
| 205 | |||
| 206 | (setq buffer (get-buffer-create buffer-name)) | 198 | (setq buffer (get-buffer-create buffer-name)) |
| 207 | (pop-to-buffer buffer-name) | 199 | (pop-to-buffer buffer-name) |
| 208 | |||
| 209 | (unless (comint-check-proc buffer-name) | 200 | (unless (comint-check-proc buffer-name) |
| 210 | (comint-exec buffer buffer-name rlogin-program nil args) | 201 | (comint-exec buffer buffer-name rlogin-program nil args) |
| 211 | |||
| 212 | (rlogin-mode) | 202 | (rlogin-mode) |
| 213 | |||
| 214 | (make-local-variable 'rlogin-host) | 203 | (make-local-variable 'rlogin-host) |
| 215 | (setq rlogin-host host) | 204 | (setq rlogin-host host) |
| 216 | (make-local-variable 'rlogin-remote-user) | 205 | (make-local-variable 'rlogin-remote-user) |
| 217 | (setq rlogin-remote-user user) | 206 | (setq rlogin-remote-user user) |
| 218 | 207 | (ignore-errors | |
| 219 | (condition-case () | 208 | (cond ((eq rlogin-directory-tracking-mode t) |
| 220 | (cond ((eq rlogin-directory-tracking-mode t) | 209 | ;; Do this here, rather than calling the tracking mode |
| 221 | ;; Do this here, rather than calling the tracking mode | 210 | ;; function, to avoid a gratuitous resync check; the default |
| 222 | ;; function, to avoid a gratuitous resync check; the default | 211 | ;; should be the user's home directory, be it local or remote. |
| 223 | ;; should be the user's home directory, be it local or remote. | 212 | (setq comint-file-name-prefix |
| 224 | (setq comint-file-name-prefix | 213 | (concat "/" rlogin-remote-user "@" rlogin-host ":")) |
| 225 | (concat "/" rlogin-remote-user "@" rlogin-host ":")) | 214 | (cd-absolute comint-file-name-prefix)) |
| 226 | (cd-absolute comint-file-name-prefix)) | 215 | ((null rlogin-directory-tracking-mode)) |
| 227 | ((null rlogin-directory-tracking-mode)) | 216 | (t |
| 228 | (t | 217 | (cd-absolute (concat comint-file-name-prefix "~/")))))))) |
| 229 | (cd-absolute (concat comint-file-name-prefix "~/")))) | ||
| 230 | (error nil))))) | ||
| 231 | 218 | ||
| 232 | (put 'rlogin-mode 'mode-class 'special) | 219 | (put 'rlogin-mode 'mode-class 'special) |
| 233 | 220 | ||
| @@ -302,8 +289,7 @@ local one share the same directories (e.g. through NFS)." | |||
| 302 | (process-send-string nil "\C-\\")) | 289 | (process-send-string nil "\C-\\")) |
| 303 | 290 | ||
| 304 | (defun rlogin-delchar-or-send-Ctrl-D (arg) | 291 | (defun rlogin-delchar-or-send-Ctrl-D (arg) |
| 305 | "\ | 292 | "Delete ARG characters forward, or send a C-d to process if at end of buffer." |
| 306 | Delete ARG characters forward, or send a C-d to process if at end of buffer." | ||
| 307 | (interactive "p") | 293 | (interactive "p") |
| 308 | (if (eobp) | 294 | (if (eobp) |
| 309 | (rlogin-send-Ctrl-D) | 295 | (rlogin-send-Ctrl-D) |