aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-09-14 21:07:48 +0000
committerStefan Monnier2005-09-14 21:07:48 +0000
commit503ac8a45f01bbd5f63359d629b528322c830b8c (patch)
tree9cec435d1d86a4eeb32504107e620f996faccf57
parente5588c43ebd7184c572cf81d49b710cf97eb76bc (diff)
downloademacs-503ac8a45f01bbd5f63359d629b528322c830b8c.tar.gz
emacs-503ac8a45f01bbd5f63359d629b528322c830b8c.zip
(ange-ftp-process-filter): Revert to ^#+$.
Use with-current-buffer. (ange-ftp-gwp-start): Remove unused var `gw-user'. (ange-ftp-guess-hash-mark-size): Remove unused var `result'. (ange-ftp-insert-directory): Remove unused var `short'. (ange-ftp-file-name-sans-versions): Remove unused var `host-type'.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/net/ange-ftp.el156
2 files changed, 80 insertions, 90 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0d82a5cdc12..c15cba13b39 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12005-09-14 Stefan Monnier <monnier@iro.umontreal.ca> 12005-09-14 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * net/ange-ftp.el (ange-ftp-process-filter): Revert to ^#+$.
4 Use with-current-buffer.
5 (ange-ftp-gwp-start): Remove unused var `gw-user'.
6 (ange-ftp-guess-hash-mark-size): Remove unused var `result'.
7 (ange-ftp-insert-directory): Remove unused var `short'.
8 (ange-ftp-file-name-sans-versions): Remove unused var `host-type'.
9
3 * pcvs-defs.el (cvs-version): Recognize CVSNT version string. 10 * pcvs-defs.el (cvs-version): Recognize CVSNT version string.
4 (cvs-execute-single-dir): Change default: cvs-1.9 is ancient. 11 (cvs-execute-single-dir): Change default: cvs-1.9 is ancient.
5 12
@@ -285,13 +292,6 @@
285 292
2862005-09-06 Stefan Monnier <monnier@iro.umontreal.ca> 2932005-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
287 294
288 * net/ange-ftp.el (ange-ftp-process-filter): Revert to ^#+$.
289 Use with-current-buffer.
290 (ange-ftp-gwp-start): Remove unused var `gw-user'.
291 (ange-ftp-guess-hash-mark-size): Remove unused var `result'.
292 (ange-ftp-insert-directory): Remove unused var `short'.
293 (ange-ftp-file-name-sans-versions): Remove unused var `host-type'.
294
295 * buff-menu.el (Buffer-menu-make-sort-button): Add docstrings, use 295 * buff-menu.el (Buffer-menu-make-sort-button): Add docstrings, use
296 non-anonymous functions. 296 non-anonymous functions.
297 297
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 5d205f575b8..152e71e64cb 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1641,81 +1641,75 @@ good, skip, fatal, or unknown."
1641;; on to ange-ftp-process-handle-line to deal with. 1641;; on to ange-ftp-process-handle-line to deal with.
1642 1642
1643(defun ange-ftp-process-filter (proc str) 1643(defun ange-ftp-process-filter (proc str)
1644 (let ((buffer (process-buffer proc)) 1644 ;; Eliminate nulls.
1645 (old-buffer (current-buffer))) 1645 (while (string-match "\000+" str)
1646 1646 (setq str (replace-match "" nil nil str)))
1647 ;; Eliminate nulls. 1647
1648 (while (string-match "\000+" str) 1648 ;; see if the buffer is still around... it could have been deleted.
1649 (setq str (replace-match "" nil nil str))) 1649 (when (buffer-live-p (process-buffer proc))
1650 1650 (with-current-buffer (process-buffer proc)
1651 ;; see if the buffer is still around... it could have been deleted. 1651
1652 (if (buffer-name buffer) 1652 ;; handle hash mark printing
1653 (unwind-protect 1653 (and ange-ftp-process-busy
1654 (progn 1654 (string-match "^#+$" str)
1655 (set-buffer (process-buffer proc)) 1655 (setq str (ange-ftp-process-handle-hash str)))
1656 1656 (comint-output-filter proc str)
1657 ;; handle hash mark printing 1657 ;; Replace STR by the result of the comint processing.
1658 (and ange-ftp-process-busy 1658 (setq str (buffer-substring comint-last-output-start
1659 (string-match "\\`#+\\'" str) 1659 (process-mark proc)))
1660 (setq str (ange-ftp-process-handle-hash str))) 1660 (if ange-ftp-process-busy
1661 (comint-output-filter proc str) 1661 (progn
1662 ;; Replace STR by the result of the comint processing. 1662 (setq ange-ftp-process-string (concat ange-ftp-process-string
1663 (setq str (buffer-substring comint-last-output-start 1663 str))
1664 (process-mark proc))) 1664
1665 (if ange-ftp-process-busy 1665 ;; if we gave an empty password to the USER command earlier
1666 (progn 1666 ;; then we should send a null password now.
1667 (setq ange-ftp-process-string (concat ange-ftp-process-string 1667 (if (string-match "Password: *$" ange-ftp-process-string)
1668 str)) 1668 (process-send-string proc "\n"))))
1669 1669 (while (and ange-ftp-process-busy
1670 ;; if we gave an empty password to the USER command earlier 1670 (string-match "\n" ange-ftp-process-string))
1671 ;; then we should send a null password now. 1671 (let ((line (substring ange-ftp-process-string
1672 (if (string-match "Password: *$" ange-ftp-process-string) 1672 0
1673 (process-send-string proc "\n")))) 1673 (match-beginning 0)))
1674 (while (and ange-ftp-process-busy 1674 (seen-prompt nil))
1675 (string-match "\n" ange-ftp-process-string)) 1675 (setq ange-ftp-process-string (substring ange-ftp-process-string
1676 (let ((line (substring ange-ftp-process-string 1676 (match-end 0)))
1677 0 1677 (while (string-match "\\`ftp> *" line)
1678 (match-beginning 0))) 1678 (setq seen-prompt t)
1679 (seen-prompt nil)) 1679 (setq line (substring line (match-end 0))))
1680 (setq ange-ftp-process-string (substring ange-ftp-process-string 1680 (if (not (and seen-prompt ange-ftp-pending-error-line))
1681 (match-end 0))) 1681 (ange-ftp-process-handle-line line proc)
1682 (while (string-match "\\`ftp> *" line) 1682 ;; If we've seen a potential error message and it
1683 (setq seen-prompt t) 1683 ;; hasn't been cancelled by a good message before
1684 (setq line (substring line (match-end 0)))) 1684 ;; seeing a propt, then the error was real.
1685 (if (not (and seen-prompt ange-ftp-pending-error-line)) 1685 (delete-process proc)
1686 (ange-ftp-process-handle-line line proc) 1686 (setq ange-ftp-process-busy nil
1687 ;; If we've seen a potential error message and it 1687 ange-ftp-process-result-line ange-ftp-pending-error-line))))
1688 ;; hasn't been cancelled by a good message before 1688
1689 ;; seeing a propt, then the error was real. 1689 ;; has the ftp client finished? if so then do some clean-up
1690 (delete-process proc) 1690 ;; actions.
1691 (setq ange-ftp-process-busy nil 1691 (if (not ange-ftp-process-busy)
1692 ange-ftp-process-result-line ange-ftp-pending-error-line)))) 1692 (progn
1693 1693 ;; reset the xfer size
1694 ;; has the ftp client finished? if so then do some clean-up 1694 (setq ange-ftp-xfer-size 0)
1695 ;; actions. 1695
1696 (if (not ange-ftp-process-busy) 1696 ;; issue the "done" message since we've finished.
1697 (progn 1697 (if (and ange-ftp-process-msg
1698 ;; reset the xfer size 1698 ange-ftp-process-verbose
1699 (setq ange-ftp-xfer-size 0) 1699 ange-ftp-process-result)
1700 1700 (progn
1701 ;; issue the "done" message since we've finished. 1701 (ange-ftp-message "%s...done" ange-ftp-process-msg)
1702 (if (and ange-ftp-process-msg 1702 (ange-ftp-repaint-minibuffer)
1703 ange-ftp-process-verbose 1703 (setq ange-ftp-process-msg nil)))
1704 ange-ftp-process-result) 1704
1705 (progn 1705 ;; is there a continuation we should be calling? if so,
1706 (ange-ftp-message "%s...done" ange-ftp-process-msg) 1706 ;; we'd better call it, making sure we only call it once.
1707 (ange-ftp-repaint-minibuffer) 1707 (if ange-ftp-process-continue
1708 (setq ange-ftp-process-msg nil))) 1708 (let ((cont ange-ftp-process-continue))
1709 1709 (setq ange-ftp-process-continue nil)
1710 ;; is there a continuation we should be calling? if so, 1710 (ange-ftp-call-cont cont
1711 ;; we'd better call it, making sure we only call it once. 1711 ange-ftp-process-result
1712 (if ange-ftp-process-continue 1712 ange-ftp-process-result-line))))))))
1713 (let ((cont ange-ftp-process-continue))
1714 (setq ange-ftp-process-continue nil)
1715 (ange-ftp-call-cont cont
1716 ange-ftp-process-result
1717 ange-ftp-process-result-line))))))
1718 (set-buffer old-buffer)))))
1719 1713
1720(defun ange-ftp-process-sentinel (proc str) 1714(defun ange-ftp-process-sentinel (proc str)
1721 "When ftp process changes state, nuke all file-entries in cache." 1715 "When ftp process changes state, nuke all file-entries in cache."
@@ -1795,8 +1789,7 @@ good, skip, fatal, or unknown."
1795 1789
1796(defun ange-ftp-gwp-start (host user name args) 1790(defun ange-ftp-gwp-start (host user name args)
1797 "Login to the gateway machine and fire up an ftp process." 1791 "Login to the gateway machine and fire up an ftp process."
1798 (let* ((gw-user (ange-ftp-get-user ange-ftp-gateway-host)) 1792 (let* (;; It would be nice to make process-connection-type nil,
1799 ;; It would be nice to make process-connection-type nil,
1800 ;; but that doesn't work: ftp never responds. 1793 ;; but that doesn't work: ftp never responds.
1801 ;; Can anyone find a fix for that? 1794 ;; Can anyone find a fix for that?
1802 (proc (let ((process-connection-type t)) 1795 (proc (let ((process-connection-type t))
@@ -2137,7 +2130,6 @@ suffix of the form #PORT to specify a non-default port"
2137 (save-excursion 2130 (save-excursion
2138 (set-buffer (process-buffer proc)) 2131 (set-buffer (process-buffer proc))
2139 (let* ((status (ange-ftp-raw-send-cmd proc "hash")) 2132 (let* ((status (ange-ftp-raw-send-cmd proc "hash"))
2140 (result (car status))
2141 (line (cdr status))) 2133 (line (cdr status)))
2142 (save-match-data 2134 (save-match-data
2143 (if (string-match ange-ftp-hash-mark-msgs line) 2135 (if (string-match ange-ftp-hash-mark-msgs line)
@@ -4484,8 +4476,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4484;; `ange-ftp-ls' handles this. 4476;; `ange-ftp-ls' handles this.
4485 4477
4486(defun ange-ftp-insert-directory (file switches &optional wildcard full) 4478(defun ange-ftp-insert-directory (file switches &optional wildcard full)
4487 (let ((short (ange-ftp-abbreviate-filename file)) 4479 (let ((parsed (ange-ftp-ftp-name (expand-file-name file)))
4488 (parsed (ange-ftp-ftp-name (expand-file-name file)))
4489 tem) 4480 tem)
4490 (if parsed 4481 (if parsed
4491 (if (and (not wildcard) 4482 (if (and (not wildcard)
@@ -4511,10 +4502,9 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4511(defun ange-ftp-file-name-sans-versions (file keep-backup-version) 4502(defun ange-ftp-file-name-sans-versions (file keep-backup-version)
4512 (let* ((short (ange-ftp-abbreviate-filename file)) 4503 (let* ((short (ange-ftp-abbreviate-filename file))
4513 (parsed (ange-ftp-ftp-name short)) 4504 (parsed (ange-ftp-ftp-name short))
4514 host-type func) 4505 func)
4515 (if parsed 4506 (if parsed
4516 (setq host-type (ange-ftp-host-type (car parsed)) 4507 (setq func (cdr (assq (ange-ftp-host-type (car parsed))
4517 func (cdr (assq (ange-ftp-host-type (car parsed))
4518 ange-ftp-sans-version-alist)))) 4508 ange-ftp-sans-version-alist))))
4519 (if func (funcall func file keep-backup-version) 4509 (if func (funcall func file keep-backup-version)
4520 (ange-ftp-real-file-name-sans-versions file keep-backup-version)))) 4510 (ange-ftp-real-file-name-sans-versions file keep-backup-version))))