Mercurial > emacs
changeset 28419:fed834403704
network-connection-mode is derived from comint-mode
Added network-connection-mode-setup function
Save host and port/service information in local variables
author | Peter Breton <pbreton@attbi.com> |
---|---|
date | Thu, 30 Mar 2000 10:20:29 +0000 |
parents | 5b7b3b5d54df |
children | 854590466b7b |
files | lisp/net/net-utils.el |
diffstat | 1 files changed, 33 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/net/net-utils.el Thu Mar 30 10:06:34 2000 +0000 +++ b/lisp/net/net-utils.el Thu Mar 30 10:20:29 2000 +0000 @@ -218,6 +218,10 @@ :type 'regexp ) +;; Internal variables +(defvar network-connection-service nil) +(defvar network-connection-host nil) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Nslookup goodies ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -816,6 +820,29 @@ ;;; General Network connection ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Using a derived mode gives us keymaps, hooks, etc. +(define-derived-mode + network-connection-mode comint-mode "Network-Connection" + "Major mode for interacting with the network-connection program." + ) + +(defun network-connection-mode-setup (host service) + (let ((network-abbrev-table + (or + (assoc service network-connection-service-abbrev-alist) + (and (rassoc service network-connection-service-alist) + (assoc + (elt (rassoc service network-connection-service-alist) 0) + network-connection-service-abbrev-alist))))) + (make-local-variable 'network-connection-host) + (setq network-connection-host host) + (make-local-variable 'network-connection-service) + (setq network-connection-service service) + (and network-abbrev-table + (setq local-abbrev-table (cdr network-abbrev-table)) + (abbrev-mode t) + ))) + ;;;###autoload (defun network-connection-to-service (host service) "Open a network connection to SERVICE on HOST." @@ -842,15 +869,19 @@ (defun network-service-connection (host service) "Open a network connection to SERVICE on HOST." (require 'comint) - (let ( + (let* ( (process-name (concat "Network Connection [" host " " service "]")) (portnum (string-to-number service)) + (buf (get-buffer-create (concat "*" process-name "*"))) ) (or (zerop portnum) (setq service portnum)) (make-comint process-name (cons host service)) - (pop-to-buffer (get-buffer (concat "*" process-name "*"))) + (set-buffer buf) + (network-connection-mode) + (network-connection-mode-setup host service) + (pop-to-buffer buf) )) (provide 'net-utils)