;;; GNU Emacs code converted from Mocklisp (require 'mlsupport) (ml-defun (ml-foo (declare-buffer-specific do-rcp-write-file))) (ml-foo) (ml-defun (ml-foo (declare-buffer-specific start-file-size))) (ml-foo) (ml-defun (ml-foo (declare-buffer-specific done-first-write))) (ml-foo) (ml-defun (paranoid-write-file growth did-rcp (ml-if (not (buffer-modified-p)) (error "no changes need to be written.") ) (setq growth (- (ml-buffer-size) start-file-size)) (ml-if (>= growth 0) (progn (save-buffer) (ml-if (check-for-rcp) (progn (rcp-write-file) (setq did-rcp "(AND remote copy) ") ) (setq did-rcp "") ) (ml-message "File " did-rcp (buffer-file-name) " grew " growth " chars.") (setq start-file-size (ml-buffer-size)) ) (progn ;File has shrunk (send-string-to-terminal "") (ml-if (= (ml-substr (read-string (concat "File " (file-tail (buffer-file-name)) " will shrink " (int-to-string (- 0 growth)) " chars; write anyway? ")) 1 1) "y") (progn (save-buffer) (ml-if (check-for-rcp) (progn (rcp-write-file) (setq did-rcp "AND rcp`d ") ) (setq did-rcp "") ) (setq start-file-size (ml-buffer-size)) (ml-message "Wrote " did-rcp (buffer-file-name)) ) (error "No changes written.") ) ) ) ) ) (ml-defun (rcp-write-file f h (setq f (buffer-file-name)) (ml-if (/= (ml-substr f (- (length f) 4) 5) "shell") (progn (temp-switch-to-buffer "X") (hk) (set-mark-command) (insert-string f) (exchange-point-and-mark) ;next line is while thyme is served by bugbane (error-occured (replace-string "/private" "")) (ml-if (logior (= (setq h (getenv "thishost")) "iris") (= h "clover")) (progn ; One of the following should work: (error-occured (replace-string "csfac/" "home/")) (error-occured (replace-string "iris1/" "usr/")) ) (ml-if (= (getenv "thishost") "thyme") (replace-string "home/" "csfac/") (error "Wont rcp from this host") ) ) (setq x (region-to-string)) (setq otherhost (getenv "otherhost")) (if (not (string= otherhost "")) (setq z (concat "rcp " f " " "otherhost" ":" x)) (start-process (concat "rcp " f " " otherhost ":" x) "rcp-write") (process-kill-without-query (get-process "rcp-write")) (switch-back-from-temp-buffer) ) ) ) ) ) ;Check if the current file should be rcp?d Files that normally should not ; include shell, any in /tmp, and possibly others. (ml-defun (check-for-rcp (ml-if do-rcp-write-file (rcp-write-file) ) ) )