Annotation of 43BSDReno/contrib/emacs-18.55/lisp/uncompress.el, revision 1.1.1.1

1.1       root        1: (defun uncompress-while-visiting ()
                      2:   "Temporary \"major mode\" used for .Z files, to uncompress the contents.
                      3: It then selects a major mode from the uncompressed file name and contents."
                      4:   (if (and (not (null buffer-file-name))
                      5:           (string-match "\\.Z$" buffer-file-name))
                      6:       (set-visited-file-name
                      7:        (substring buffer-file-name 0 (match-beginning 0))))
                      8:   (message "Uncompressing...")
                      9:   (shell-command-on-region (point-min) (point-max) "uncompress" t)
                     10:   (message "Uncompressing...done")
                     11:   (set-buffer-modified-p nil)
                     12:   (normal-mode))
                     13: 
                     14: (setq auto-mode-alist
                     15:       (cons '("\\.Z$" . uncompress-while-visiting) auto-mode-alist))
                     16: 
                     17: (defun find-compressed-version ()
                     18:   "Hook to read and uncompress the compressed version of a file."
                     19:   ;; Just pretend we had visited the compressed file,
                     20:   ;; and uncompress-while-visiting will do the rest.
                     21:   (if (file-exists-p (concat buffer-file-name ".Z"))
                     22:       (progn
                     23:        (setq buffer-file-name (concat buffer-file-name ".Z"))
                     24:        (insert-file-contents buffer-file-name t)
                     25:        (goto-char (point-min))
                     26:        (setq error nil)
                     27:        t)))
                     28: 
                     29: (setq find-file-not-found-hooks
                     30:       (cons 'find-compressed-version find-file-not-found-hooks))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.