🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99367

Re: dired-compress gives wrong error message with linked files

#99367
From: Sebastian Kremer
Date: Wed, 03 Oct 1990 15:12
54 lines
2912 bytes
>>>>> "danj1" == danj1  danj1@ihlpa.att.com writes:

danj1> Run dired on a directory with some files with more than one link.

danj1> Move to one of those linked files, and type "C", e.g., on ".xxxrc"
danj1> I get
danj1> .xxxrc.Z not found
danj1> instead of say, a more reasonable
danj1> .xxxrc:  -- has 1 other links: unchanged

Use this version of dired (un)compress (which I hope will be in Emacs
19): 

(defun dired-compress ()
  "Compress this file."
  (interactive)
  (let* ((buffer-read-only nil)
	 compress-err-buffer
	 (from-file (dired-get-filename))
	 (to-file (concat from-file ".Z")))
    (if (string-match "\\.Z$" from-file)
	(error "%s is already compressed!" from-file))
    (message "Compressing %s..." from-file)
    (setq compress-err-buffer (get-buffer-create "*Dired compress output*"))
    (save-excursion (set-buffer compress-err-buffer) (erase-buffer))
    ;; Must have default-directory of dired buffer in call-process
    (call-process "compress" nil compress-err-buffer nil "-f" from-file)
    (if (save-excursion (set-buffer compress-err-buffer) (= 0 (buffer-size)))
	(message "Compressing %s... done" from-file)
      (display-buffer compress-err-buffer)
      (error "Compress error on %s." from-file))
    (dired-redisplay to-file)))

(defun dired-uncompress ()
  "Uncompress this file."
  (interactive)
  (let* ((buffer-read-only nil)
	 compress-err-buffer
	 (from-file (dired-get-filename))
	 (to-file (substring from-file 0 -2)))
    (if (string-match "\\.Z$" from-file) nil
	(error "%s is not compressed!" from-file))
    (message "Uncompressing %s..." from-file)
    (setq compress-err-buffer (get-buffer-create "*Dired compress output*"))
    (call-process "uncompress" nil nil nil from-file)
    (if (save-excursion (set-buffer compress-err-buffer) (= 0 (buffer-size)))
	(message "Uncompressing %s... done" from-file)
      (display-buffer compress-err-buffer)
      (error "Uncompress error on %s." from-file))
    (dired-redisplay to-file)))
--

Sebastian Kremer <sk@thp.Uni-Koeln.DE>
Institute of Theoretical Physics, University of Cologne, F. R. of Germany
Technical Details
Message-ID: <SK.90Oct3161233@sparc1.thp.uni-koeln.de>
Path: arc1-ca.pugleaf.net!gmdzi!unido!uni-koeln!uvax!sk
References: <9010011707.AA24468@life.ai.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,97afa7790e7207da
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-10-04 05:01:55 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!uni-koeln!uvax!sk
From: sk@thp.uni-koeln.de (Sebastian Kremer)
Newsgroups: gnu.emacs.bug
Subject: Re: dired-compress gives wrong error message with linked files
Message-ID: <SK.90Oct3161233@sparc1.thp.uni-koeln.de>
Date: 3 Oct 90 15:12:33 GMT
References: <9010011707.AA24468@life.ai.mit.edu>
Sender: news@rrz.uni-koeln.de (USENET News System)
Distribution: gnu
Organization: Institute of Theoretical Physics, University of Cologne, F. R.
 Germany
Lines: 54
Posted: Wed Oct  3 16:12:33 1990
In-Reply-To: danj1@ihlpa.att.com's message of 30 Sep 90 20:37:00 GMT