From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 31-AUG-1989 21:05
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Patch to files.el for VMS Dired

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 31 AUG 89 14:17:58 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Thu, 31 Aug 89 13:52:27 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA05611; Thu, 31 Aug 89 13:41:22 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 31 Aug 89 20:05:50 GMT
From: rochester!uhura.cc.rochester.edu!rbr4@cu-arpa.cs.cornell.edu  (Roland Roberts)
Organization: University of Rochester
Subject: Patch to files.el for VMS Dired
Message-Id: <2919@ur-cc.UUCP>
References: <2908@ur-cc.UUCP>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Several people pointed out that there still existed one additional
problem (at least) with the way VMS dired works.  When trying to save
a file which has a version number, e.g. FOO.BAR;3 one typically gets
an error message about an IO error.  It turned out to be easier to fix
than I expected, so below is the patch to files.el which will prevent
this.

On VMS, this patch causes a buffer named FOO.BAR;3 associated with
file DISK:[DIR]FOO.BAR;3 to have the suffix dropped both in the buffer
name and its associated file name once an attempt to save is made.
The result is that the file will be saved as the next higher version
number according to customary VMS usage.  So if there is are versions
4, 5, and 6, this will now be saved as version 7.

If you don't have the 'patch' program, don't worry.  These diff's are
all inserted into a single spot in the expression basic-save-buffer.
It should be quite easy to find.

*** [lisp]files.el
--- files.el
**************
*** 653,658
    (interactive)
    (if (buffer-modified-p)
        (let (setmodes tempsetmodes)
  	(or buffer-file-name
  	    (progn
  	      (setq buffer-file-name
--- 653,679 -----
    (interactive)
    (if (buffer-modified-p)
        (let (setmodes tempsetmodes)
+ 	(if (and (eq system-type 'vax-vms)
+ 		 (string= buffer-file-name
+ 			  (file-name-sans-versions buffer-file-name)))
+ 	    (let ((buffer-new-name nil)
+ 		  (buffer-name-list nil))
+ 	      ;; Strip VMS version number before save
+ 	      (setq buffer-file-name
+ 		    (file-name-sans-versions buffer-file-name))
+ 	      ;; Select a buffer name to correspond
+ 	      (setq buffer-new-name
+ 		    (downcase (file-name-nondirectory buffer-file-name)))
+ 	      ;; Check to see if the buffer name is in use
+ 	      (setq buffer-name-list
+ 		    (mapcar (function buffer-name) (buffer-list)))
+ 	      (while (and buffer-name-list
+ 			  (not (string= buffer-new-name
+ 					(car buffer-name-list))))
+ 		(setq buffer-name-list (cdr buffer-name-list)))
+ 	      ;; Change the buffer name, if no conflict
+ 	      (if (not buffer-name-list)
+ 		  (rename-buffer buffer-new-name))))
  	(or buffer-file-name
  	    (progn
  	      (setq buffer-file-name
-- 
Roland Roberts                      BITNET: roberts@uornsrl
  Nuclear Structure Research Lab  INTERNET: rbr4@uhura.cc.rochester.edu
  271 East River Road                 UUCP: rochester!ur-cc!uhura!rbr4
  Rochester, NY  14267                AT&T: (716) 275-8962

