aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-06 04:58:36 +0000
committerMiles Bader2000-10-06 04:58:36 +0000
commit8fb051f9678de532a9db5a48c7c896f5b218816c (patch)
tree2d6a85dd0e41e670112bbf1392a44e8ff181138e
parent2464210ee05d695aa96e057902735c068e49790b (diff)
downloademacs-8fb051f9678de532a9db5a48c7c896f5b218816c.tar.gz
emacs-8fb051f9678de532a9db5a48c7c896f5b218816c.zip
(nslookup-prompt-regexp, ftp-prompt-regexp)
(smbclient-prompt-regexp): Add usage note to doc string. (ftp-font-lock-keywords, smbclient-font-lock-keywords): Removed. (ftp-mode, smbclient-mode): Don't set `font-lock-defaults'. Use add-hook for adding the comint filter function, and only do so if it's not already in the global hook list. (ftp-mode, smbclient-mode, nslookup-mode): Remove redundant calls to `make-local-variable'. (nslookup-font-lock-keywords): Remove prompt entry. (nslookup): Don't set the process-filter. (finger): Exit the loop correctly when the regexps list runs out. (ftp, smbclient, smbclient-list-shares): Set the real major mode immediately, not after execing. Use `pop-to-buffer' instead of `switch-to-buffer-other-window'.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/net/net-utils.el124
2 files changed, 63 insertions, 80 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7575bd24f62..a68e9d0760e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12000-10-06 Miles Bader <miles@lsi.nec.co.jp>
2
3 * net/net-utils.el (nslookup-prompt-regexp, ftp-prompt-regexp)
4 (smbclient-prompt-regexp): Add usage note to doc string.
5 (ftp-font-lock-keywords, smbclient-font-lock-keywords): Removed.
6 (ftp-mode, smbclient-mode): Don't set `font-lock-defaults'.
7 Use add-hook for adding the comint filter function, and only do so
8 if it's not already in the global hook list.
9 (ftp-mode, smbclient-mode, nslookup-mode): Remove redundant calls
10 to `make-local-variable'.
11 (nslookup-font-lock-keywords): Remove prompt entry.
12 (nslookup): Don't set the process-filter.
13 (finger): Exit the loop correctly when the regexps list runs out.
14 (ftp, smbclient, smbclient-list-shares):
15 Set the real major mode immediately, not after execing.
16 Use `pop-to-buffer' instead of `switch-to-buffer-other-window'.
17
18 * comint.el (comint-watch-for-password-prompt): Use STRING as a prompt.
19
12000-10-05 Alex Schroeder <alex@gnu.org> 202000-10-05 Alex Schroeder <alex@gnu.org>
2 21
3 * sql.el (sql-mysql-options): New variable. 22 * sql.el (sql-mysql-options): New variable.
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 9f98b7f8091..8296a046038 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -171,7 +171,10 @@ These options can be used to limit how many ICMP packets are emitted."
171 ) 171 )
172 172
173(defcustom nslookup-prompt-regexp "^> " 173(defcustom nslookup-prompt-regexp "^> "
174 "Regexp to match the nslookup prompt." 174 "Regexp to match the nslookup prompt.
175
176This variable is only used if the variable
177`comint-use-prompt-regexp-instead-of-fields' is non-nil."
175 :group 'net-utils 178 :group 'net-utils
176 :type 'regexp 179 :type 'regexp
177 ) 180 )
@@ -195,7 +198,10 @@ These options can be used to limit how many ICMP packets are emitted."
195 ) 198 )
196 199
197(defcustom ftp-prompt-regexp "^ftp>" 200(defcustom ftp-prompt-regexp "^ftp>"
198 "Regexp which matches the FTP program's prompt." 201 "Regexp which matches the FTP program's prompt.
202
203This variable is only used if the variable
204`comint-use-prompt-regexp-instead-of-fields' is non-nil."
199 :group 'net-utils 205 :group 'net-utils
200 :type 'regexp 206 :type 'regexp
201 ) 207 )
@@ -213,7 +219,10 @@ These options can be used to limit how many ICMP packets are emitted."
213 ) 219 )
214 220
215(defcustom smbclient-prompt-regexp "^smb: \>" 221(defcustom smbclient-prompt-regexp "^smb: \>"
216 "Regexp which matches the smbclient program's prompt." 222 "Regexp which matches the smbclient program's prompt.
223
224This variable is only used if the variable
225`comint-use-prompt-regexp-instead-of-fields' is non-nil."
217 :group 'net-utils 226 :group 'net-utils
218 :type 'regexp 227 :type 'regexp
219 ) 228 )
@@ -230,7 +239,6 @@ These options can be used to limit how many ICMP packets are emitted."
230 (progn 239 (progn
231 (require 'font-lock) 240 (require 'font-lock)
232 (list 241 (list
233 (list nslookup-prompt-regexp 0 font-lock-reference-face)
234 (list "^[A-Za-z0-9 _]+:" 0 font-lock-type-face) 242 (list "^[A-Za-z0-9 _]+:" 0 font-lock-type-face)
235 (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>" 243 (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>"
236 1 font-lock-keyword-face) 244 1 font-lock-keyword-face)
@@ -254,26 +262,6 @@ These options can be used to limit how many ICMP packets are emitted."
254 "Expressions to font-lock for nslookup.") 262 "Expressions to font-lock for nslookup.")
255 263
256;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 264;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
257;; FTP goodies
258;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
259
260(defconst ftp-font-lock-keywords
261 (progn
262 (require 'font-lock)
263 (list
264 (list ftp-prompt-regexp 0 font-lock-reference-face))))
265
266;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
267;; smbclient goodies
268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269
270(defconst smbclient-font-lock-keywords
271 (progn
272 (require 'font-lock)
273 (list
274 (list smbclient-prompt-regexp 0 font-lock-reference-face))))
275
276;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
277;; Utility functions 265;; Utility functions
278;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 266;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
279 267
@@ -457,23 +445,18 @@ If your system's ping continues until interrupted, you can try setting
457 (interactive) 445 (interactive)
458 (require 'comint) 446 (require 'comint)
459 (comint-run nslookup-program) 447 (comint-run nslookup-program)
460 (set-process-filter (get-buffer-process "*nslookup*")
461 'net-utils-remove-ctrl-m-filter)
462 (nslookup-mode) 448 (nslookup-mode)
463 ) 449 )
464 450
465;; Using a derived mode gives us keymaps, hooks, etc. 451;; Using a derived mode gives us keymaps, hooks, etc.
466(define-derived-mode 452(define-derived-mode nslookup-mode comint-mode "Nslookup"
467 nslookup-mode comint-mode "Nslookup"
468 "Major mode for interacting with the nslookup program." 453 "Major mode for interacting with the nslookup program."
469 (set 454 (set
470 (make-local-variable 'font-lock-defaults) 455 (make-local-variable 'font-lock-defaults)
471 '((nslookup-font-lock-keywords))) 456 '((nslookup-font-lock-keywords)))
472 (setq local-abbrev-table nslookup-mode-abbrev-table) 457 (setq local-abbrev-table nslookup-mode-abbrev-table)
473 (abbrev-mode t) 458 (abbrev-mode t)
474 (make-local-variable 'comint-prompt-regexp)
475 (setq comint-prompt-regexp nslookup-prompt-regexp) 459 (setq comint-prompt-regexp nslookup-prompt-regexp)
476 (make-local-variable 'comint-input-autoexpand)
477 (setq comint-input-autoexpand t) 460 (setq comint-input-autoexpand t)
478 ) 461 )
479 462
@@ -520,33 +503,27 @@ If your system's ping continues until interrupted, you can try setting
520 (require 'comint) 503 (require 'comint)
521 (let ((buf (get-buffer-create (concat "*ftp [" host "]*")))) 504 (let ((buf (get-buffer-create (concat "*ftp [" host "]*"))))
522 (set-buffer buf) 505 (set-buffer buf)
523 (comint-mode) 506 (ftp-mode)
524 (comint-exec buf (concat "ftp-" host) ftp-program nil 507 (comint-exec buf (concat "ftp-" host) ftp-program nil
525 (if ftp-program-options 508 (if ftp-program-options
526 (append (list host) ftp-program-options) 509 (append (list host) ftp-program-options)
527 (list host))) 510 (list host)))
528 (ftp-mode) 511 (pop-to-buffer buf)))
529 (switch-to-buffer-other-window buf)
530 ))
531 512
532(define-derived-mode 513(define-derived-mode ftp-mode comint-mode "FTP"
533 ftp-mode comint-mode "FTP"
534 "Major mode for interacting with the ftp program." 514 "Major mode for interacting with the ftp program."
535
536 (set
537 (make-local-variable 'font-lock-defaults)
538 '((ftp-font-lock-keywords)))
539
540 (make-local-variable 'comint-prompt-regexp)
541 (setq comint-prompt-regexp ftp-prompt-regexp) 515 (setq comint-prompt-regexp ftp-prompt-regexp)
542
543 (make-local-variable 'comint-input-autoexpand)
544 (setq comint-input-autoexpand t) 516 (setq comint-input-autoexpand t)
545 517 ;; Only add the password-prompting hook if it's not already in the
546 ;; Already buffer local! 518 ;; global hook list. This stands a small chance of losing, if it's
547 (setq comint-output-filter-functions 519 ;; later removed from the global list (very small, since any
548 (list 'comint-watch-for-password-prompt)) 520 ;; password prompts will probably immediately follow the initial
549 521 ;; connection), but it's better than getting prompted twice for the
522 ;; same password.
523 (unless (memq 'comint-watch-for-password-prompt
524 (default-value 'comint-output-filter-functions))
525 (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt
526 nil t))
550 (setq local-abbrev-table ftp-mode-abbrev-table) 527 (setq local-abbrev-table ftp-mode-abbrev-table)
551 (abbrev-mode t) 528 (abbrev-mode t)
552 ) 529 )
@@ -571,14 +548,12 @@ If your system's ping continues until interrupted, you can try setting
571 (buf (get-buffer-create (concat "*" name "*"))) 548 (buf (get-buffer-create (concat "*" name "*")))
572 (service-name (concat "\\\\" host "\\" service))) 549 (service-name (concat "\\\\" host "\\" service)))
573 (set-buffer buf) 550 (set-buffer buf)
574 (comint-mode) 551 (smbclient-mode)
575 (comint-exec buf name smbclient-program nil 552 (comint-exec buf name smbclient-program nil
576 (if smbclient-program-options 553 (if smbclient-program-options
577 (append (list service-name) smbclient-program-options) 554 (append (list service-name) smbclient-program-options)
578 (list service-name))) 555 (list service-name)))
579 (smbclient-mode) 556 (pop-to-buffer buf)))
580 (switch-to-buffer-other-window buf)
581 ))
582 557
583(defun smbclient-list-shares (host) 558(defun smbclient-list-shares (host)
584 "List services on HOST." 559 "List services on HOST."
@@ -589,35 +564,25 @@ If your system's ping continues until interrupted, you can try setting
589 )) 564 ))
590 (let ((buf (get-buffer-create (format "*SMB Shares on %s*" host)))) 565 (let ((buf (get-buffer-create (format "*SMB Shares on %s*" host))))
591 (set-buffer buf) 566 (set-buffer buf)
592 (comint-mode)
593 (comint-exec
594 buf
595 "smbclient-list-shares"
596 smbclient-program
597 nil
598 (list "-L" host)
599 )
600 (smbclient-mode) 567 (smbclient-mode)
601 (switch-to-buffer-other-window buf))) 568 (comint-exec buf "smbclient-list-shares"
569 smbclient-program nil (list "-L" host))
570 (pop-to-buffer buf)))
602 571
603(define-derived-mode 572(define-derived-mode smbclient-mode comint-mode "smbclient"
604 smbclient-mode comint-mode "smbclient"
605 "Major mode for interacting with the smbclient program." 573 "Major mode for interacting with the smbclient program."
606
607 (set
608 (make-local-variable 'font-lock-defaults)
609 '((smbclient-font-lock-keywords)))
610
611 (make-local-variable 'comint-prompt-regexp)
612 (setq comint-prompt-regexp smbclient-prompt-regexp) 574 (setq comint-prompt-regexp smbclient-prompt-regexp)
613
614 (make-local-variable 'comint-input-autoexpand)
615 (setq comint-input-autoexpand t) 575 (setq comint-input-autoexpand t)
616 576 ;; Only add the password-prompting hook if it's not already in the
617 ;; Already buffer local! 577 ;; global hook list. This stands a small chance of losing, if it's
618 (setq comint-output-filter-functions 578 ;; later removed from the global list (very small, since any
619 (list 'comint-watch-for-password-prompt)) 579 ;; password prompts will probably immediately follow the initial
620 580 ;; connection), but it's better than getting prompted twice for the
581 ;; same password.
582 (unless (memq 'comint-watch-for-password-prompt
583 (default-value 'comint-output-filter-functions))
584 (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt
585 nil t))
621 (setq local-abbrev-table smbclient-mode-abbrev-table) 586 (setq local-abbrev-table smbclient-mode-abbrev-table)
622 (abbrev-mode t) 587 (abbrev-mode t)
623 ) 588 )
@@ -662,8 +627,7 @@ This list in not complete.")
662;; Workhorse macro 627;; Workhorse macro
663(defmacro run-network-program (process-name host port 628(defmacro run-network-program (process-name host port
664 &optional initial-string) 629 &optional initial-string)
665 ` 630 `(let ((tcp-connection)
666 (let ((tcp-connection)
667 (buf) 631 (buf)
668 ) 632 )
669 (setq buf (get-buffer-create (concat "*" ,process-name "*"))) 633 (setq buf (get-buffer-create (concat "*" ,process-name "*")))
@@ -720,7 +684,7 @@ queries of the form USER@HOST, and wants a query containing USER only."
720 (process-name (concat "Finger [" user-and-host "]")) 684 (process-name (concat "Finger [" user-and-host "]"))
721 (regexps finger-X.500-host-regexps) 685 (regexps finger-X.500-host-regexps)
722 found) 686 found)
723 (while (not (string-match (car regexps) host)) 687 (while (and regexps (not (string-match (car regexps) host)))
724 (setq regexps (cdr regexps))) 688 (setq regexps (cdr regexps)))
725 (when regexps 689 (when regexps
726 (setq user-and-host user)) 690 (setq user-and-host user))