aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Breton2000-03-30 10:20:29 +0000
committerPeter Breton2000-03-30 10:20:29 +0000
commit76540917e1b8ca54680963fa822d447944e0f97c (patch)
treec6b691f64484eca004f61c1b3a8c5e6172363c73
parent4d6e16b3c3cd7737f5dc372cf0f01deb5bfc4e9b (diff)
downloademacs-76540917e1b8ca54680963fa822d447944e0f97c.tar.gz
emacs-76540917e1b8ca54680963fa822d447944e0f97c.zip
network-connection-mode is derived from comint-mode
Added network-connection-mode-setup function Save host and port/service information in local variables
-rw-r--r--lisp/net/net-utils.el35
1 files changed, 33 insertions, 2 deletions
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index f03d321e868..480a6163a2e 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -218,6 +218,10 @@ These options can be used to limit how many ICMP packets are emitted."
218 :type 'regexp 218 :type 'regexp
219 ) 219 )
220 220
221;; Internal variables
222(defvar network-connection-service nil)
223(defvar network-connection-host nil)
224
221;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 225;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
222;; Nslookup goodies 226;; Nslookup goodies
223;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 227;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -816,6 +820,29 @@ from SEARCH-STRING. With argument, prompt for whois server."
816;;; General Network connection 820;;; General Network connection
817;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 821;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818 822
823;; Using a derived mode gives us keymaps, hooks, etc.
824(define-derived-mode
825 network-connection-mode comint-mode "Network-Connection"
826 "Major mode for interacting with the network-connection program."
827 )
828
829(defun network-connection-mode-setup (host service)
830 (let ((network-abbrev-table
831 (or
832 (assoc service network-connection-service-abbrev-alist)
833 (and (rassoc service network-connection-service-alist)
834 (assoc
835 (elt (rassoc service network-connection-service-alist) 0)
836 network-connection-service-abbrev-alist)))))
837 (make-local-variable 'network-connection-host)
838 (setq network-connection-host host)
839 (make-local-variable 'network-connection-service)
840 (setq network-connection-service service)
841 (and network-abbrev-table
842 (setq local-abbrev-table (cdr network-abbrev-table))
843 (abbrev-mode t)
844 )))
845
819;;;###autoload 846;;;###autoload
820(defun network-connection-to-service (host service) 847(defun network-connection-to-service (host service)
821 "Open a network connection to SERVICE on HOST." 848 "Open a network connection to SERVICE on HOST."
@@ -842,15 +869,19 @@ from SEARCH-STRING. With argument, prompt for whois server."
842(defun network-service-connection (host service) 869(defun network-service-connection (host service)
843 "Open a network connection to SERVICE on HOST." 870 "Open a network connection to SERVICE on HOST."
844 (require 'comint) 871 (require 'comint)
845 (let ( 872 (let* (
846 (process-name (concat "Network Connection [" host " " service "]")) 873 (process-name (concat "Network Connection [" host " " service "]"))
847 (portnum (string-to-number service)) 874 (portnum (string-to-number service))
875 (buf (get-buffer-create (concat "*" process-name "*")))
848 ) 876 )
849 (or (zerop portnum) (setq service portnum)) 877 (or (zerop portnum) (setq service portnum))
850 (make-comint 878 (make-comint
851 process-name 879 process-name
852 (cons host service)) 880 (cons host service))
853 (pop-to-buffer (get-buffer (concat "*" process-name "*"))) 881 (set-buffer buf)
882 (network-connection-mode)
883 (network-connection-mode-setup host service)
884 (pop-to-buffer buf)
854 )) 885 ))
855 886
856(provide 'net-utils) 887(provide 'net-utils)