From owner-ntemacs-users@june  Tue Sep 10 16:00:41 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Tue" "10" "September" "1996" "17:14:00" "CDT" "Douglas Gray Stephens" "gray@austin.sar.slb.com" nil "31" "recover-file requires Unix ls command" "^From:" nil nil "9" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id QAA29244 for <voelker@june.cs.washington.edu>; Tue, 10 Sep 1996 16:00:41 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id QAA25089 for <voelker@joker.cs.washington.edu>; Tue, 10 Sep 1996 16:00:38 -0700
Received: from austin.asc.slb.com (PIGPEN-CLEAR.AUSTIN.ASC.SLB.COM [163.185.74.6]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id PAA23949 for <ntemacs-users@cs.washington.edu>; Tue, 10 Sep 1996 15:14:07 -0700
Received: from BUILD (BUILD.AUSTIN.ASC.SLB.COM) by austin.asc.slb.com (4.1/relay.951226a) 	id AA03251 for <ntemacs-users@cs.washington.edu>; Tue, 10 Sep 96 17:14:00 CDT
Message-Id: <9609102214.AA03251@austin.asc.slb.com>
From: Douglas Gray Stephens <gray@austin.sar.slb.com>
To: ntemacs-users@cs.washington.edu
Subject: recover-file requires Unix ls command
Date: Tue, 10 Sep 96 17:14:00 CDT


Hi,

I've started working on a PC, after many years on a Sun Workstation,
and have installed emacs, and several related packages (ispell,
printing, VM mail, ange-ftp etc.).  

I've noticed that recover-file does not work, as it tries to call
"ls", and I've not installed any unix commands.  I suspect that the
code code be modified to use the file attributes (c.f. dired), rather
than using a system call.

Has anyone patched the recover-file function in files.el for NT?

Thanks,

Douglas.

-- 

================================
Douglas GRAY STEPHENS        
Schlubmerger Austin Product Centre
P.O. Box 200015,             
AUSTIN                  
TX 78720-0015

Phone +1 512 331 3717
Fax   +1 512 331 3760
Email DGrayStephens@slb.com
================================

From owner-ntemacs-users@june  Fri Oct 11 17:02:47 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "11" "October" "1996" "17:57:45" "CDT" "Douglas Gray Stephens" "gray@austin.apc.slb.com" nil "94" "working recover-file function" "^From:" nil nil "10" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.6/7.2ju) with SMTP id RAA11382 for <voelker@june.cs.washington.edu>; Fri, 11 Oct 1996 17:02:46 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id RAA28321 for <voelker@joker.cs.washington.edu>; Fri, 11 Oct 1996 17:02:44 -0700
Received: from austin.asc.slb.com (PIGPEN-CLEAR.AUSTIN.ASC.SLB.COM [163.185.74.6]) by june.cs.washington.edu (8.7.6/7.2ju) with SMTP id PAA06990 for <ntemacs-users@cs.washington.edu>; Fri, 11 Oct 1996 15:57:50 -0700
Received: from ICE-APC (ICE-APC.AUSTIN.ASC.SLB.COM) by austin.asc.slb.com (4.1/relay.951226a) 	id AA23968 for <ntemacs-users@cs.washington.edu>; Fri, 11 Oct 96 17:57:45 CDT
Message-Id: <9610112257.AA23968@austin.asc.slb.com>
X-Mailer: emacs 19.33.1 (via feedmail 3 I) 
From: gray@austin.apc.slb.com (Douglas Gray Stephens)
To: ntemacs-users@cs.washington.edu
Subject: working recover-file function
Date: Fri, 11 Oct 96 17:57:45 CDT


Hi,

The standard recover-file function in file.el gets the file details by
expecting the system to have a command called "ls", which is normally
available on Unix boxes.  It fails gracefully on VMS boxes, but
creates an error on NT boxes.

I've modified this function, so that it will work on NT, by processing
the file attributes.  This should work on all platforms, and may be a
better way for the distributed platform independent version of emacs
to work.

The modifed recover-file function, and a emacs-ls-function that
recover-file calls are appended to this message.

Douglas.


================================
Dr. Douglas GRAY STEPHENS        
Schlubmerger Austin Product Centre,
8311 North FM 620,
AUSTIN,
TX 78726

Phone +1 512 331 3717
Fax   +1 512 331 3760
Email DGrayStephens@slb.com
================================


;;  Modified to work with windows as NT does not have native ls
(defun recover-file (file)
  "Visit file FILE, but get contents from its last auto-save file."
  ;; Actually putting the file name in the minibuffer should be used
  ;; only rarely.
  ;; Not just because users often use the default.
  (interactive "FRecover file: ")
  (setq file (expand-file-name file))
  (if (auto-save-file-name-p (file-name-nondirectory file))
      (error "%s is an auto-save file" file))
  (let ((file-name (let ((buffer-file-name file))
		     (make-auto-save-file-name))))
    (cond ((if (file-exists-p file)
	       (not (file-newer-than-file-p file-name file))
	     (not (file-exists-p file-name)))
	   (error "Auto-save file %s not current" file-name))
	  ((save-window-excursion
	     ;; Fri 11-Oct-1996; Douglas Gray Stephens 
	     ;; added this test for NT 
             ;; (I guess that it be used on all platforms)
	     (if (eq system-type 'windows-nt)
		 (progn
		   (get-buffer-create "*Directory*")
		   (switch-to-buffer-other-window "*Directory*")
		   (erase-buffer)
		   (insert (emacs-ls-function file))
		   (insert (emacs-ls-function file-name))
		   )
	       (if (not (eq system-type 'vax-vms))
		   (with-output-to-temp-buffer "*Directory*"
		     (buffer-disable-undo standard-output)
		     (call-process "ls" nil standard-output nil
				   (if (file-symlink-p file) "-lL" "-l")
				   file file-name))))
	   (yes-or-no-p (format "Recover auto save file %s? " file-name)))
	   (switch-to-buffer (find-file-noselect file t))
	   (let ((buffer-read-only nil))
	     (erase-buffer)
	     (insert-file-contents file-name nil))
	   (after-find-file nil nil t))
	  (t (error "Recover-file cancelled.")))))

;; Function for use with modified recover file.
(defun emacs-ls-function (file)
  "Return similar information to Unix \"ls -l\" command"
  (format "%s  %8s  %10.0d  %s  %s\n"
	  (nth 8 (file-attributes
		  file)
	       )
	  (user-login-name
	   (nth 3 (file-attributes
		   file)
		)
	   )
	  (nth 7 (file-attributes 
		  file))
	  (current-time-string 
	   (nth 5 (file-attributes
		   file)))
	  file
	  )
  )

From owner-ntemacs-users@june  Tue Oct 22 16:54:48 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" "22" "October" "1996" "16:12:13" "-0800" "Mirko Vukovic" "mirko.vukovic@grc.varian.com" nil "7" "M-x recover-file and ls" "^From:" nil nil "10" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.6/7.2ju) with SMTP id QAA09013 for <voelker@june.cs.washington.edu>; Tue, 22 Oct 1996 16:54:48 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id QAA32895 for <voelker@joker.cs.washington.edu>; Tue, 22 Oct 1996 16:54:45 -0700
Received: from falcon.varian.com (falcon.varian.com [132.190.92.15]) by june.cs.washington.edu (8.7.6/7.2ju) with SMTP id QAA04190 for <ntemacs-users@cs.washington.edu>; Tue, 22 Oct 1996 16:11:40 -0700
Received: from neptune.grc.varian.com (neptune.grc.varian.com [132.190.17.21]) by falcon.varian.com (8.6.8/8.6.6) with SMTP id QAA09848 for <ntemacs-users@cs.washington.edu>; Tue, 22 Oct 1996 16:11:32 -0700
Message-ID: <n1366121714.65704@neptune.grc.varian.com>
X-Mailer: Mail*Link SMTP-QM 4.0.0
From: "Mirko Vukovic" <mirko.vukovic@grc.varian.com>
To: "ntemacs users" <ntemacs-users@cs.washington.edu>
Subject: M-x recover-file and ls
Date: 22 Oct 1996 16:12:13 -0800

I'm running 19.34 on windows95.

I just tried to recover a file and emacs complained about the lack of "ls". 
Somewhat puzzling since dired is working just fine.  I do not mind installing
"ls", but could this be a bug?

mirko

